Mudlet for Noobs

2»

Comments

  • If you don't specify an index, table.insert will add it to the first empty index, and table.remove will still move everything up.

    So if you use something like:

    table.insert(StrikeTable, "neck")
    table.insert(StrikeTable, "groin")

    then StrikeTable[1] will be neck, then you do table.remove(StrikeTable, 1) and StrikeTable[1] will be groin.
  • And to answer the second question: it's called "queue" then ;)
  • Okay, more newb questions from me. 

    I have an alias and it works well. I'd like it to fire more commands after my balance is restored. Possible?
  • JonathinJonathin Retired in a hole.
    edited March 2014
    edit: I'm just full of derp this week.
    I am retired and log into the forums maybe once every 2 months. It was a good 20 years, live your best lives, friends.
  • It is possible, but not without work. You can either use a queue manager (like this http://forums.mudlet.org/viewtopic.php?f=6&t=2128) or the in game queue. So basically send your first command and then use the following for the other actions after balance returns:
    send("queue add bal <command>")
  • DakotahDakotah Wales, UK
    a noob question from me.

    I had an idea for creating a table of sorts and putting in the names of Karma items and so if one fell I could either pick it up reflexively or use an alias of sorts to grab the item. Would this be difficult to get to grips with? I have zero coding background and the most I've created so far has been a highlight trigger.

    or, should I just leave this idea until I'm more established with the code.

  • Hard to say, give it a go and ask questions - if you give up, you can try later when you're better. 
  • edited April 2014
    Dakotah said:
    a noob question from me.

    I had an idea for creating a table of sorts and putting in the names of Karma items and so if one fell I could either pick it up reflexively or use an alias of sorts to grab the item. Would this be difficult to get to grips with? I have zero coding background and the most I've created so far has been a highlight trigger.

    or, should I just leave this idea until I'm more established with the code.
    Yes, it's possible. It might be more efficient to do this. Create a trigger called KarmaPick, or something.
    Set it as regex, and in the cases you see a monster drop karma, note the line, and make this, per exemple:
    ^A big bad monster drops a rainbow (\w+) as it dies in utter agony.$
    ^A cute little spider drops a huge (\w+) as it is squished under your foot.$

    Then in the script, do this:
    send("queue add bal get "..matches[2], false)

    What it will do is, as soon as it sees the line, it'll catch the word you want to catch, normally the item type, and get it whenever you regain balance. What I had in mind in the exemples was: a rainbow pearl, and a huge medallion. Which would make you "get pearl" and "get medallion".

    Of course the same process can be repeated again with other objects, like gold, shards, etc.

    p.s.: You can also use the tips above to create a table, catch the word from the trigger, and store it. You could then, let's say, make an alias that could do a serie of commands that put the karma in the chalice and then table.remove it to course through the entire table. Heck, I think I'll do this too.

    image
  • AerekAerek East Tennessee, USA
    I tried to help a young Priest with what I thought would be a piece of cake, but now I'm confused as all hell and at my wit's end.

    Trigger: (perl regex)

    ^(\w+)'s mana stands at (\d+)/(\d+).$

    Script:

    if matches[3] <= matches[4] * .5 then

    cecho("blah")

    end



    I'm beyond confused. If I just set the script to "matches[3] < matches[4]" the echo will work, but the moment I try to make it do math, it won't. I even set up a variable (AbsolveNow = matches[4] * .5) and confirmed that it was doing the math properly, but "matches[3] <= AbsolveNow" still wouldn't work.

    Can someone enlighten me?
    -- Grounded in but one perspective, what we perceive is an exaggeration of the truth.
  • probably need to do a tonumber() on the matches
    image
  • JonathinJonathin Retired in a hole.
    Dakotah said:
    a noob question from me.

    I had an idea for creating a table of sorts and putting in the names of Karma items and so if one fell I could either pick it up reflexively or use an alias of sorts to grab the item. Would this be difficult to get to grips with? I have zero coding background and the most I've created so far has been a highlight trigger.

    or, should I  just leave this idea until I'm more established with the code.
    Go for it. I usually peruse the forums to answer questions. There are also tons of tutorials out there as well.
    Siduri said:Yes, it's possible. It might be more efficient to do this. Create a trigger called KarmaPick, or something.
    Set it as regex, and in the cases you see a monster drop karma, note the line, and make this, per exemple:
    ^A big bad monster drops a rainbow (\w+) as it dies in utter agony.$
    ^A cute little spider drops a huge (\w+) as it is squished under your foot.$

    Then in the script, do this:
    send("queue add bal get "..matches[2], false)

    What it will do is, as soon as it sees the line, it'll catch the word you want to catch, normally the item type, and get it whenever you regain balance. What I had in mind in the exemples was: a rainbow pearl, and a huge medallion. Which would make you "get pearl" and "get medallion".

    Of course the same process can be repeated again with other objects, like gold, shards, etc.

    p.s.: You can also use the tips above to create a table, catch the word from the trigger, and store it. You could then, let's say, make an alias that could do a serie of commands that put the karma in the chalice and then table.remove it to course through the entire table. Heck, I think I'll do this too.
    That is overly complex or spammy, I'm too tired to decide. You can just have a table with karma items and cross-reference a requested gmcp char inv table and send only the ones that match.
    I am retired and log into the forums maybe once every 2 months. It was a good 20 years, live your best lives, friends.
  • Aerek said:
    I tried to help a young Priest with what I thought would be a piece of cake, but now I'm confused as all hell and at my wit's end.

    Trigger: (perl regex)

    ^(\w+)'s mana stands at (\d+)/(\d+).$

    Script:

    if matches[3] <= matches[4] * .5 then

    cecho("blah")

    end



    I'm beyond confused. If I just set the script to "matches[3] < matches[4]" the echo will work, but the moment I try to make it do math, it won't. I even set up a variable (AbsolveNow = matches[4] * .5) and confirmed that it was doing the math properly, but "matches[3] <= AbsolveNow" still wouldn't work.

    Can someone enlighten me?
    As Jacen said, you need to call tonumber(). You're matching a line of text, so *everything* in the matches table is a string, even if you use \d to say only match 0-9. Strings are compared alphabetically, so 1 is always less than 9, and it goes through each character of the strings in turn. So "1234" < "9" returns true, because when it compares them the first character "1" is less than the first character "9".

    Some operators (such as *) will force conversion of a string to a number, though if the string can't be converted the rest of the script might not execute. You'll still run into the same issue as above when you try to compare it with a string though.
  • AerekAerek East Tennessee, USA
    Thanks, got it working. Never found tonumber() in the Mudlet manuals I refer to, so I was completely lost as to what was going wrong.
    -- Grounded in but one perspective, what we perceive is an exaggeration of the truth.
  • Mudlet doesn't include Lua's manual, it documents Lua additions Mudlet has. Check http://www.lua.org/manual/5.1/ for the pure Lua stuff.
  • Sort of off-topic question.. is Mudlet still being developed?

  • Of course it is. There are multiple github forks where development happens.

  • Are these official development branches? I was given to understand that the *official* development of Mudlet had stopped.

  • Not sure where you got that official development stopped... It's just not as centralized anymore. But @Vadimuses probably knows more.

    As far as I know, they are "official" (as far as official goes). They stay individual until they get merged back into the main branch. https://github.com/Chris7/Mudlet2 Is the parent for most (I think) and the most active from what I saw. And there is https://github.com/vadi2/mudlet-lua for the lua part specifcally.

  • I can tell you where I got it from. Some guy on Aardwolf's tech channel who argued with me to no end about how \w+ and \d+ aren't good to use because they are "implementation specific". He said it's "definitely better" to build character classes yourself. Baw! If you're writing scripts for a single client, wtf does it matter? It's not like the implementation is going to change within the client! Anyway, he also vehemently expressed his dislike of Mudlet and claimed the development had ceased entirely. Name was Abelinc, fwiw.


    I'm glad to discover he was wrong. I was skeptical, as I remember checking out Mudlet a while back and found, IMO, it was a better client than anything else on the web. I would rate it over CMUD/ZMUD/Fugue/Tintin and... right on level with Mush, though I think overall, Mudlet has a more polished appearance and the mapper is more powerful. Why would development of such a great client cease?

  • \w+ and \d+ being implementation specific? They are Perl Compatible Regex character classes and the same as in every other PCRE implementation... But haters gonna hate I guess.

  • my thoughts exactly.. anyhow, thanks for the info.. I'll check out the gits when I wake up

  • No idea who that guy is. Development is ongoing :)

Sign In or Register to comment.