How do I go to a random layout

Get help using Construct 2

Post » Sat Apr 26, 2014 10:37 am

Hi all, I need some help with the coding.
If I want to go to a random layout and my layouts are labelled as 1w1, 1w2, 1w3...,
What is the code I should use? Is it go to layout "1w "&random(1,3)?
I tried doing it this way but it doesn't seem to work. Does anyone have any better suggestions?
B
11
S
2
Posts: 22
Reputation: 778

Post » Sat Apr 26, 2014 10:51 am

Your Code should work.

Get rid of the space:
"1w"&random(1,3)
B
22
S
7
G
4
Posts: 154
Reputation: 3,709

Post » Mon Apr 28, 2014 3:12 pm

Thanks @5Type!
B
11
S
2
Posts: 22
Reputation: 778

Post » Mon Apr 28, 2014 3:23 pm

"1w"&int(random(1,3))
Note this will produce 1 or 2, not 3. Add one more to cover the maximum.
ImageImageImage
B
71
S
22
G
242
Posts: 3,734
Reputation: 134,994


Return to How do I....?

Who is online

Users browsing this forum: ametueraspirant, dand, mickclarke and 25 guests