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
thucar
Beginner


Joined: 06 Jan 2009
Posts: 20

PostPosted: Tue Jan 06, 2009 7:15 am   

Trying to move from Zmud to Cmud
 
I am thinking of moving from Zmud to Cmud, but first I need to make sure all my triggers and scripts work in cmud.

I do not quite understand what is the problem with the following trigger that it does not compile in cmud.

It's a trigger for capturing skill increases and saving it in a database as well as displaying it on screen.

Code:
{Your proficiency with %1 is %2.}

{#gag
@tmp = %replace( %trim ( %1), " ", "_")
#VAR %concat( int, @tmp) %2
#ADDKEY Skills "%1" @{%concat( int, @tmp)}
#IF (%2>=100) {gt ~{W%1 ~{graised to ~{R%2%~{x} {%if( %2>=85, gt ~{W%1 ~{graised to ~{Y%2%~{x, gt ~{W%1 ~{graised to ~{G%2%~{x)}
#IF (@{%concat( int, @tmp)} = 85) {#BEEP}}




The error message:

Code:
Error compiling script:
  illegal token: = %replace( %trim ( %1), " ", "_")
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Jan 06, 2009 8:24 am   
 
Remove the @ from the start of the line - you don't need it any more. See also.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
thucar
Beginner


Joined: 06 Jan 2009
Posts: 20

PostPosted: Tue Jan 06, 2009 8:37 am   
 
thanks, that fixed it. But now I have a new problem. it seems to be messing up my output line.

the line that set of the trigger:

Your proficiency with dual weaponry is 70.

And the result I got was:

gt{Wdual weaponry{graisedto{G70%{x


the spaces are missing.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jan 06, 2009 11:11 am   
 
I am not quite sure whay you are creating a seperate variable for each skill as well, so I removed those lines.

You had a reference to %1 inside of quotes, this is a bad thing. zMud used to need this in some cases, but CMud has completely fixed the zScript behavior on this point. I would suggest using the Compatibility Report in the Package Editor to assist you in finding all such references.

Your usages of #IF and %if were a little confused. Using %if to start a command is generally bad. zMud permitted this, but CMud doesn't necessarily preform the same way when such a thing is done. Also after examining what you were doing with the if's I saw that it could all be condensed into a smaller section that only changed the 1 color code.
Code:
#gag
#ADDKEY Skills {%1} {%2}
gt %concat("{W",%1," {graised to ",%if(%2>=100,"{R",%if(%2>=85,"{Y","{W")),",%2,"%{x")
#IF (%2 = 85) {#BEEP}}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Jan 06, 2009 4:05 pm   
 
I think that last W is supposed to be a G so
Code:
#gag
#ADDKEY Skills {%1} {%2}
gt %concat("{W",%1," {graised to ",%if(%2>=100,"{R",%if(%2>=85,"{Y","{G")),",%2,"%{x")
#IF (%2 = 85) {#BEEP}

EDIT: Oh and I just noticed the extra trailing curly brace so removed that as it isn't needed unless you plan to do the full trigger from the command line again.
_________________
Taz :)
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