Loop with a variable name

Get help using Construct 2

Post » Sat Nov 15, 2014 12:35 am

Is it possible to name a loop using a variable?
Something like:

Code: Select all
loopName = "the_loop"

for loopName from 1 to 100 -> set object.X to loopindex(loopName)


The problem here is that "loopindex(loopName)" is not accepted as a valid expression, even though "for loopName from 1 to 100" is possible

----- EDIT:
Figured it out. Using str() on the variable name forces the expression to be accepted
"loopindex(str(loopName))"
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Thu Nov 20, 2014 11:05 am

Thanks for posting your solution 7soul, I was trying to figure that out too.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560


Return to How do I....?

Who is online

Users browsing this forum: Semoreh and 4 guests