|
thucar Beginner
Joined: 06 Jan 2009 Posts: 20
|
Posted: 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), " ", "_") |
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jan 06, 2009 8:24 am |
Remove the @ from the start of the line - you don't need it any more. See also.
|
|
|
|
thucar Beginner
Joined: 06 Jan 2009 Posts: 20
|
Posted: 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. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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 |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: 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 :) |
|
|
|
|
|
|
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
|
|