How do you set up a choose set value sucessfully?

Get help using Construct 2

Post » Thu Jun 09, 2016 6:47 am

Do you set it up like this?
choose("1","2","3","4,","5","6","7","8")
or this?
choose(1,2,3,4,)
or this?
choose( 1 ,2 ,3 ,4 )¨
or in another way?
should it be a space between choose and (?
Should you have etctera at the end? I have been told sometimes that you need it at the end but have also been told sometimes that you should not put it in becuase it makes Construct choose it sometimes and make nothing happen.
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Thu Jun 09, 2016 7:43 am

choose(1,2,3,4)
or
choose( 1 ,2 ,3 ,4 )
work.

The first one as far as I know chooses "1", "2" and so on as characters and not numbers.
Kind of like if you're inputting "char" as opposed to "int"
Image Image Image
B
29
S
11
G
27
Posts: 730
Reputation: 17,002

Post » Sat Jun 11, 2016 2:33 pm

things like this work too

choose(int(random(1,5)),int(random(5,10)))
Image
B
28
S
11
G
2
Posts: 139
Reputation: 3,299

Post » Sat Jun 11, 2016 2:45 pm

when in doubt read the manual ,
choose(a, b [, c...])
Choose one of the given parameters at random. E.g. choose(1, 3, 9, 20) randomly picks one of the four numbers and returns that. This also works with strings, e.g. choose("Hello", "Hi") returns either Hello or Hi. Any number of parameters can be used as long as there are at least two.
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499


Return to How do I....?

Who is online

Users browsing this forum: biasaur, Unconnected and 10 guests