 |
tedthededhed Newbie
Joined: 11 Aug 2002 Posts: 6 Location: USA
|
Posted: 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. |
|
|
|
 |
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: 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 |
|
|
|
 |
tedthededhed Newbie
Joined: 11 Aug 2002 Posts: 6 Location: USA
|
Posted: Sun Apr 11, 2004 10:18 pm |
still stacks the numbers wether i use %n or not
|
|
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Apr 11, 2004 10:43 pm |
#trigger {Your power level increases by (%n) points.} {#ADD plgain %1}
|
|
|
|
 |
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: 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 |
|
|
|
 |
tedthededhed Newbie
Joined: 11 Aug 2002 Posts: 6 Location: USA
|
Posted: 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?
|
|
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Apr 11, 2004 11:17 pm |
Your best bet would be to use this in your #ST
%format( "&.0n", @plgain) |
|
|
|
 |
tedthededhed Newbie
Joined: 11 Aug 2002 Posts: 6 Location: USA
|
Posted: Sun Apr 11, 2004 11:26 pm |
thanks a million guys. i owe you!
|
|
|
|
 |
|
|
|