how to say x OR x?
Fodder76
Member Posts: 154
I'm sure this is programming 101, but I'm just not able to get it to work.
I need an expression that allows me to say if x is equal to x OR x.
The or is what I'm having trouble with. My programmer friend is telling me that the standard format for or is ||, but I can't seem to get that to work.
Help?
I need an expression that allows me to say if x is equal to x OR x.
The or is what I'm having trouble with. My programmer friend is telling me that the standard format for or is ||, but I can't seem to get that to work.
Help?
Comments
But thankfully with GameSalad you don't have to worry about any scripting whatsoever. You can achieve the same effect by staking the Rule behaviour.
Drag a Rule behaviour into your actor and for the first condition of your OR statement, leave it as "When All conditions are valid" and then set it to an Attribute matching one of your variables; most probable will be that this is a Game variable but it could be a local variable as well.
Then, if it is a simple "if this or else" type of statement, then you can put the equivalent of the false part of the condition (where the first part fails) into the Otherwise part of the rule.
If it is a multi-part conditional test (3 or more tests), you can drag more Rule behaviours into the Otherwise section. Just be careful that you walk through all the potential conditions that could be executed.
Good luck.
Then you can put in 'When x = 30'
and
'when x = 40'
And when either of those conditions are satisfied, the rule will kick off.
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Quantum. I would love to go that route, but unfortunately I also need to check for a touch, so I can't use the 'any' option, as it will always be triggered.
Thanks for your responses!
You can also nest Rules inside of other Rules to make more complex behaviors, which is what you'll want to do.
Your structure will look something like this:
Rule
When ALL conditions are valid
Touch is Pressed
.....Rule
.....When ANY conditions are valid
.....condition 1
.....condition 2
..........do something
.....otherwise
..........do something else
It depends how you want to do it...do you want to randomly set it?
i.e: When this actor is touched, randomly set the attribute to either 1 or 4?
Thanks to everyone! Can't wait to give it a shot in the morning.