Forum

Boolean in , output change when boolean change in code editor

Hi
i can t figure out how to make a plugin that has it s output changes only when the input change with a if statement

it seems that i can t use a .IsChanged because it seems to work only with enumerations

i thought of saving the state of the bool in a temporary variable and then comparing the original with the temp , but i have some trouble doing so in c# as i don t know where i should declare variables , when to store one in the other …

also , where can i find the function list i can use with the bool type ? i am lost using pluginspecs/
(2nd day of C#)

Cheers

so i understood , i have to use IDiffSpread when i declare my input to be able to use .IsChange in a if statement to control the output

thanks Joreg

so it works but there is a problem when i put a toggle box on the pin

if i manipulate the input of the plugin with the mouse or the inspektor , everything works well

but if i put a IOBox (Value Advanced) with Boolean (Value Type) and Toggle (behavior)

the output does not react

is it normal ?

can you provide a simple demo?

i am not sure how to send it the right way , so i made a zip with everything inside
(sorry i didn t read the tutorial for sharing the plugin yet)

my first try at c# (85.3 kB)

sory, a bunch of code is no help without you trying to explain what the actual problem is. at which lines of code am i supposed to look. what do you expect to work how and where. try to give a step by step description of what you’re trying to achieve and where you’re stuck.

also when working with keyboard-stuff better use alpha28 already which has a dedicated KeyboardState type and probably see how TypeWriter is using it.

i just realized , my enum also doesn t work with a iobox on it s pin
i start thinking it is because i put my if statement after the for spreadMax loop

i actually don t have any error in the plugin

the problem is that when i unplug the toggle (the one on the top of the patch)
and manipulate the pin (with the mouse or inspektor) it was plugged to (Pen UP)
i can see the output changing briefly in the IOBox(string)

now if i plug the toggle (IOBox Value Advanced) in the “Pen Up” pin of my plugin , the output is not changing as it used to be (not changing at all)

i guess i am not doing it right with the keyboard thingy
but it is my first try with the code editor (or c#), and i have no idea what to do with the link you sent , i am a total noob .

ok i found out the solution ,
in fact i had some “else if” statement that where not compatible with each other , because they where from different types

if(something on a string)
else if(something on a string)
.
.
.
else if(something on a enum)
else if (something on a bool)
else (something string)