Toggle a variable?
8 posts • Page 1 of 1
Toggle a variable?
I know in actionscript it's "variable = !variable" and in lua it's "variable = not variable" and so on, but how can you do such a thing in Thyme?
-
ShnitzelKiller - Posts: 49
- Joined: Sun Sep 06, 2009 9:42 pm
Re: Toggle a variable?
What do you mean by toggle? Are you talking about true and false? If so, scene.my.var == "true" ? {scene.my.var = "false"} : {scene.my.var == "false" ? {scene.my.var = "true"} : {}}
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Toggle a variable?
Am I seeing things, or are those if statements? Are those quotes needed, since it's not a string?
EDIT: i get errors if I paste that code in. What are those extra brackets at the end for?
EDIT: i get errors if I paste that code in. What are those extra brackets at the end for?
-
ShnitzelKiller - Posts: 49
- Joined: Sun Sep 06, 2009 9:42 pm
Re: Toggle a variable?
It's late and I messed up. scene.my.var == "true" ? {whatever you want if it is true} : {whatever you want to have happen if it is false}
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Toggle a variable?
I still get an error.
Argh. With or without quotations around false and true.
I replaced "whatever you want to be blah blah" with scene.my.var = true and scene.my.var = false. I get an error. Well, two errors.
Argh. With or without quotations around false and true.
I replaced "whatever you want to be blah blah" with scene.my.var = true and scene.my.var = false. I get an error. Well, two errors.
-
ShnitzelKiller - Posts: 49
- Joined: Sun Sep 06, 2009 9:42 pm
Re: Toggle a variable?
Did you declare scene.my.var in the console ?
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Toggle a variable?
ShnitzelKiller wrote:I know in actionscript it's "variable = !variable" and in lua it's "variable = not variable" and so on, but how can you do such a thing in Thyme?
It is the same in thyme.
- Code: Select all
Scene.my.One = ! Scene.my.One
Will switch it from true to false , you can also do.
- Code: Select all
Scene.my.One = Scene.my.One ? false : true
Both result in the same value .
- gradyfitz
- Posts: 174
- Joined: Tue Sep 01, 2009 8:33 am
- Location: Victoria, Australia
Re: Toggle a variable?
Really? COOL!
.. ,__,_____
. / __.==--" - - - - - - - - ""
./#(-'
.`-' From http://www.ascii-art.de/. Modded by me to work in Arial.
. / __.==--" - - - - - - - - ""
./#(-'
.`-' From http://www.ascii-art.de/. Modded by me to work in Arial.
a Mammoth wrote:be boring and interesting.
I didn't know you could go up 3.1.3! Thanks Mystery person!Mystery wrote:If you were jailbreaker you shouldn't have when't up the 3.1.3
-
Dakta - Posts: 417
- Joined: Sat Sep 12, 2009 4:36 pm
8 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 19 guests