Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

Simple, Useful Mudlet Coding

KoganKogan Member Posts: 401 ✭✭✭✭ - Eminent
edited January 2017 in Curing Systems and Scripts
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[2]</p><p><br></p><p>withdrawAmount = tonumber(wantedAmount/.98)</p>
<p>cityWithdraw = tonumber(wantedAmount/.995)</p>
<p>cecho("\n&lt;green&gt;Delos: &lt;yellow&gt;You need to withdraw "..math.ceil(withdrawAmount).." gold to get "..wantedAmount.." gold.")</p>
<p>cecho("\n&lt;green&gt;City: &lt;yellow&gt;You need to withdraw "..math.ceil(cityWithdraw).." gold to get "..wantedAmount.." gold.")</p>

Dropbox: Bank Fee Calculator



  • PuxiPuxi Member Posts: 625 ✭✭✭✭ - Eminent
    BANKFEES <amount> in game works too.
  • KoganKogan Member Posts: 401 ✭✭✭✭ - Eminent
    edited January 2017
    Puxi said:
    BANKFEES <amount> in game works too.
    Neat. Didn't know that! For me it only show city and not Delos. Not sure if that's because I don't have a personal bank in Delos or not. If it just doesn't show Delos those in the 2% fee club can use this. If it does then I wasted a few minutes is all. 

    Edit: Confirmed it doesn't cover Delos. Though it should. May idea it or something to see if we can't get that added.
  • KayeilKayeil Washington StateMember Posts: 2,824 @@ - Legendary Achaean
    I can't take credit for this, but it was made for me in the past. This figures out ink prices for ink sellers. It's currently configured for 50% off Rurin's rates, but you can plug in your own numbers into the code.

    This one reminds you what the alias is to figure out the ink prices. You can, of course, change it to a different name if something else is easier for you.


    cecho("<cyan>\n ikprice b/go/gr/p/r/y (no slashes)")

    This is the actual code that prices the inks at 50% off Rurin's price.

    ^ikprice (.+)b(.+)go(.+)gr(.+)p(.+)r(.+)y$

    bluei = matches[2] * 20
    goldi = matches[3] * 200
    greeni= matches[4] * 80
    purplei = matches[5] * 125
    redi = matches[6] * 10
    yellowi = matches[7] * 40
    itotal = bluei + goldi + greeni + purplei + redi + yellowi
    cecho("\n<green>**INKS FOR SALE PRICING**")
    cecho("\n<red> - BLUE INK    : (@20  each) = :" ..bluei )
    cecho("\n<red> - GOLD INK    : (@200 each) = :" ..goldi )
    cecho("\n<red> - GREEN INK   : (@80  each) = :" ..greeni )
    cecho("\n<red> - PURPLE INK  : (@125 each) = :" ..purplei )
    cecho("\n<red> - RED INK     : (@10  each) = :" ..redi )
    cecho("\n<red> - YELLOW INK  : (@40  each) = :" ..yellowi )
    cecho("\n<green> TOTAL : = " ..itotal.. " Gold")

    So if I want to sell 50 of each colour, I enter:
    ikprice 50 b 50 go 50 gr 50 p 50 r 50 y

    I get this output: 
     - BLUE INK    : (@20  each) = :1000
     - GOLD INK    : (@200 each) = :10000
     - GREEN INK   : (@80  each) = :4000
     - PURPLE INK  : (@125 each) = :6250
     - RED INK     : (@10  each) = :500
     - YELLOW INK  : (@40  each) = :2000
    What doesn't kill you gives you exp.

  • KoganKogan Member Posts: 401 ✭✭✭✭ - Eminent
    edited January 2017
    Perhaps the simplest alias I have I use every now and then is simply a "lookup" alias. Comes in handy if you want to know what class, exact level, etc someone is. Just utilizes the website via your default browser to look up a player name.

    Pattern: ^lookup (\d+)$



    --Another very simple one I used is just to open the forums. Because laziness.

    Pattern: ^forums$



    --There are a lot of small things you can use these for such as finding a definition, linking to personal things, linking to illustrated map, your music, etc. None of these codes are supposed to be super fancy or something hard to code/do. More or less a way to share and say hey... if you haven't seen this or thought of this you should try it if you think its useful.

  • KoganKogan Member Posts: 401 ✭✭✭✭ - Eminent
    Thought I'd also share how I do my chatbox at the bottom. It isn't the fanciest but its dockable anywhere the map is in default mudlet but bottom seems to work the best. Not to mention could be made the size of your whole screen if just sitting on a ship in conversation. It will take any game colors you set through config color but I haven't bothered with how to get it to keep ndb highlights. Will post a few examples of the trigger lines and the easiest way to set them. Also note I use svo.deleteLineP() in this so you'll have to use whatever alternative you have if not svo.



    --Simple as that. Just opens a new dockable window named Chatbox for you.

    Capturing Different types of chat triggers:

    --Anything that starts with (Whatever): can just be captured with exactly that with begin of line substring set.


    --For adding tells you may need a few lines. I know the ones I use currently do not pick up Divine speaking to you or if someone uses a different language, but those could be easily added. All of these should be perl regex lines.


    ^[\w\s,]*(\w+) tells you, "(.+)"$<br><br>^You tell (.+), "(.+)"$<br><br>^You (.+) tell (.+), "(.+)"$<br><br>^[\w\s,]*(\w+) (.+) tells you, "(.+)"$<br><br>^[\w\s,]*(\w+) tells you in Cyrenese, "(.+)"$

    --I have all of this code in one big messy trigger I just add to whenever I join a new clan or whatever. Be as neat as you want to I suppose. The code for the one big messy trigger for me is as follows.



    Its not the prettiest or the neatest but it works and it works well for me. Being able to go back through a conversation is simple and I could never get used to tabbed chat personally. Didn't want to have to click around to see different things. If you decide to try this or it isn't working for you feel free to shoot me a message. I'm pretty sure I've included everything. I figured it was simple enough for someone to implement on their own but if someone wants me to dropbox it with a few basic triggers to get you started I can.

    Picture in spoiler

Sign In to Comment.