Freebie Scripts

Figured it'd be nice to share a few simple things I think would be useful for people not big into lua/mudlet.

First one is an easy dragon talisman color format, just because it was annoying to have so much gray chaos going on when I checked talismans.

Second one is a simple little affliction coloring thing I put together, which over time lets you stop reading them entirely (as you learn to just react to the colors).  Nothing special, but might be useful to someone.  (uses the hecho(str) function)

I also have a great (non-GMCP) wielding script I can share if requested via message or in game.




Comments


  • Shecks said:


    Second one is a simple little affliction coloring thing I put together, which over time lets you stop reading them entirely (as you learn to just react to the colors).  Nothing special, but might be useful to someone.  (uses the hecho(str) function)
    http://pastebin.com/DrViKdd2


    That's a lot of if statements. Are you supposed to run this function each time you get an affliction?





  • JonathinJonathin Retired in a hole.
    I am retired and log into the forums maybe once every 2 months. It was a good 20 years, live your best lives, friends.
  • Now with less IF statements!
    http://pastebin.com/CA0APfaM
  • Valden said:
    Now with less IF statements!
    http://pastebin.com/CA0APfaM
    Brilliant.
  • Valden said:
    Now with less IF statements!
    http://pastebin.com/CA0APfaM
    Probably want to return affs[aff] or aff so it has a fallback in the case that the affliction isn't mapped to anything, as it does in the original script.
  • Antonius said:
    Valden said:
    Now with less IF statements!
    http://pastebin.com/CA0APfaM
    Probably want to return affs[aff] or aff so it has a fallback in the case that the affliction isn't mapped to anything, as it does in the original script.
    I'll confess to being lazy and just rewriting the code with a search replace for most of it :-\"
  • edited February 2014
    Technically using a table isn't any faster than ifs, since a table call basically does the exact same thing, but also adds in loop operations and variables. ( you just don't see any of it). To make the thing more elegant, they should be elseifs not ifs, and should have the most common afflictions listed first.

    Anywho, I don't really put that much emphasis on efficiency in non-recursive functions, because on a modern machine that can change a million pixels a hundred times a second, whether or not you use a table or ifs is 100% ignorable.
  • Shecks said:
    Technically using a table isn't any faster than ifs, since a table call basically does the exact same thing, but also adds in loop operations and variables. ( you just don't see any of it).
    This is actually not true.  Table access is usually done via hashing, a significantly faster operation, and not with ifs, loops or pattern matching.
  • edited February 2014
    You're right, a brief google search concludes.  With that said, I don't think it matters in the slightest.  The CPU operation to print each character takes up ten thousand times the amount of processing power as either version of that function.  Efficiency is something I worry about when it comes to complex or looped functions.  The only example I can think of for Achaea is pathfinding, but curing algorithm speed might be noticeably impacted, if your code is advanced enough.
  • That's ... actually not true either, especially with an interpreted language like LUA. 

    Still, you're at least right in that speed only actually matters in places that are run frequently enough, or on large enough volumes of data, that it will actually start to cause a slowdown.  This could be one of those places, depending on how often he actually calls that echo function, but chances are it's not.  If he happens to call it on every single prompt as part of an update loop for a status window, for example, it's probably going to contribute to system slowness.  Best practices let you avoid having to hunt things like that down later when you do start to notice a general sluggishness to your system as you build it up.
  • edited February 2014
    If we really cared about (perfect) efficiency, we'd all use C++ systems =P.
  • edited March 2014

    For mac users, I came a very useful little trick:

    os.execute([[terminal-notifier -message "Hello World." -title "Message Title"]])


    This makes one of those nifty little notification boxes that appears up top, then fades away after a few seconds.  Very nice for notifications if you don't have mudlet on top.  I use it for gank alerts when I'm bashing, and I have sounds toggled off.

  • UtianimaUtianima Norway and Austria
    Shecks said:

    For mac users, I came a very useful little trick:

    os.execute([[terminal-notifier -message "Hello World." -title "Message Title"]])


    This makes one of those nifty little notification boxes that appears up top, then fades away after a few seconds.  Very nice for notifications if you don't have mudlet on top.  I use it for gank alerts when I'm bashing, and I have sounds toggled off.

    Great tip, thanks! This might singlehandedly make me go back to Mudlet :)

  • JonathinJonathin Retired in a hole.
    edited March 2014
    Ubuntu has something similar called notify-osd. There has been a timeout bug since forever so if you want to change the time it takes for the balloons to disappear, download the notifyOSD Configuration tool and set the timeout that way (it's persistent, unfortunately).

    Vadi posted the original on the Mudlet forums ages ago but

    function notifySend (sub,...)

    os.execute([[notify-send ]]..sub..[[ "]] .. ... .. [["]])

    end
    I am retired and log into the forums maybe once every 2 months. It was a good 20 years, live your best lives, friends.
  • Shecks said:
    First one is an easy dragon talisman color format, just because it was annoying to have so much gray chaos going on when I checked talismans.

    Great script, thanks @Shecks, makes my talisman pieces look purdy. However, it only works when doing the full "talismans list", how could I adjust it so it also fires when I do "talismans list bluedragon", for example?
    Hiroma tells you, "I just got to listen to someone complain about your deadly axekick being the bane of their existence."
    Archdragon Mizik Corten, Herald of Ruin says, "Man, that was a big axk."
    Hellrazor Cain de Soulis, Sartan's Hammer says, "Your [sic] a beast."
  • For some reason using that command outputs them in a different format (with parantheses around the quantity that you have).  You just have to modify the trigger to work with that, or add a separate trigger line.
  • XliXli
    edited March 2014
    Shecks said:
    For some reason using that command outputs them in a different format (with parantheses around the quantity that you have).  You just have to modify the trigger to work with that, or add a separate trigger line.
    Ah, the brackets... now all becomes clear, TY!

    And here's the extra line I needed to add: ^\s+\((\d).*(\d+)\s+Dragon\s+(\w+)$
    Hiroma tells you, "I just got to listen to someone complain about your deadly axekick being the bane of their existence."
    Archdragon Mizik Corten, Herald of Ruin says, "Man, that was a big axk."
    Hellrazor Cain de Soulis, Sartan's Hammer says, "Your [sic] a beast."
  • UtianimaUtianima Norway and Austria
    Utianima said:
    Shecks said:

    For mac users, I came a very useful little trick:

    os.execute([[terminal-notifier -message "Hello World." -title "Message Title"]])


    This makes one of those nifty little notification boxes that appears up top, then fades away after a few seconds.  Very nice for notifications if you don't have mudlet on top.  I use it for gank alerts when I'm bashing, and I have sounds toggled off.

    Great tip, thanks! This might singlehandedly make me go back to Mudlet :)
    I went back to Mudlet! :)

    This is not working for me, though. Tried it as an alias, and in a script (and calling it from an alias with os.execute()). Any tips or additional intrustructions?

    Cheers :D

  • UtianimaUtianima Norway and Austria
    Utianima said:


    Utianima said:


    Shecks said:


    For mac users, I came a very useful little trick:

    os.execute([[terminal-notifier -message "Hello World." -title "Message Title"]])



    This makes one of those nifty little notification boxes that appears up top, then fades away after a few seconds.  Very nice for notifications if you don't have mudlet on top.  I use it for gank alerts when I'm bashing, and I have sounds toggled off.


    Great tip, thanks! This might singlehandedly make me go back to Mudlet :)


    I went back to Mudlet! :)

    This is not working for me, though. Tried it as an alias, and in a script (and calling it from an alias with os.execute()). Any tips or additional intrustructions?

    Cheers :D

    I found out I had to download and install terminal-notifier first. I did so following these instructions:
    http://m.cnet.com/news/how-to-invoke-alerts-from-the-os-x-terminal/57532444

    I can now create notifiers from the terminal, but still does not work from within Mudlet.

    I also checked that Mudlet has been allowed to control system, from within System Preferences.

    What can I be missing, @Shecks‌ ?

  • edited March 2014
    Are you using mavericks?
    @Utianima
  • UtianimaUtianima Norway and Austria
    edited March 2014

  • edited March 2014
    Catch me in game, we'll figure it out... As long as you're not killing mah kelpies. (9-16 hours from now)
  • UtianimaUtianima Norway and Austria
    Thanks! Will do, @Shecks :)

  • StrataStrata United States of Derp
    Can't wait until people start making triggers that pass stuff from the mud to os.execute()
    Then you're all gonna be like "oops... yeah that was a good idea."
  • UtianimaUtianima Norway and Austria
    ..Huh? @Strata‌

    I am gonna make the triggers myself, and can turn them off if it turns out a bad idea. How can others create triggers for me? :s Must be something I am not getting here

  • UtianimaUtianima Norway and Austria
    Made it work! Thanks @Shecks

    My problem was I had done a manual install of terminal-notifier. Had to install it via gem (sudo gem install terminal-notifier). See "Download" section in the readme here, for more information:

Sign In or Register to comment.