|
OmegaDeus Apprentice
Joined: 14 Sep 2005 Posts: 121
|
Posted: Sun Dec 04, 2005 12:51 am
Money changing |
I'm a little rusty on my math, can anyone help me with this? What I'd like to do is by using a few examples, or maybe making a trigger, find out exactly what lenny the moneychanger takes for fees before giving me my gold and and my silver back. I'd like to eventually make it so that I can be able to tell how much gold i'll get back from changing out my silver so when i'm working toward a specific goal, i can factor my silver into it as well so i can know how much i've got left overall to get.
You give Lenny the Moneychanger 163724 silver.
Lenny the Moneychanger gives you 1555 gold.
Lenny the Moneychanger gives you 37 silver.
Lenny the Moneychanger tells you 'Thank you, come again.'
You give Lenny the Moneychanger 149525 silver.
Lenny the Moneychanger gives you 1420 gold.
Lenny the Moneychanger gives you 48 silver.
Lenny the Moneychanger tells you 'Thank you, come again.'
if someone could just at least help me figure out the % he takes based off this i'd greatly appreciate it, i could do the rest from there. |
|
_________________
Look at me I've got zSKILLS |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Sun Dec 04, 2005 1:47 am |
Something like this:
#TRIGGER {^You give Lenny the Moneychanger (%d) silver.} {#VAR Lenny_Received_Silver %1}
#COND {^Lenny the Moneychanger gives you (%d) gold.} {#VAR Lenny_Given_Gold %1}
#COND {^Lenny the Moneychanger gives you (%d) silver.} {#VAR Lenny_Given_Silver %1}
#COND {^Lenny the Moneychanger tells you ~'Thank you, come again.~'} {#VAR Lenny_Percent %additem(@Lenny_Percent,%eval(@Lenny_Received_Silver-@Lenny_Given_Gold*@SilverPerGoldUnit+@Lenny_Given_Silver));#SHOW Lenny percent @Lenny_Percent}
#VAR SilverPerGoldUnit 10
I think I did the %additem right. You need to change the SilverPerGoldUnit to reflect how many silver = 1 gold. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Dec 04, 2005 2:31 am |
It would also help if we new the relationship between gold and silver.
I.E. is 10 silver 1 gold? or is 100 silver 1 gold? On some muds the helpfile for gold or currency will give you the differant rates.
So assuming 100 silver is 1 gold (yes my math is rusty so this could be a bassackwards way)
%1=Silver before echange
%2=Gold afer exchange
%3=Silver after exchange
100.0 is to convert this operation to use floating point numbers for zmud :p
Exchange Rate = ((%1-%2*100.0+%3)/%1)*100
((163724-155500+37)/163724)*100=5ish%
#ALIAS exrate {
#SAY His Fees %eval( %1-%2*100.0+%3)
#SAY His Perc %format( "&0.2n", %eval( ((%1-%2*100.0+%3)/%1)*100))%
}
input:
exrate 14925 1420 48
output:
His Fees 7573
His Perc 5.06% |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Dec 04, 2005 2:34 am |
*Stealing this code from Ton* Using my exrate alias would could easily be converted to a function :p
#TRIGGER {^You give Lenny the Moneychanger (%d) silver.} {}
#COND {^Lenny the Moneychanger gives you (%d) gold.} {}
#COND {^Lenny the Moneychanger gives you (%d) silver.} {}
#COND {^Lenny the Moneychanger tells you ~'Thank you, come again.~'} {
exrate %t1 %t2 %t3} |
|
|
|
OmegaDeus Apprentice
Joined: 14 Sep 2005 Posts: 121
|
Posted: Sun Dec 04, 2005 3:25 am |
Okay, given all that, how would i go about setting this up so when i use the alias goldest i can get it to give me a rough estimate of the amount of gold i have on me?
|
|
_________________
Look at me I've got zSKILLS |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Dec 04, 2005 3:48 am |
(amountsilver-amountsilver*0.05)/100
Which in your first example would be
(163724-163724*0.05)/100
or 1555.37
1555 gold and 37 silver
And in your second example
1420.48
1420 gold and 37 silver
Or to put it all into perspective if you change the terms gold and silver it all makes sense. Of course I just realized this and I am not going back to change the forumals in my earlier post to reflect this.
1420 dollars and 37 cents
[REALLY lastedit I swear!]
#ALIAS goldest {
#SAY Damn near close estimate of gold and silver after exchange:
#SAY %format("&0.2n", %eval((%1-%1*0.05)/100)) Gold.Silver
#SAY cost to exchange %format("&0.2n", %eval((%1*0.05))) Gold.Silver
} |
|
|
|
|
|