[HOW?] compare random value without any variable

Get help using Construct 2

Post » Sun Sep 16, 2012 12:21 am

Hello
Today I was thinking if it was possible to compare a random value in a conditino without first setting a random value to a variable..

normally I first add a condition that adds a random value to a variable, like random(3) (this can be 0, 1 or 2)
then I add another condition that compare this variable result with another value of my choice and depending of the choice, a different action will be performed.

but, is it possible to jump the part of adding a random value to a variable and instead compare directly in the condition? example:
<CONDITION>
SYSTEM - round(random(3)) = 2
SYSTEM - trigger once
<ACTION>
set Text1.Text "It works"
else
set Text1.Text "Oops"

right now if I do that, the condition will test all the possibilities of the random expression and so will always trigger the action setting the text to "It works". My question is if there is a way that the condition will only try 1 value of the random expression and then stop.
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Sun Sep 16, 2012 2:41 am

Ahem ... manual is here to help you !
Second paragraph , just after general sub-title !kbdmaster2012-09-16 02:42:21
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Sun Sep 16, 2012 2:47 am

Bonus usability hint: use choose(0,1,2) instead of round(random(3))sqiddster2012-09-16 02:47:48
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sun Sep 16, 2012 7:00 pm

[QUOTE=kbdmaster] Ahem ... manual is here to help you !
Second paragraph , just after general sub-title ![/QUOTE]

Apparently you did not even read what I wrote because your answer has nothing to do with my question.
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Sun Sep 16, 2012 7:04 pm

[QUOTE=sqiddster] Bonus usability hint: use choose(0,1,2) instead of round(random(3))[/QUOTE]
why would choose be better than round(random)? isn't the same in this case?
I also tried to compare choose(0,1) with a value and test if it trigger 50% of the times but it always trigger an action because the condition test the 2 options(0 and 1).
B
30
S
6
G
5
Posts: 433
Reputation: 6,061


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests