 |
Kurt_DH Wanderer
Joined: 26 Oct 2000 Posts: 62
|
Posted: Thu May 01, 2003 12:20 am
Question |
If I wanted to turn 15,000 into a variable I could use for math operations, like 15000, how would I do that?
Basically I just want the commas stripped from the number so I could use the number itself for operations. |
|
|
 |
Lain Novice
Joined: 26 Oct 2001 Posts: 38
|
Posted: Thu May 01, 2003 12:58 am |
If you're capturing the 15,000 from mud output, you can use - %n
For example,
Pattern: You have (%n) pennies.
Value: #VAR money %1
Lain |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu May 01, 2003 5:50 pm |
You can do this by combining %replace() to remove the commas and %number() to convert the string to a number.
#VAR temp1 {15,000}
#MATH temp2 {%number(%replace( {@temp1}, ",", "")) + 27}
@temp2 equals 15027.
Both functions are needed, as can be seen with a little experimentation.
Without %number() @temp2 equals 1500027.
Without %replace, @temp2 equals 27.
Without either, @temp2 equals 15,00027.
As Lain said, you can use %n in trigger patterns to avoid all this.
LightBulb
Advanced Member |
|
|
 |
|
|
|
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
|
|