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


Joined: 27 Mar 2004
Posts: 7

PostPosted: Sat Mar 27, 2004 9:37 pm   

strange behaviour of %replace inside %eval
 
I've got a trigger that is supposed to do some calculations with a number after stripping all commas from it. But it only works if I don't put %replace inside %eval. Let's say %1 is 250,000. %replace( "%1", ~,, "") works, but %replace( %1, ~,, "") doesn't (it returns 250 instead). When inside %eval, it returns 250 again :

%eval(%replace( "%1", ~,, ""))

How do I solve this problem? Do I have to use a dummy variable to save the result from %replace? Does zMUD have variables which only exist within a trigger/function/... script?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Mar 27, 2004 10:25 pm   
 
UNTESTED but should work remove the ~ and quote the comma with ""
%eval(%replace( "%1", ",", ""))
or if that one doesn't
%eval(%replace( "%1", ",", %null))
Reply with quote
Zyphrus
Newbie


Joined: 27 Mar 2004
Posts: 7

PostPosted: Sat Mar 27, 2004 11:01 pm   
 
Thanks for the fast reply! I just tried your solution and it works perfectly Smile
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