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
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Fri May 27, 2005 3:44 pm   

Need help with a tiny script
 
I need help on my mud the numbers have commas in them like below.

Your pl increases by 1,008 points.

I need to get rid of the comma or make it so zMUD does numbers right with commas.

Any ideas or any help?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Fri May 27, 2005 4:05 pm   
 
#TR {Your pl increases by ([%d%p]) points. } {#show %replace(%1,",")}
_________________
Discord: Shalimarwildcat
Reply with quote
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Fri May 27, 2005 4:11 pm   
 
shalimar wrote:
#TR {Your pl increases by ([%d%p]) points. } {#show %replace(%1,",")}


That doesn't work as I expected it... It just throws it down a few lines as a number.... I need it in the actual line so I can use it to calculate my entire pl gained during this login and show it.
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Fri May 27, 2005 4:17 pm   
 
You'd probably want to #substitute rather than #show. I don't think #show will then fire any triggers, and I'd guess you want to change the way it's appearing because you want to fire a trigger.

You need to put %1 in quotes too, otherwise the comma seems to confuse the pattern match
#TRIGGER {Your pl increases by ([%d%p]) points.} {#SUBSTITUTE {Your pl increases by %replace( "%1", ",") points.}}
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Fri May 27, 2005 4:26 pm   
 
just let it fire of this, unless you just wanna see it look pretty, all calculations could be done off the one trigger

#TRIGGER {Your pl increases by ([%d%p]) points.} {#VAR temp {%replace( "%1", ",")}}

then further manipulate the data now stored in @temp however you need too
_________________
Discord: Shalimarwildcat
Reply with quote
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Fri May 27, 2005 4:41 pm   
 
Works perfect shalimar :) Thanks a lot!
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat May 28, 2005 12:41 am   
 
You can simly use %n to pick up numbers with common punctuations items like commas. Commas are stripped when captured eliminating the need for extra prcoessing.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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