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


Joined: 14 Mar 2006
Posts: 2
Location: Louisville, KY (USA)

PostPosted: Tue Mar 14, 2006 9:33 pm   

Converting 3,200 to 3200
 
My current mud gives experience using commas as delimiters, so if I have 3200 exp to level it shows up as 3,200. I want to make an experience counter so I need to capture 3,200 as a number, but can't figure out how to do so. I'm using the following triggers:

#trigger {^Experience Needed &ExpTNL}

#trigger {^You gained &ExpGained}

What I want to do is have the second trigger subtract ExpGained from ExpTNL each time I kill a mob, but these triggers store the values as a strings and not numbers. I tried using %number() to convert it but that function won't work if there is a comma in the string.

Any help on this appreciated.
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Tue Mar 14, 2006 10:27 pm   
 
Say we have 3,200 in %1 then we do:
ExpTNL = %replace("%1", ",", "")

Example:
#trigger {^Experience Needed (*)} {
ExpTNL = %replace("%1", ",", "")
}

Hope this helps!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Mar 14, 2006 10:50 pm   
 
Use %n. It could be that you still need to extract the comma, but I'm fairly certain you don't need to.
_________________
EDIT: I didn't like my old signature
Reply with quote
Stavin
Newbie


Joined: 14 Mar 2006
Posts: 2
Location: Louisville, KY (USA)

PostPosted: Tue Mar 14, 2006 11:32 pm   
 
Thanks, Rorso, that did the trick nicely. I always figure there's a way to do whatever I want in zmud, the trick is to figure out what the syntax is. :)

Matt, I'll try what you said as well when I get a chance.
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