How do I convert a string into an expression?

Get help using Construct 2

Post » Sun Jul 09, 2017 5:30 pm

I am trying to convert a string into an expression (an object's instance variable) and use it in a comparision.
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Sun Jul 09, 2017 7:13 pm

This question doesn't really make sense. What are you trying to do, exactly? Why would you need an instance variable to be an expression?
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 209
Reputation: 3,476

Post » Sun Jul 09, 2017 9:30 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sun Jul 09, 2017 10:08 pm

I have 4 instance variables for an object, the names of the variables are for example var0, var1, var2 and var3.

I wan't to check if one of the variables is true or false in a single comaprision block. However, in order to know which one of the instance variables I need to check I have to use this other number that determines it (in my case it's the 'loopindex'.

So, I am trying to construct the variable as a string object.var&loopindex, and then use it to check. But, I don't think I know how to do it or whether it's even possible...
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Sun Jul 09, 2017 10:25 pm

Mmm! Perhaps somebody will contradict me and we'll both learn something, but... to my knowledge it's not possible to do that :(
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 209
Reputation: 3,476

Post » Sun Jul 09, 2017 10:40 pm

I've already tried this, and it's impossible that way. You'll have to find another solution ;)
B
6
S
1
Posts: 29
Reputation: 408

Post » Sun Jul 09, 2017 10:54 pm

Suppose none bothered to click.
Anyway. Another way is to use an array.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: wertt22 and 9 guests