Iterate global variable and question


#1

1) Give a description of the problem
Iterate global variable

2) What is the expected behavior?
@globalvariable = @globalvariable (-/+) 1

3) What is happening/not happening?
Don’t know how to do this.

I am trying to iterate a global variable. I want to know how many people are present at my house at a given time, and iterate the global variable up or down as people enter/exit. First of all, I don’t know how to put custom lines of code into wC. I am new to this whole thing. And two, I don’t know how to code it so as to iterate the global variable.

Any help is appreciated.


#2

Make sure the global variable is defined as an integer. Then when someone changes to present you can set the variable with either a value {@yourGlobalVariable} + 1 or as an expression @yourGlobablVariable + 1 Then just do the opposite when someone leaves.

When using the value field you need the {} brackets around any variable, function or expression.

When using the expression field you don’t need the {} brackets but you will need single or double quotes around any string text you want.


#3

How do I do the @globalvariable + 1? I can get it to where it says…

Do x2 Set variable {@globalvariable} = {@globalvariable}

But how can I change it to variable + 1… I don’t see anywhere I can manually change anything, only the prepopulated stuff.

Or if I change it to Value, it just lets me change the integer, I can’t input anything.


#4

Nevermind. I think I found it!

Changed to expression, and ended with this…

do x2 Set variable {@globalvariable} = {{@globalvariable} + 1};

Is this correct?


#5

You have the do part right. However, instead of setting the variable avian, like you have it. You need to manually type in {@globalvariable} + 1

I believe that will do it?

I don’t use a lot of counters


#6

You don’t need the curly brackets in the expression field. You can copy and paste exactly like I have it in my original response


Passing multiple variables in the same expression