TOUR
PRICING
HELP
Stencylpedia
Blocks Guide
Sample Games
Developer Center
FORUMS
CHAT
#MADEINSTENCYL
EDUCATION
SIGN IN
×
Welcome back!
Username or E-mail
Password
(
Forgot?
)
C
OMMUNITY
Home
Issue Tracker
Inbox [0]
New Posts
New Replies
Search
Stencyl Community
→
Stencyl
→
Ask a Question
→
if random number between is not any number between
Pages:
1
if random number between is not any number between
readerboy7
Posts: 59
September 24, 2011, 02:06:22 am
i want to make a behavior where if a random number is not any number between 2 other numbers, something happens. can you please help?
Ganu
Posts: 224
September 24, 2011, 02:42:19 am
always
{
generate random number (your_number);
if (your_number < higher bound, and your number > lower bound)
{
}
}
Currently waiting for joints in stencylworks.
Hectate
Posts: 4643
September 24, 2011, 06:23:38 am
That would check to see if your number was within the higher and lower bounds. What he wants is to make sure that the random number is not between those bounds. You should be able to swap the greater/less than signs and switch the AND to an OR instead.
Code:
[Select]
if ( yourNumber > higherBoundary OR yourNumber < lowerBoundary )
{
doWhateverYouNeedTo;
}
« Last Edit: September 24, 2011, 06:32:47 am by Hectate »
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.
Ganu
Posts: 224
September 24, 2011, 07:45:21 am
Oww sorry my fault.
Currently waiting for joints in stencylworks.
Pages:
1