XuN 
Sphere Developer
    
Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30
![]()
|
RE: How to compare random values
local.x=<r20> // here you set the random numbers
local.y=<r50>
if (<local.x> == 20 || <local.y> == 50)// I don't exactly understand what do you want, however here you have some examples.
if ( <local.x> == <local.y> )
if / while ( <local.x> + <local.y> == 20)
Using a while means that you have to run a code while you have that result, so if you don't want 20 as result and you are changing the values inside the while to get a different result then its ok, otherwise you'll be creating an infinite loop.
Correct
Code:
local.x=<r20>
local.y=<r50>
while (<local.x>+<local.y> == 20 ) <-- this will ensure that you'll have checks untill their sum != 20
local.x=<r20>
local.y=<r50>
endwhile
...
your code
wrong
Code:
local.x=<r20>
local.y=<r50>
while (<local.x>+<local.y>==20) <-- this will create a loop when the result is 20
your code //but if you run your code here without modifying the values ... it will then run forever, hence freezing the server.
end
|
|
06-17-2014 05:58 PM |
|
|