![](templates/Classic/images/spacer.gif) |
xathil Beginner
Joined: 19 Feb 2007 Posts: 10
|
Posted: Tue Feb 20, 2007 5:54 am
old 7.21 triggers not working in cmud (conversion) |
trigger keeps failing.
getting
ERROR: Trigger LCK ~ : %d~((%d)~) fired but did not compile
Code: |
#class Newbie
#variable LCK %1
quitta = 0
#if (@str < mstr) {
quitta = 1
#add fstr 1
#show str failed
}
#if (@dex < @mdex) {
quitta = 1
#add fdex 1
#show dex failed
}
#if (@int < @mint) {
quitta = 1
#add fint 1
}
#if (@wis < @mwis) {
quitta = 1
#add fwis 1
}
#if (@con < @mcon) {
quitta = 1
#add fcon 1
}
#if (@cha < @mcha) {
quitta = 1
#add fcha 1
}
#if (@lck < @mlck) {
quitta = 1
#add flck 1
#show luck failed
}
#if (@quitta = 1) {
reroll
sc
@KEEP = 0
} {
pull cord
#t- Newbie
}
|
says mismatched brace.. but its a direct port from the old zmud. with the semi colons it looks like this.
Code: |
#class Newbie
#variable LCK %1
quitta = 0
#if (@str < mstr) {quitta = 1;#add fstr 1;#show str failed}
#if (@dex < @mdex) {quitta = 1;#add fdex 1;#show dex failed}
#if (@int < @mint) {quitta = 1;#add fint 1}
#if (@wis < @mwis) {quitta = 1;#add fwis 1}
#if (@con < @mcon) {quitta = 1;#add fcon 1}
#if (@cha < @mcha) {quitta = 1;#add fcha 1}
#if (@lck < @mlck) {quitta = 1;#add flck 1;#show luck failed}
#if (@quitta = 1) {reroll;sc;@KEEP = 0} {pull cord;#t- Newbie} |
Trigger LCK ~ : %d~((%d)~)
Does not compile : unmatched braces at row 10 col 35
anyone got a clue? |
|
|
![](templates/Classic/images/spacer.gif) |
nexela Wizard
![](images/avatars/3549517644153b10a6a2fb.jpg)
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Tue Feb 20, 2007 7:18 am |
@KEEP = 0 is incorrect while not exaclty a brace error ctrl-K would put the cursor right under it. however it should read
KEEP=0
Note the absense of the @ and the removal of spaces between the = sign. |
|
|
![](templates/Classic/images/spacer.gif) |
xathil Beginner
Joined: 19 Feb 2007 Posts: 10
|
Posted: Tue Feb 20, 2007 7:40 am |
ahh thanks.. ive been getting rid of @ from all the triggers i use apparently its screwing up cmud even though zmud was fine with it. ive personally always found
x = y a lil confusing so i just put the @ in front to make it clear its a variable. does anyone know if this change is intentional? or just one of those things that shouldnt have been but was coded like that in zmud but got changed in cmud? |
|
|
![](templates/Classic/images/spacer.gif) |
Fang Xianfu GURU
![](images/avatars/1763170544a2093e7e85da.gif)
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Feb 20, 2007 7:55 am |
It's intentional. In zMUD it worked both ways but wasn't supposed to. In CMUD it works like it should.
I actually find it slightly easier to understand this way - @varname will always be the VALUE of the variable in CMUD. Every other syntax that deals with assigning variables (#var, #additem, #addkey etc) all specifically DON'T use the @ when referring to variables. Since var=value is assignment too, it makes sense. |
|
|
![](templates/Classic/images/spacer.gif) |
Larkin Wizard
![](images/avatars/169979204542c57c7448618.gif)
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Feb 20, 2007 1:43 pm |
FYI, I think you're missing an @ in front of mstr in that first #IF.
|
|
|
![](templates/Classic/images/spacer.gif) |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Feb 20, 2007 10:02 pm |
Quote: |
In zMUD it worked both ways but wasn't supposed to.
|
Actually it only appeared to work in ZMud, but I think that's getting semantical. What would happen in ZMud when using @varname = value is that whatever was in the variable would get entirely replaced by value. Stringlists would disappear, datarecords would disappear, and so on. Since most variables by far are just plain text variables, it just happens to look like @Varname = value is doing the same thing as Varname = value. |
|
_________________ EDIT: I didn't like my old signature |
|
|
![](templates/Classic/images/spacer.gif) |
|
|