Forum Discussion

RonLinder-4c1a3's avatar
RonLinder-4c1a3
Community Member
3 years ago

Change State based on variable

Is there a way to change the state based on variable rather than a static value. For example I have 6 states named: normal, 1, 2, 3, 4, 5

I have a variable named StateNum that changes to: 1,2,3,4,5

I want in one trigger to set the state to whatever the StateNum value is. So change state to 1 when StateNum = 1, etc.

I can do so with 5 diff triggers but would be cool if we can do so via one trigger (maybe via Jscript).

  • Programmer-type people have been wanting this ability for decades. To the best of my knowledge, it doesn't exist in any language. You have to write one or two lines of code for each possible state.

    Apple's old,old BASIC used to have a "ON variable GOTO X, Y, Z", but I think that got deprecated when line numbers went out.