PDA

View Full Version : help with local variables



henri
02-01-2012, 01:46 PM
Hi,
I can use some help with local variables.
I do want to use a button to encrease variables.
like 0 + 1 = 1 and when push the button again 1 + 1 = 2 ect. Buth mine remains 1 what ever i do.
It should be simple a guess?
hope some one can help me out?
regards,
henri:(

deering
02-01-2012, 10:24 PM
Hello Henri.

Assuming this is about SIOC:

When an event occurs to cause a section of script to be executed, a set of local variables is created for use during that iteration of the script. The local variables are lost when the section of script ends; i.e values assigned to them do not survive from one iteration to the next.

For your purposes use an ordinary variable; e.g.




Var 0010, NAME Button, LINK IOCARD_SW, TYPE P
{
&Counter = &Counter + 1
.
. etc.
.
}

Var 0020, NAME Counter, VALUE 0


Jim.

henri
02-02-2012, 09:22 AM
Thanks Jim,
that did it.
regards,
henri