Mudlet questions & answers!

145791014

Comments

  • edited August 2013
    Wynedere said:
    I only want to mushroom sigils if I send certain aliases and if the sigils are flamed. If they're not flamed, I want to pick them up only when the aliases are sent. This does that, only it will also mushroom if I probe sigils that are flamed without using the aliases. If anyone knows how I can fix it, I'd appreciate it.


    Aliases:

    ^ccc$

    mushroom = cube

    flame = no


    send("p cube")


    if flame == no then

    send("get cube")

    end



    ^mmm$


    mushroom = monolith

    flame = no


    send("p monolith")


    if flame == no then

    send("get monolith")

    end




    Trigger:


    ^There is a flame-shaped sigil attached\. \((\d+) months remaining\)$


    flame = yes

    if mushroom == cube then

    sendAll("get mushroom from pack", "attach mushroom to cubesigil")


    elseif mushroom == monolith then

    sendAll("get mushroom from pack", "attach mushroom to monolithsigil")

    end



    I dont know if its the easiest way,  but you could enabletrigger() in your alias, and only have those triggers fire when using said alias, then disabletrigger() at the end.. So that when you probe without the alias it doesn't recognize the trigger or send the commands

    All I've had today are six gummy bears and some scotch
  • well, probably could be tweaked a little but it seems to do it's job for 10 minutes of working with it, at 6:30 am with no sleep lol

    Anyways:


    Let me know how it works, you'd need to get the sigilid about it other than it works like a charm for basic purposes
  • What Chapel said:

    ^ccc$

    mushroom = cube
    flame = no

    enableTrigger("flame trigger")

    send("p cube")

    if flame == no then
    send("get cube")
    end


    ^mmm$

    mushroom = monolith
    flame = no

    enableTrigger("flame trigger")

    send("p monolith")

    if flame == no then
    send("get monolith")
    end



    Trigger:

    ^There is a flame-shaped sigil attached\. \((\d+) months remaining\)$

    flame = yes
    if mushroom == cube then
    sendAll("get mushroom from pack", "attach mushroom to cubesigil")

    elseif mushroom == monolith then
    sendAll("get mushroom from pack", "attach mushroom to monolithsigil")
    end
    disableTrigger("flame trigger")

  • So, I copied my profiles folder over to my laptop to get an updated system on work trips. Settings moved over fine, but my map don't work. Anything besides copying profiles folders I need to do?
    image

  • Rangor said:
    So, I copied my profiles folder over to my laptop to get an updated system on work trips. Settings moved over fine, but my map don't work. Anything besides copying profiles folders I need to do?
    What you really want to do is put your profiles folder into a Dropbox or equivalent cloud sharing type folder and link your Mudlet to that, then you'll always have the latest set of profiles. I do this for my desktop PC and laptop. There's instructions on how to do it on the Mudlet forums themselves
    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."
  • Nothing special about the map - what do you mean by 'won't work'?
  • What I mean is, I'm an idiot and hadn't updated my mudlet in ages on the laptop.
    image
  • edited September 2013
    I'm having a bit of an issue with my Mudlet-2.1 client (obviously, or I woudln't be here). Anytime I try to open some functionality of Mudlet that requires I choose something from a directory, the selection window opens, then Mudlet freezes and crashes. This includes updating the Mapper script or important a Profile. The directory it tries to go to is ~/Applications/Mudlet-2.1.app/ 

    I'm running on Mac OS 10.8.5. I don't know why its defaulting to this package rather than the .config directory I would have expected.

    The error the Apple report gives is: 
    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '(
        "<NSIndexPath 0x1d71650> 3 indexes [0, 1, 0]"

    Obviously, that may not necessarily mean anything to you, but if there would be a way to circumvent this directory path, that would be great.
  • Aaaand nevermind.
  • Hello, let me start off by saying I don't really know much about lua. I would like to be able to catch a number when assessing and send different commands based on where the number is inbetween. For example if it is between 2500 and 3500 I would like to send one thing and if it is between 3501 and 4500 something else. I tried to look on the internet and make something. In short it did not work, if maybe someone could tell me how to do this, I would really appreciate it.

    -Vastus
  • ^You glance over (\w+) and see that (\w+) health is at (\d+)/(\d+).$

    if matches[4] >= 2500 && matches[4] <= 3500 then
        do stuff
    elseif etc....

    end
  • Ah thanks anthrax. So I have to use elseif. Also I used and instead of &&, does that matter? Would be useful to know for the future.

    Thank you.
  • It should be "and". && is not valid Lua syntax.
  • You might also need to explicitly cast the variable to a number, as in 

    if tonumber(matches[4])<5000 and tonumber(matches[4])>=4500 then
       stuff
    elseif tonumber(matches[4])<4500 and tonumber(matches[4]>=4000 then
       other stuff
    elseif...

    end


    Not actually sure if that's necessary or not offhand.
  • It is necessary. Matches always contains strings, which can't be compared by numbers and are not autocasted on comparison.
  • Eld said:
    It should be "and". && is not valid Lua syntax.
    Thanks for the correction Eld.  Sorry, I was at work and have been writing tcl and php all day.  The brain does not switch languages very fast.
  • Somehow it still doesn't work, probably something I forgot. I will just post what I did.

    ^(\w+) is at (\d+)/(\d+)$

    if tonumber(matches[4]) < 1500 then

    cecho("<maroon>[Fallen]: <red> Target is weak, crush it quickly!")

    elseif tonumber(matches[4]) >= 1500 and tonumber(matches[4]) < 2501 then

    send("shn "..target.." 12")

    elseif tonumber(matches[4]) >= 2501 and tonumber(matches[4]) < 3501 then

    send("shn "..target.." 18")

    elseif tonumber(matches[4]) >= 3501 and tonumber(matches[4]) < 4501 then

    send("shn "..target.." 21")

    elseif tonumber(matches[4]) >= 4501 and tonumber(matches[4]) < 5501 then

    send("shn "..target.." 24")

    elseif tonumber(matches[4]) >= 5501 and tonumber(matches[4]) < 6501 then

    send("shn "..target.." 27")

    elseif tonumber(matches[4]) >= 6501 and tonumber(matches[4]) < 7501 then

    send("shn "..target.." 30")

    elseif tonumber(matches[4]) >= 7501 and tonumber(matches[4]) < 8501 then

    send("shn "..target.." 33")

    elseif tonumber(matches[4]) >= 8501 and tonumber(matches[4]) < 9501 then

    send("shn "..target.." 36")

    elseif tonumber(matches[4]) >= 9501 then

    send("shn "..target.." 39")


    end

  • This looks valid to me. Although I am not sure if you want to send the "shn "..target.." XX" to Achaea, or if you'd rather like to expandAlias on this.

    If you want to send this, the output of the window that appears, if you click on the exclamation mark symbol on the left side in the script/alias/trigger window could be helpful.
  • Oh yes, the "shn "..target.." xx" is for the svo limcounter. The command for that is shn [target] [number of hits]. So it is an alias for something.
  • The easiest way would be to replace the calls to send by a call to expandAlias then. This should work.

    I would try to tinker with the svo.kl_list (or similar, depending on the counter), because I like that more than pretending to have this as manual input, but I am not sure if this is a two way api and if one has to be careful about specifics. @Vadimuses should be able to explain that better than me, as I don't have his counter.
  • I replaced all instances of send with expandAlias, but it still doesn't work?
  • This can have multiple reasons:
    1. Your trigger isn't firing. Enable highlighting in the trigger (right side above the script box) to see the matching.

    2. There is an runtime error. Open the error log (left side exclamation mark) and give the output there.

    There might be more but I'd try these first.
  • I figured the problem out. The line I got was modified by svo like I though originally. I went through all the triggers (sigh) and found which one it was, turned it off and now it is working. Thank you for the help @keneanung.
  • Keneanung said:
    It is necessary. Matches always contains strings, which can't be compared by numbers and are not autocasted on comparison.
    Couldn't remember if they were cast on comparison or not.

    A couple things to clean this up a bit. First, instead of calling tonumber() in every statement, you can just store the number in a local variable and use that. Second, if you're doing the comparisons in order like you have in your example, you can just use elseifs with a single comparison:

    local health = tonumber(matches[4])

    if health<=n1 then
        stuff
    elseif health<=n2 then
        stuff
    elseif health <=n3 then
        stuff
    ....
    end

    As long as the numbers increase each time, you'll only get to the second "if" if health is >n1, and so on, so the > checks are redundant.

    You'll find that people commonly advise against using expandAlias in situations like this. There are a couple of reasons, one being that it's slow, since it has to run the text through the alias matching engine and check it against all of your aliases, and another being that if for some reason you have two aliases that match what you're sending, both will fire when you might just be looking for one. More generally, expandAlias just isn't intended for use other than as a debugging tool, as I understand it. The preferred method, I think, would be to figure out what function that "shn" alias is calling, and just call it directly in your if statements.
  • TarausTaraus The Gypsy Wind
    so I know that with 'string:title()' , you can capitalize a single word, but what do you use when you want to capitalize all the letters of two or more words?

  • string:upper() makes every single letter upper case.
    But I assume you mean only the first letter of each word?

    In that case:

    yourstring:gsub("(%w+)", string.title)

  • My display function seems to be acting up, it's not displaying anything. For instance if I make an alias to call display(gmcp.Char) it returns nothing, and the same if I try to run it from the command box with lua gmcp.Char, and any other variant of any other table I've tried. Was the syntax changed or something?
    Chat with other players in real time on your phone, browser, or desktop client:
    Come join the Achaea discord!
  • Is gmcp even enabled?
  • Is gmcp even enabled?
    Yeah of course, I have a few custom scripts that fetch it and they still work fine, and I'm using svo which doesn't really function without gmcp.
    Chat with other players in real time on your phone, browser, or desktop client:
    Come join the Achaea discord!
  • Did you check your error window? You can click the big red ! to open it from Trigger/Script/Alias editor window
Sign In or Register to comment.