How do I use | in globalvariable = stringa or b or c?

Get help using Construct 2

Post » Mon Feb 08, 2016 7:37 am

object1 on collision object2 ----------- destroy object1
--------- globalvariable1="a"|"b"|"c" ------- subtract 3 from globalvariable2


do i need parenthesis somewhere in my subevent? around all of it? or each individual set of ""?
B
4
Posts: 9
Reputation: 218

Post » Mon Feb 08, 2016 10:16 am

Try:
object1 on collision object2 ----------- destroy object1
--------- globalvariable1="a"|globalvariable1="b"|globalvariable1="c"=1 ------- subtract 3 from globalvariable2
B
24
S
3
G
1
Posts: 430
Reputation: 2,123

Post » Mon Feb 08, 2016 4:56 pm

A regexvariant would be

test regex
string: globalvariable1
regex: "^[abc]$"
flags: ""

If you need to check for variable contents (a not being a string, but variable name), then the variant without regex will be easier.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Mon Feb 08, 2016 10:12 pm

Bear with me, I don't use construct as often as I would like....
Asmodean wrote:Try:
object1 on collision object2 ----------- destroy object1
--------- globalvariable1="a"|globalvariable1="b"|globalvariable1="c"=1 ------- subtract 3 from globalvariable2

Is there a way to do a | in the midst of comparing global variables? I just see a drop down that I can't edit other than choosing one. If my understanding is not lacking, I would have to do each global variable= "whateverletter" as a separate sub event and that is what I was attempting to avoid. Eventually there will be 18 different possible values for globalvariable1 in this case (that mix and match combinations of 1 and 5), and 8 subevents already, each with another condition attached that is similar to the prior compare global variable, if I get it the way that I want. And this process will then need to be done an additional 18 times.

mindfaQ wrote:A regexvariant would be

test regex
string: globalvariable1
regex: "^[abc]$"
flags: ""

If you need to check for variable contents (a not being a string, but variable name), then the variant without regex will be easier.

I didn't know that test regex was a thing, this may work, though it was not what I originally was hoping for. I'll have to do some more research, but I mostly would still Just like to know the proper format for finding comparing a global variable to multiple possibilities in text form

if I'm not being clear, when I'm at this stage

variable: globalvariable1
comparison: =
value: this is the part I don't know how to put multiple text possibilities separated by |
B
4
Posts: 9
Reputation: 218

Post » Mon Feb 08, 2016 10:46 pm

Image
Image
Second value 1=true ;0=false
Image
B
62
S
23
G
7
Posts: 1,470
Reputation: 10,731

Post » Mon Feb 08, 2016 10:55 pm

awesome thanks so much everyone! I understand now!
B
4
Posts: 9
Reputation: 218


Return to How do I....?

Who is online

Users browsing this forum: wertt22 and 7 guests