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
mrmook
Beginner


Joined: 14 Jun 2003
Posts: 16
Location: USA

PostPosted: Mon May 24, 2004 11:00 am   

Automated banking.
 
I deal with a mud that is very "weight" oriented but has a banking system. When I get overloaded with gold and silver I like to go back to friendly otho, exchange my silver and deposit all but 3k gold. Commands are simple worth is worth, deposit is deposit, give x silver otho does currency change. I got my variable and I know those who answer this problem are going to laugh but I got it myself so I'm happy thus far.

Trigger:
You have (*) gold, (*) silver, and (*) experience ~((*) xp to next level~).

onhandgold=%1
onhandsilver=%2

Now the hard part. I don't want this to loop forever and I dont want it to be overly spammy. Because unfortunately when you deposit it gives how much gold you have away to anyone in the room. I set up a variable @deposit that changes onhandgold to (onhandgold-3000) using the expression:
#math deposit @onhandgold-3000;deposit @deposit

yah I said you would laugh. But whats bugging me is that I have to do the currency change first so when I have buttloads of silver I can convert it to gold then do one deposit. I believe otho takes 10% of the amount of silver thats changed but what I dont know is if he takes that off the top or off the bottom number eg. before he changes or after. So I cant write into the #math statement the (conversion from silver to gold)+gold-3000=deposit

Any of you mighty coders, scripters or otherwise guru's of zmud that can help would be greatly appreciated by me.

Thanks,
Mr. Mook
Reply with quote
mrmook
Beginner


Joined: 14 Jun 2003
Posts: 16
Location: USA

PostPosted: Mon May 24, 2004 12:47 pm   
 
ADDENDUM: I found that good ole otho takes 20% off the top so if I figure the exchange in with the deposit I am going to have .XX.

I figured out the script myself please let me know if I have anything wrong or you could show me how to fix even more properly. This solution works and only works when I type banking, I've tested it with varying amounts of silver and gold. The remainer or the silver that he gives me back doesn't seem to bother the mud.. I don't know maybe they are stealing my .16 from every deposit but it isn't a superman 2 based mud :)

#CLASS {Otho|banking}
#TRIGGER {You have (*) gold, (*) silver, and (*) experience ~((*) xp to next level~).} {onhandgold=%1;onhandsilver=%2;totalexp=%3;exptnl=%4;give @onhandsilver silver otho;#math silvertogold ((@onhandsilver-(@onhandsilver*.05))/100);#math totalgold (@onhandgold+@silvertogold);#math deposit @totalgold-3000;deposit @depositwith;#t- banking}
#CLASS 0

#ALIAS banking {#t+ banking;worth} "Otho"


Yet Again Thanks,

Mr. Mook
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon May 24, 2004 3:50 pm   
 
Try something along the lines of this *as guidance only not complete*
First do the currency exchange then do the gold deposit

#AL newdeposit {Worth;exchange silver commands using trigger that captured silver var;worth;deposit %eval(@gold-3000)}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon May 24, 2004 5:02 pm   
 
Not sure if your formula is wrong or if Otho is only taking 5%.
.05 = 5%
.20 = 20%
Based on your formula, Otho takes 5% and 100 silver is worth one gold.

You also calculate @deposit but then deposit @depositwith. Probably a typo. Nothing wrong with your script other than that. The calculations could be combined quite a bit though.

Trigger if Otho takes 5%, leaving you with 95%.
#TRIGGER {You have (*) gold, (*) silver, and (*) experience ~((*) xp to next level~).} {totalexp = %3;exptnl = %4;give %2 silver otho;#MATH deposit (%1 + ((%2/100) * 95) - 3000);deposit @deposit;#T- banking}

Trigger if Otho takes 20%, leaving you with 80%.
#TRIGGER {You have (*) gold, (*) silver, and (*) experience ~((*) xp to next level~).} {totalexp = %3;exptnl = %4;give %2 silver otho;#MATH deposit (%1 + ((%2/100) * 80) - 3000);deposit @deposit;#T- banking}

EDIT: Fixed misuse of "you're"
Reply with quote
mrmook
Beginner


Joined: 14 Jun 2003
Posts: 16
Location: USA

PostPosted: Tue May 25, 2004 7:17 am   
 
Thanks light bulb. So far so good.. it turned out that the carryover in silver was messin mine up and tried to deposit a negative number a couple times.. changed over to yours and am seeing if things go better.
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