![](templates/Classic/images/spacer.gif) |
Xolademoness Wanderer
Joined: 18 Jun 2004 Posts: 73 Location: United Kingdom
|
Posted: Fri Aug 31, 2007 5:01 am
#IF in macro not working, always acting as if it is true, worked fine in zmud:( |
i have MULT do this macro
#IF {@snipermag=1} {~shr @targetname} {~sh @targetname}
so if the sniper rifle magazine has less than 1 when I shoot it does a shoot then reload, otherwise just normal shoot - this worked fine in Zmud, but now in Cmud it just always acts if it is true, I have no idea why - the variable definitely is NOT 1... :(
can anyone help? |
|
_________________ mhm.. |
|
|
![](templates/Classic/images/spacer.gif) |
Arlie Wanderer
Joined: 09 Jun 2006 Posts: 62 Location: Florida
|
Posted: Fri Aug 31, 2007 5:07 am |
I'm not sure if it would cause the expression to fail, but you should use #IF () {} {} syntax for an if statement, not #IF {} {} {}. So basically, your statement would be...
#IF (@snipermag=1) {~shr @targetname} {~sh @targetname}
If it doesn't solve the problem, hopefully you'll get that resolved... but otherwise, proper syntax is always a good thing :) |
|
|
![](templates/Classic/images/spacer.gif) |
Xolademoness Wanderer
Joined: 18 Jun 2004 Posts: 73 Location: United Kingdom
|
Posted: Fri Aug 31, 2007 5:18 am |
thanks that fixed it :D
|
|
_________________ mhm.. |
|
|
![](templates/Classic/images/spacer.gif) |
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Fri Aug 31, 2007 8:37 am |
How wierd. For me
Code: |
#IF {1} {#SHOW TRUE} {#SHOW FALSE} |
shows TRUE, meaning the other syntax should still work. |
|
|
![](templates/Classic/images/spacer.gif) |
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: Fri Aug 31, 2007 10:54 am |
Yeah, but the problem is that for some reason if your expression changed to false, it was still showing the true response.
|
|
|
![](templates/Classic/images/spacer.gif) |
Vijilante SubAdmin
![](images/avatars/7230815434153eca6be3ad.gif)
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Aug 31, 2007 11:42 am |
The reason this happens is because the braces {} treat the content as an expandable string. After the expansion is done then it is looked at by the #IF. Being a string the expression is considered true for anything that isn't %null.
All of these will show true all the time:
#IF {1} {true}
#IF {0} {true}
#IF {-1} {true}
#IF {0=1} {true}
This is what they convert to:
#IF ("1") {true}
#IF ("0") {true}
#IF ("-1") {true}
#IF ("0=1") {true}
The only one that would be false is:
#IF {} {true} {false}
That is a really long way of saying CMud is much more strict about writing the scripts correctly, and the use of braces for the expression portion of an #IF has always been wrong. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
![](templates/Classic/images/spacer.gif) |
|
|