|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Sat Feb 27, 2010 9:58 am
[3.14a] = sign in %if doesn't work |
This gives me an error
Code: |
#ADDKEY EnchantVar Req1 %if( %db( @EnchantSpecification, DoResonate)!=0, %db( @EnchantVar, LuckAdded) >= %db( @EnchantSpecification, MinLuck), true)
|
Error compiling script:
illegal character in expression: =
how do I know it's this?
because
Code: |
#ADDKEY EnchantVar Req1 %if( %db( @EnchantSpecification, DoResonate)!=0, %db( @EnchantVar, LuckAdded) > (%db( @EnchantSpecification, MinLuck)+1), true)
|
removes the error
//DanteX |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Feb 27, 2010 1:30 pm |
Uh, exactly what are you attempting to do with that %if statement?
I'm assuming you meant to do something like:
Code: |
#ADDKEY EnchantVar Req1 %if( %db( @EnchantSpecification, DoResonate)!=0 AND %db( @EnchantVar, LuckAdded) >= %db( @EnchantSpecification, MinLuck), true) |
because honestly, what your previous way would be doing is this:
If DoResonate is not equal to zero, then put the value of: EnchantVar.LuckAdded >= EnchantSpecification.MinLuck into the record of Req1 of the EnchantVar variable. Otherwise, if DoResonate equals zero, then put the value of true in the Req1 record of the EnchantVar variable.
Charneus |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Sat Feb 27, 2010 2:02 pm |
It's done the way it's done. The ">=" doesn't work in cmud but works in zmud. Therefore I've had to change it to > (variable+1).
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Feb 27, 2010 2:14 pm |
So you're telling me that you're doing things like:
If DoResonate is not zero, addkey EnchantVar Req1 3>=2, otherwise, if DoResonate is zero, addkey EnchantVar Req1 true?
Whatever floats your boat. I don't see it as a bug, but if you're /really/ wanting to do it that way, then change it to:
Code: |
#ADDKEY EnchantVar Req1 %if( %db( @EnchantSpecification, DoResonate)!=0, %concat(%db( @EnchantVar, LuckAdded)," >= ",%db( @EnchantSpecification, MinLuck)), true) |
Keep in mind the way %if works -- it's %if(expression, true, false)...
Code: |
Expression: %if( %db( @EnchantSpecification, DoResonate)!=0,
If true: #ADDKEY EnchantVar Req1 %db( @EnchantVar, LuckAdded) >= %db( @EnchantSpecification, MinLuck)
If false: #ADDKEY EnchantVar Req1 true |
is how you have it set up currenty... *sigh*
Charneus |
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Sat Feb 27, 2010 4:27 pm |
I've been embedding %if in #addkey as well, it can have some very nice benefits, but can be fairly picky.
But... the >= is in only the DB key part... i'ld suggest adding brackets around different parameters of #addkey, or just converting this to:
Code: |
#if (%db( @EnchantSpecification, DoResonate)) {
#ADDKEY {EnchantVar} {Req1} {%concat(%db( @EnchantVar, LuckAdded)," >= ",%db( @EnchantSpecification, MinLuck))}
} {
#ADDKEY {EnchantVar} {Req1} {true}
}
|
|
|
_________________ "To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle |
|
|
|
manbat Novice
Joined: 21 Mar 2009 Posts: 35
|
Posted: Sat Feb 27, 2010 9:04 pm |
>= hasn't worked in any of my scripts... doesn't matter what you use... been that way since like 3.03.. pretty sure I posted something about it then and it never got resolved either...
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Feb 27, 2010 9:09 pm |
You will need to demonstrate a syntax-proper method that proves it's not working, manbat. I'm experiencing zero problems with it, which either means you are not using a syntax-proper method or your session files have some sort of corruption that's interfering with execution (in many cases through the various beta cycles, I've had whole commands just completely stop working at all because of corruption).
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Sat Feb 27, 2010 10:09 pm |
Charneus: I didn't write the script. I'm using it and converting it to CMUD. The method implemented works for what it was meant to do.
The problem lies in the fact that ">= var" has to be replace with "> (var+1)" which is imo a bug. |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Feb 27, 2010 10:55 pm |
DanteX wrote: |
Charneus: I didn't write the script. I'm using it and converting it to CMUD. The method implemented works for what it was meant to do.
The problem lies in the fact that ">= var" has to be replace with "> (var+1)" which is imo a bug. |
No, the problem lies in the fact that CMUD is reading it as %if(expression, expression, false), which isn't technically a bug. It doesn't know what to do with var>=var because it thinks (appropriately) that it's an expression, and CMUD is saying 'Yo, I don't work like this. You give me expression, true, false, not expression, expression, false!'
Keep in mind that what worked in zMUD isn't necessarily a good thing - there were a LOT of bugs still in 7.21 that Zugg fixed in CMUD, and therefore, using the argument of "It works in zMUD!" is often an invalid argument.
Charneus |
|
|
|
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Sun Feb 28, 2010 12:49 am |
Sticking an %eval around the expression should make it evaluate to a value properly.
%if( expression, %eval(expression), value) |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|