Page 1 of 1

timer- variable dependancy

Posted: Friday 23 June 2017 9:36
by krommetje3108
If possible I would like to have a timer that checks if a variable is a 0 or 1. That way I can program several timers for e.g. hollidays

e.g: a schoolholiday the var vacation is set to 1
not a schoolvacation the var vacation is set to 0

So can make timers that check the var and act accordingly....

Re: timer- variable dependancy

Posted: Friday 23 June 2017 14:36
by D'rMorris
Did you read the wiki?
If you define a user variable called "vacation", you can use that in a script / blockly. You can either directly call the uservariable in a script like so:

Code: Select all

 if ( uservariables["vacation"] == "1" ) then .....
I always put the uservariables in local script variables, this makes the code more readable and easier to debug imho.

In a script you would first fill a script variable based on the user variable like:
vacation = uservariables["vacation"]

Then you can just do:

Code: Select all

 if (vacation == "1") then .....