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
tedthededhed
Newbie


Joined: 11 Aug 2002
Posts: 6
Location: USA

PostPosted: Sun Apr 11, 2004 10:09 pm   

#math and the dreaded comma
 
hey. i've been trying to make a counter for a mud in which you gain xp in the thousands, tens of thousands, and so on. but the numbers involve commas! so i was wondering if there were a way to strip the comma from the number in order to plug it into the counter. heres what i have so far...

Your power level increases by %1 points.

#math plgain {@plgain+%1}
and what happens when i choose to display @plgain on the status bar is basically a stacking of numbers. for example...

Your power level increases by 6,176 points.
Your power level increases by 18,529 points.
Your power level increases by 18,529 points.
the status bar reads, after this point, 6,17618,52918,529

thanks in advance for any help.
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Sun Apr 11, 2004 10:15 pm   
 
In your trigger, use %n to capture the number.

#trigger {Your power level increases by (%n) points.} {#math plgain {@plgain + %1}}

Jesse
Reply with quote
tedthededhed
Newbie


Joined: 11 Aug 2002
Posts: 6
Location: USA

PostPosted: Sun Apr 11, 2004 10:18 pm   
 
still stacks the numbers wether i use %n or not
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Apr 11, 2004 10:43 pm   
 
#trigger {Your power level increases by (%n) points.} {#ADD plgain %1}
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Sun Apr 11, 2004 10:49 pm   
 
Maybe your using an earlier version of zMud? thought %n stripped the commas for a while now. Or maybe you didn't reset the value of PLGAIN before using the new trigger? But if thats not the case you can rig up some kind of work around like this.
#trigger {Your power level increases by (%n) points.} {#math plgain {@plgain + %number(%replace(%1,",",""))}}


Hope this helps, Jesse
Reply with quote
tedthededhed
Newbie


Joined: 11 Aug 2002
Posts: 6
Location: USA

PostPosted: Sun Apr 11, 2004 10:57 pm   
 
thanks very much to both of you. they both work :) the case of the spastic comma has now been solved! now is there any way to add commas into the plgain variable?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Apr 11, 2004 11:17 pm   
 
Your best bet would be to use this in your #ST

%format( "&.0n", @plgain)
Reply with quote
tedthededhed
Newbie


Joined: 11 Aug 2002
Posts: 6
Location: USA

PostPosted: Sun Apr 11, 2004 11:26 pm   
 
thanks a million guys. i owe you!
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