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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
hykou
Wanderer


Joined: 29 Apr 2004
Posts: 63
Location: USA

PostPosted: Fri Aug 13, 2004 3:23 am   

did i do something wrong?
 
Code:
#VAR EXPTNL
#VAR Level
#VAR Exp
#VAR Tnl
#VAR QP
#VAR Complete
#TRIGGER {* You have * experience points and need (*) to advance.} {@EXPTNL = %replace( "%1", ",")}
#TRIGGER {Total Level:    (%d)} {#MATH Level (%1 + 1)}
#TRIGGER {You receive (*) experience points.} {@Exp = %replace( "%1", ",");#MATH Tnl (@EXPTNL/@Exp);#MATH EXPTNL (@EXPTNL-@Exp)}
#TRIGGER {Quest Points:   (*) ~((*) quests~)} {@QP = %replace( "%1", ",");@Complete = %replace( "%2", ",")}
#ST Experience needed to level @Level~: @EXPTNL I will get there in @tnl kills. @QP Quest Points


its supposed to put my exp tnl and calculate how many kills of the same exp tnl on the status bar, as well as quest points, and quests. now my problem is when i receive this line "You receive 1,349 experience points." or any set amoutn of exp, it doesnt put the right amount of exp tnl on the status bar... it puts about 700 exp lower.
heres the lines that set the triggers off...

You receive 1,349 experience points.
* You have 33,448 experience points and need 10,552 to advance.
and heres an example of it all
Experience needed to level 7: 3476 I will get there in 0 kills. 0 Quest Points <--- whats on status before the kill
Experience needed to level 7: 942 I will get there in 1 kills. 0 Quest Points <--- whats on after
You receive 1,267 experience points. <--- thats what i got for exp
thank you
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Fri Aug 13, 2004 4:05 am   
 
First, the * character will always be interpreted as a wildcard by Zmud, even if it is what the trigger fires on, so you need to use %2 in your first trigger.

The main problem I see throughout is for just about every non-MATH variable assignment, you are using @varname. The @ symbol expands the variable(gives its value), so pretty much all it does is try to set a value to a value which can't be done.

For example:

#TRIGGER {* You have * experience points and need (*) to advance.} {@EXPTNL = %replace( "%1", ",")}

should be

#TRIGGER {* You have * experience points and need (*) to advance.} {EXPTNL = %replace( "%1", ",")}


One other concern I have which I hope someone with more experience with me can answer. Wouldn't using, for example, {EXPTNL = %number(%2)} work much better at getting rid of the comma in a captured number?
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Fri Aug 13, 2004 3:07 pm   
 
#TRIGGER {^~* You have * experience points and need (%n) to advance.$} {#VAR EXPTNL %1}

#TRIGGER {^You receive (%n) experience points.$} {Exp=%1;#MATH EXPTNL @EXPTNL-@Exp;#MATH Tnl @EXPTNL/@Exp}

#TRIGGER {Quest Points: (%n) ~((%n) quests~)} {QP=%1;Complete=%2}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Aug 13, 2004 6:26 pm   
 
Small modifications:
#TRIGGER {^~* You have %n experience points and need (%n) to advance.$} {#VAR EXPTNL %1}
#TRIGGER {^You receive (%n) experience points.$} {Exp=%1;#MATH EXPTNL @EXPTNL-@Exp;#MATH Tnl ((@EXPTNL/@Exp) + %if( @EXPTNL\@Exp, 1, 0))}

Adds 1 whenever the division leaves a remainder.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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