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
alaric
Novice


Joined: 13 Aug 2005
Posts: 32
Location: Cherry Point, NC

PostPosted: Sat Aug 20, 2005 1:32 pm   

#Math
 
I am trying to make a script that will see how much money I pick up, and auto split it amongst my party. This is what it looks like when I pick up the money.

You get 3 copper coins.
You get a single silver coin.
You get 2 gold coins.

Now....they go up by tens....1 silver is 10 copper, 1 gold is 100 copper, 1 platinum is 1000 copper and 1 obsidian is 10000 copper. I need it broken down into copper coins. If I had 4 gold 3 silver and 2 copper I would type "split 432" the problem I am running into, is I can't get it to read the number of coins I am picking up, and use that number in the math equation... Any help would be appreciated.. thank you.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Aug 20, 2005 3:51 pm   
 
This assumes you have the Use wildcards in stringlists option checked in Preferences.

#trigger {You get ({%d|a single}) (%w) coin} {#addkey Coins %w %eval(%db(@Coins,%w) + %if("%1" = "a single",1,%1))}

Something like that should set up a data record variable for you to keep track of the coins you pick up. It will look something like this using your above example:

Coins.copper = 3
Coins.silver = 1
Coins.gold = 2
_________________
EDIT: I didn't like my old signature
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Aug 20, 2005 4:13 pm   
 
right off the top of my head

#CLASS autosplit
#TRIGGER {^You get a single copper coin.} {#ADD coins 1;#T+ splitblank}
#TRIGGER {^You get (%d) copper coins.} {#ADD coins %1;#T+ splitblank}
#TRIGGER {^You get a single silver coin.} {#ADD coins 10;#T+ splitblank}
#TRIGGER {^You get (%d) silver coins.} {#ADD coins %eval(%1*10);#T+ splitblank}
#TRIGGER {^You get a single silver coin.} {#ADD coins 100;#T+ splitblank}
#TRIGGER {^You get (%d) gold coins.} {#ADD coins %eval(%1*100);#T+ splitblank}
#NOOP You should be able to figure out the rest
#TRIGGER "splitblank {^$} {split @coins;coins=0;#T- splitblank}
#CLASS 0
_________________
Zmud Support Library
Zmud Knowledge Base
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