Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
xathil
Beginner


Joined: 19 Feb 2007
Posts: 10

PostPosted: 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?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: 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.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
xathil
Beginner


Joined: 19 Feb 2007
Posts: 10

PostPosted: 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?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Tue Feb 20, 2007 1:43 pm   
 
FYI, I think you're missing an @ in front of mstr in that first #IF.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net