How to use a rand commando in a comparative


I want that the player chose a number between 1 100 and compare it to a rand die_roll but don’t work what I’m doing wrong

*input_number number 1 100
*rand die_roll 1 100
*if die_roll > {number} ____bla \*elseif die_roll = {number}

I have to put ()? I really confused about how do this please help!


If you want to compare two values, there’s no need for the ${}. To use your example:

*input_number number 1 100 
*rand die_roll 1 100 
*if die_roll > number
*elseif die_roll = number

That should work.


but I want people input the name themselves @CS_Closet or with the number alone work?
edit I think I understand know I have to set number “$” before don’t I ?


I don’t think you need the “$” at all. “input_number number 1 100” works like using the *set command, but the player can type in the value. The only thing you need to do is make sure “number” and “die_roll” are variables in the mygame.js.


yes are variables


I have not tried this but I would code it this way

Choose a number 1 thru 100
\*input_text number
\*rand die_roll 1 100
\*if (die_roll > number)
\*elseif (die_roll = number)


thanks I think work fine for now!!