Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : General : Scripting: Test for NOT
New Topic New Poll Post Reply
Poster Message
larrymurk
Level: Smitemaster
Avatar
Rank Points: 1912
Registered: 12-09-2004
IP: Logged
icon Scripting: Test for NOT (0)  
It seems like more often than not I want to test for the Not of a condition.

For example say I want to do something when x does not equal 5.

I'd do

If
Wait for var x = 5
else
stuff to do here
end if

Is there a way to make the test do the opposite so the code wouldn't use else and would be more understandable?
02-27-2013 at 04:41 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
mxvladi
Level: Smitemaster
Rank Points: 2505
Registered: 02-11-2008
IP: Logged
icon Re: Scripting: Test for NOT (0)  
I might be overthinking this, but you could do something like "Set var N = (x-5)*(x-5); Wait until var N greater than 0)" (N is 0 only when x is 5) As long as you don't mind the additional variable in script, that should serve you fine.
02-27-2013 at 06:37 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
larrymurk
Level: Smitemaster
Avatar
Rank Points: 1912
Registered: 12-09-2004
IP: Logged
icon Re: Scripting: Test for NOT (0)  
thx mxv,

This is no big deal since I can always just use the ELSE clause. I was just wondering if there was some trick to change the IF to being !IF or something.
02-27-2013 at 07:03 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : General : Scripting: Test for NOT
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.