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
BlackSmith
Apprentice


Joined: 08 Dec 2002
Posts: 152

PostPosted: Sat Feb 03, 2007 6:51 am   

Trigger: Does not compile : syntax error at row 13 col 37
 
Code:
\s+Exp:(\d+)\s+

#If (%1 != @Experience.Current) {
 #math Experience.Difference %1 - @Experience.Current
}
#If (@Experience.Required_for_next_level - @Experience.Stored <= %1) {
 #Substitute {%Char(32)<color gold>Exp</color>:<color green>%1</color>%IF(@Experience.Current != %1, %Char(40)%If(0<@Experience.Difference,<color green>+@Experience.Difference,<color red>@Experience.Difference)</color>%Char(41), "")%Char(32)}
 } {
 #If (@Improvement.Max_Cost <= %1) {
  #Substitute {%Char(32)Exp:<color green>%1</color>%IF(@Experience.Current != %1, %Char(40)%If(0<@Experience.Difference,<color green>+@Experience.Difference,<color red>@Experience.Difference)</color>%Char(41), "")%Char(32)}
  } {
  #If (300000 <= %1) {
   #Substitute {%Char(32)Exp:<color yellow>%1</color>%IF(@Experience.Current != %1, %Char(40)%If(0<@Experience.Difference,<color green>+@Experience.Difference,<color red>@Experience.Difference)</color>%Char(41), "")%Char(32)}
   } {
   #If (@Improvement.Min_Cost <= %1) {
    #Substitute {%Char(32)Exp:<color $BF6000>%1</color>%IF(@Experience.Current != %1, %Char(40)%If(0<@Experience.Difference,<color green>+@Experience.Difference,<color red>@Experience.Difference)</color>%Char(41), "")%Char(32)}
    } {
    #Substitute {%Char(32)Exp:<color red>%1</color>%IF(@Experience.Current != %1, %Char(40)%If(0<@Experience.Difference,<color green>+@Experience.Difference,<color red>@Experience.Difference)</color>%Char(41), "")%Char(32)}
   }
  }
 }
}
#AddKey Experience Current %1
It calculates and adds my exp change from
" Exp:NUMBER "
to
" Exp:COLORED NUMBERCOLORED NUMBER) "

Works fine in zMud, does not compile in Cmud and gives stuff like this
Quote:
239(+Differenceurrent235Max239.Difference)239
_________________
BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient.

Last edited by BlackSmith on Sun Feb 04, 2007 10:10 pm; edited 1 time in total
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Sat Feb 03, 2007 2:41 pm   
 
It looks like the problem is the use of $BF6000 for a color code. Try putting double quotes around it to prevent CMUD from trying to expand it as a local variable.
Reply with quote
BlackSmith
Apprentice


Joined: 08 Dec 2002
Posts: 152

PostPosted: Sun Feb 04, 2007 10:53 pm   
 
Larkin wrote:
It looks like the problem is the use of $BF6000 for a color code.
Err? thats what the help file says to use and its MPX that does it even. Bug or old code?
_________________
BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Feb 04, 2007 11:43 pm   
 
What Larkin described is exactly what the bug is. "$name" is the syntax for a local variable, in the same way that "@name" is the syntax for a normal one. If you change from the script tab to the compiled code tab you'll see that the error is "invalid local variable BF6000". If you do like he suggested and change the code from

Code:
<color $BF6000>

to
Code:
<color "$BF6000">

it compiles fine for me.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Feb 05, 2007 3:04 pm   
 
The $ is a special character in CMUD that denotes a local variable, just as @ denotes a global variable. It's all in the KB topic on converting scripts from zMUD to CMUD, if I recall correctly.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Feb 05, 2007 8:00 pm   
 
Yes, this is a bug and it's on the bug list. But Fang's workaround should work fine until it's fixed.
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