How do I choose(several numbers from(1,2,3,4,5,6,24)

Get help using Construct 2

Post » Mon Nov 14, 2016 2:05 pm

Dear community,

I have created two buttons "question1" and "question2"
I have also a variable "exercice"

When I click on button "question1"
variable "exercice" sets value to: choose(1,2,3,etc,24)

so I have one value to find;

What I want to do (but don't have the expression for)

When I click to Button "question2"

variable "exercice" sets value to choose2values(1,2,3,4,etc24)

Is it possible to choose xvalues from () ?

Thank you for your help,

Stéphane
B
4
Posts: 17
Reputation: 228

Post » Mon Nov 14, 2016 3:01 pm

You could use the system condition "repeat"

on button "question2" clicked
repeat 2 times

add to variable "exercice" choose(1,2,3) etc.

Depending on if the variable is a string or a number will get different results, eg if 1 and 3 is chosen in a string variable it will appear as "13", in a value it will add them together 1+3 = 4.

If it's a string variable and you want to keep the numbers separate you can add a token eg, add to variable "exercice" choose(1,2,3)&"," so it will appear as "1,3," in the variable. You can then use the token system expressions later to manipulate them further.
B
43
S
23
G
21
Posts: 735
Reputation: 12,132

Post » Mon Nov 14, 2016 3:07 pm

If you're looking for 2 different choices on question 2 you could just use choose twice and store the second result in another variable. Then you can condition out for it to choose until choice 2 /= choice 1 variable.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
71
S
19
G
8
Posts: 640
Reputation: 9,701

Post » Mon Nov 14, 2016 4:42 pm

Hey, thanks for your reply, Ethan and Chrisinfinger !
I want a question with two numbers: ex 1 and 5, with answer that is 1 and 5 (not 6)

So for now, I use 2 variables(1 and 2) when I click on the button question, it picks 2 numbers
and for the answer, I've created another variable3 that is set to (variable1+2) that is compared to the solution text box

Well... that's not very light, but it works !

Btw this is for a solfege piano game
B
4
Posts: 17
Reputation: 228

Post » Mon Nov 14, 2016 5:08 pm

Literally choose(0,1,2,3,5)
Image ImageImage
B
172
S
50
G
183
Posts: 8,443
Reputation: 115,605


Return to How do I....?

Who is online

Users browsing this forum: Lancifer and 27 guests