Currency Exchange Calculator (script): Difference between revisions

From Elanthipedia
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 2: Line 2:
|cat=information
|cat=information
|fe=Genie
|fe=Genie
|auth=Isharon
|auth=[[User:Isharon|Isharon]]
}}
}}
This script tells you how much money is needed to convert from one currency to another, including the exchange fee.
This script tells you how much money is needed to convert from one currency to another, including the exchange fee.

Revision as of 12:57, 13 March 2011

Currency Exchange Calculator (script)
Category information
Front-end Genie
Author Isharon

This script tells you how much money is needed to convert from one currency to another, including the exchange fee.

Syntax

.EXCH %AMOUNT %FEE

%amount: the desired amount of the currency you need
%fee: the bank's exchange fee, expressed as a whole number

For example, let's say that you're in the Crossing, and you need 2500 Lirums. Your money is in Kronars, and the bank's exchange fee is 5%. You enter .EXCH 2500 5. After starting the script, you see a menu that prompts you to select your starting currency, which is Kronars.

Script

evalmath RATE %2/100

echo
echo Starting Currency:
echo
echo 1: Kronars
echo
echo 2: Lirums
echo
echo 3: Dokoras
echo
echo Enter Number:

matchre Kronars ^1
matchre Lirums ^2
matchre Dokoras ^3
matchwait

Kronars:

evalmath KROLIR ceiling(%1 * 1.25)
evalmath KROLIRFEE ceiling(%KROLIR*%RATE)
evalmath KROLIRTOT %KROLIR + %KROLIRFEE
evalmath KRODOK ceiling(%1 * 1.385)
evalmath KRODOKFEE ceiling(%KRODOK*%RATE)
evalmath KRODOKTOT %KRODOK + %KRODOKFEE

echo
echo Exchange fee used: %2%
echo
echo Need %1 Lirums? Withdraw %KROLIRTOT Kronars
echo
echo Need %1 Dokoras? Withdraw %KRODOKTOT Kronars
echo
goto end

Lirums:

evalmath LIRKRO ceiling(%1 * .8)
evalmath LIRKROFEE ceiling(%LIRKRO*%RATE)
evalmath LIRKROTOT %LIRKRO + %LIRKROFEE
evalmath LIRDOK ceiling(%1 * 1.108)
evalmath LIRDOKFEE ceiling(%LIRDOK*%RATE)
evalmath LIRDOKTOT %LIRDOK + %LIRDOKFEE

echo
echo Exchange fee used: %2%
echo
echo Need %1 Kronars? Withdraw %LIRKROTOT Lirums
echo
echo Need %1 Dokoras? Withdraw %LIRDOKTOT Lirums
echo
goto end

Dokoras:

evalmath DOKKRO ceiling(%1 * .721)
evalmath DOKKROFEE ceiling(%DOKKRO*%RATE)
evalmath DOKKROTOT %DOKKRO + %DOKKROFEE
evalmath DOKLIR ceiling(%1 * .902)
evalmath DOKLIRFEE ceiling(%DOKLIR*%RATE)
evalmath DOKLIRTOT %DOKLIR + %DOKLIRFEE

echo
echo Exchange fee used: %2%
echo
echo Need %1 Kronars? Withdraw %DOKKROTOT Dokoras
echo
echo Need %1 Lirums? Withdraw %DOKLIRTOT Dokoras
echo
goto end


end: