Hello!
I need to check if my object's variable contain one of the possible values.
I know that I can use something like this:
+ System: Every tick + MapInOutCheck: MapInOutCheck = "upleft" ----+ MapInOutCheck: TypeChecked = "ULDR" ----+ OR MapInOutCheck: TypeChecked = "LDR" ----+ OR MapInOutCheck: TypeChecked = "UDR" ----+ OR MapInOutCheck: TypeChecked = "ULR" ----+ OR MapInOutCheck: TypeChecked = "DR" ----+ OR MapInOutCheck: TypeChecked = "UR" ----+ OR MapInOutCheck: TypeChecked = "LR" ----+ OR MapInOutCheck: TypeChecked = "R" ----+ OR MapInOutCheck: TypeChecked = "" -----> MapInOutCheck: Set Entrance to True
But I was asking myself if there is a better and simple way to do it, like this for example:
+ System: Every tick + MapInOutCheck: MapInOutCheck = "upleft" + MapInOutCheck: TypeChecked = "ULDR"|"LDR"|"UDR"|"ULR"|"DR"|"UR"|"LR"|"R"|"" -> MapInOutCheck: Set Entrance to True
This isn't working, even if I read that "|" means "or"
So maybe you guys have a solution for me?
This is how you’d use that or operator in an expression:
System: pick MapInOutCheck by comparison: (MapInOutCheck.TypeChecked = "ULDR" | MapInOutCheck.TypeChecked = "LDR" | MapInOutCheck.TypeChecked = "UDR" | MapInOutCheck.TypeChecked = "ULR" | MapInOutCheck.TypeChecked = "DR" | MapInOutCheck.TypeChecked = "UR" | MapInOutCheck.TypeChecked = "LR" | MapInOutCheck.TypeChecked = "R" | MapInOutCheck.TypeChecked = "" ) = 1
But for something like that I’d utilize the find expression. The list of values are comma separated with commas before and after, and we surround the variable value by commas and find it in the list.
System: pick MapInOutCheck by comparison: find(“,ULDR,LDR,UDR,ULR,DR,UR,LR,R,,”, “,”& MapInOutCheck.TypeChecked&”,”)>-1
Your first solution is working fine.
The second one with the find expression looks great and more elegant but it seems there is an extra " somewhere…
Develop games in your browser. Powerful, performant & highly capable.
Probably should work if you retype the quotes. By default my phone uses different quotes than construct uses.
Yes that's it!
Here is the good version:
+ System: Every tick + MapInOutCheck: MapInOutCheck = "upleft" + System: Pick MapInOutCheck where find(",ULDR,LDR,UDR,ULR,DR,UR,LR,R,,", ","& MapInOutCheck.TypeChecked&",") > -1 -> MapInOutCheck: Set Entrance to True
Thanks for your help!!