|
TiberSeptim Beginner
Joined: 20 Jun 2006 Posts: 24
|
Posted: Mon Jan 21, 2008 10:10 am
Seems simple enough, why isn't it working? |
#if {@incasting = 0} {gt Sanctuary down!}
Elsewhere I have triggers to set incasting to 1 if I'm in the process of doing something that could be interrupted by the grouptell command. These work and when I mouse over the "incasting" variable in the above trigger it even reads 1... however, the gt command still executes regardless.
I'm confused as it seems like a simple if-statement and the gt command should only execute if incasting = 0? |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Mon Jan 21, 2008 10:44 am |
Syntax: #IF (expression) {true-command} {false-command} (source: #I)
There is the syntax error - you must use parentheses for your expression. Since you do not have parentheses with expression, I guess that your #IF statement always evaluates to False and therefore it always execute {false-command} part in second braces, i.e. gt Sanctuary down! script. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jan 21, 2008 11:40 am |
Arde is correct - {@incasting = 0} is what's called an expanded string, where variables are expanded but the result is still a string. So the string "1 = 0" and not the expression "1 = 0" is passed to the #if. A non-null string is true, so the true command is executed.
In order for the result to be considered an expression, use brackets () rather than braces {}. |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Mon Jan 21, 2008 11:54 am |
Thanks for correcting me, Fang!
|
|
_________________ My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads |
|
|
|
|
|