Welcome to the Achaea Forums! Please be sure to read the Forum Rules
Simple, Useful Mudlet Coding
Decided to make a thread for those interested to post their small tidbits of code that just improve quality of life a bit. Any and all are welcome to post whatever you'd like to share that make daily tasks easier for you.
I'll start by sharing a little piece of code I wrote up quickly for @Kayeil
that just tells you the amount you'd need to withdraw (fee included) at a bank to get your desired amount withdrawn. The default alias is bankfee <desired amount> and it will do the math and use cecho's to tell you how much you'd need to withdraw in Delos and in a city to get the desired amount back. It involves some decimals at times that may leave you 1 gold short and force another withdrawal to reach the desired amount. To fix that I use math.ceil to always make sure you get the amount you wanted. That being said sometimes the number it gives you to withdraw may leave you with 1 extra gold but should never leave you with 1 less. I'll post the code here and share a dropbox link as well.
Pattern: ^bankfee (\d+)$
<p>wantedAmount = matches</p><p><br></p><p>withdrawAmount = tonumber(wantedAmount/.98)</p>
<p>cityWithdraw = tonumber(wantedAmount/.995)</p>
<p>cecho("\n<green>Delos: <yellow>You need to withdraw "..math.ceil(withdrawAmount).." gold to get "..wantedAmount.." gold.")</p>
<p>cecho("\n<green>City: <yellow>You need to withdraw "..math.ceil(cityWithdraw).." gold to get "..wantedAmount.." gold.")</p>
Dropbox: Bank Fee Calculator