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

[Mudlet] Quick Question

IsmayIsmay Posts: 620Member ✭✭✭✭✭ - Grand Achaean
I could have sworn there used to be a thread for quick Mudlet questions, but can't seem to find it. Anyways, I have a question.

If I wanted a trigger to fire only if in a particular room, how would I go about doing that? Isn't there some sort of gmcp.Room.Info.area but without the area, and only for the room?

Comments

  • PyoriPyori Posts: 994Member ✭✭✭✭✭ - Grand Achaean
    gmcp.Room.Info.name

  • KlendathuKlendathu Eye of the StormPosts: 3,065Member @@ - Legendary Achaean
    I would use either gmcp.Room.Info.num or mmp.currentroom, which returns the numeric ID of the room. Multiple rooms can have the same name, but their ID is unique.

    Tharos, the Announcer of Delos shouts, "It's near the end of the egghunt and I still haven't figured out how to pronounce Clean-dat-hoo."
  • IsmayIsmay Posts: 620Member ✭✭✭✭✭ - Grand Achaean
    How would I code that in an if statement?

    if gmcp.Room.Info.num == ## ?
  • IssamIssam Posts: 71Member, Secret Squirrel ✭✭✭ - Distinguished
    edited May 10
    Pretty much exactly that.

    Personal example:
    if gmcp.Room.Info.name=="Rally Point" then
       send("queue addclear eqbal perform deliverance "..matches[2])
    end

  • PuxiPuxi Posts: 527Member ✭✭✭✭ - Eminent
    Stupid deliver bots.
    Issam
  • IsmayIsmay Posts: 620Member ✭✭✭✭✭ - Grand Achaean
    Another similar question. I want to do two different things with the same script, based on being in dragon or lesser form. For example:

    if gmcp.(in dragon) then
    send("do thing")
    elseif gmcp.(not in dragon)
    send("do other thing")

    What's the gmcp for dragon/lesser forms?
  • XadenXaden Posts: 2,315Member @@ - Legendary Achaean
    If gmcp.Char.Vitals.class == "Silver Dragon" then send("rend...") else send("whatever..?) end.

    Not in game right now, so my gmcp reference might be wrong. Class might be held in Charstats instead of vitals, can't recall off top of head.



         He is a coward who has to bring two friends as backup to jump people hunting.

  • XadenXaden Posts: 2,315Member @@ - Legendary Achaean
    Apologies it's 

    gmcp.Char.Status.class == "Silver Dragon"

    Just got into work to check now.
         He is a coward who has to bring two friends as backup to jump people hunting.

    Ismay
  • CyrCyr Posts: 106Member ✭✭✭ - Distinguished
    edited May 16
    gmcp.Char.Status.class
    e: Didn't refresh, Xaden beat me to it. 

    Dunn tells you, "I hate you."
  • PyoriPyori Posts: 994Member ✭✭✭✭✭ - Grand Achaean
    if gmcp.Char.Status.class:find("Dragon") then
    send( stuff )
    else
    send( lesser form stuff )
    end

    In the event you get multiple dragon colours.


    XadenIohannaIsmay
  • PyoriPyori Posts: 994Member ✭✭✭✭✭ - Grand Achaean
    Antonius said:
    Should turn it into a function so you don't have to keep repeating that same piece of code everywhere (you'll likely do lots of checks for whether or not you're in Dragon in triggers, aliases, etc.):
    function inDragon()
        return string.find(gmcp.Char.Status.class, "Dragon")
    end
    
    Then you'd do:
    if inDragon() then
        send("something")
    else
        send("something else")
    end
    
    To go off my above one, and this... Can also do:
    function inDragon(colour)
    return ( gmcp.Char.Status.class:find("Dragon") and gmcp.Char.Status.class:find(colour:title()) )
    end
    And follow with:
    if inDragon("red") then
    send("red dragon stuff")
    elseif inDragon("black") then
    send("black dragon stuff")
    else
    send("lesserform stuff")
    end


    Ismay
  • IsmayIsmay Posts: 620Member ✭✭✭✭✭ - Grand Achaean
    Coding is my sworn enemy...

    I've been working on this, but can't get it any faster. I need just a tad bit more speed.

    This is a rend alias that I have, which is too slow:

    (Please note that the 'venoms' variable is a toggle that I made to switch between sensitivity/curare and impatience/prefarar.)


    if gmcp.Char.Status.class == "Black Dragon" and venoms == true then

    send("clearalias dragonalias|setalias dragonalias dragoncurse " ..target.. " sensitivity 1/rend "..target.. " left leg curare")
    send("clearqueue all|queue add eqbal stand|queue add eqbal dragonalias")
    send("breathgust " .. target)

    elseif gmcp.Char.Status.class == "Black Dragon" and venoms == nil then

    send("clearalias dragonalias|setalias dragonalias dragoncurse " ..target.. " impatience 1/rend "..target.. " left leg prefarar")
    send("clearqueue all|queue add eqbal stand|queue add eqbal dragonalias")
    send("breathgust " .. target)

    elseif gmcp.Char.Status.class == "Monk" then

    sendAll("clearqueue all", "queue add eqbal stand", "queue add eqbal combo " .. target .. " snk left hfp left hfp left")

    end


    And this is my bite alias:


    if gmcp.Char.Status.class == "Black Dragon" then

    send("clearalias dragonbite|setalias dragonbite bite "..target)
    send("clearqueue all|queue add eqbal dragonbite")

    elseif gmcp.Char.Status.class == "Monk" then

    send("clearqueue all|queue add eqbal stand|queue add bbt " .. target)

    end


    Can someone please help clean this up to give it some speed?
  • AntoniusAntonius Posts: 4,626Member @@ - Legendary Achaean
    What do you mean by too slow? Unless you've somehow managed to install Mudlet on something that is literally a potato, that code shouldn't take a noticeable amount of time to execute.
    Tysandr
  • KlendathuKlendathu Eye of the StormPosts: 3,065Member @@ - Legendary Achaean
    edited May 20
    Prepend your dragonalias with stand instead of adding it separately to the queue. Use queue addclear instead of clear queue/queue add. No need to clearalias if you're redefining. Check for dragon once, then check for venoms:

    local cmds = {"stand"} -- table to which to add commands
    if gmcp.Char.Status.class:find("Dragon") then -- works for all colours now, wheee!
      local curse = "impatience" -- default curse
      local venom = "prefarar" -- default venom
      if venoms then
        curse = "sensitivity"
        venom = "curare"
      end
      table.insert(cmds,#cmds+1,"dragoncurse ".. target .. " " .. curse .. " 1")
      table.insert(cmds,#cmds+1,"rend " .. target .. " left leg " ..venom} 
      send("set alias dragonalias " .. table.concat(cmds,"/"))
      send("queue addclear eqbal dragonalias")
    
    elseif gmcp.Char.Status.class == "Monk" then -- you get the idea

    Tharos, the Announcer of Delos shouts, "It's near the end of the egghunt and I still haven't figured out how to pronounce Clean-dat-hoo."
  • AntoniusAntonius Posts: 4,626Member @@ - Legendary Achaean
    @Klendathu table.insert automatically adds to the end of the table if you don't specify an index, so table.insert(cmds, "dragoncurse " ...) is equivalent to table.insert(cmds, #cmds+1, "dragoncurse " ...), but saves on typing.
  • TysandrTysandr Posts: 441Member ✭✭✭✭ - Eminent
    Ismay said:
    (Please note that the 'venoms' variable is a toggle that I made to switch between sensitivity/curare and impatience/prefarar.)


    if gmcp.Char.Status.class == "Black Dragon" and venoms == true then

    send("clearalias dragonalias|setalias dragonalias dragoncurse " ..target.. " sensitivity 1/rend "..target.. " left leg curare")
    send("clearqueue all|queue add eqbal stand|queue add eqbal dragonalias")
    send("breathgust " .. target)

    elseif gmcp.Char.Status.class == "Black Dragon" and venoms == nil then

    send("clearalias dragonalias|setalias dragonalias dragoncurse " ..target.. " impatience 1/rend "..target.. " left leg prefarar")
    send("clearqueue all|queue add eqbal stand|queue add eqbal dragonalias")
    send("breathgust " .. target)

    elseif gmcp.Char.Status.class == "Monk" then

    sendAll("clearqueue all", "queue add eqbal stand", "queue add eqbal combo " .. target .. " snk left hfp left hfp left")

    end

    Do you really need to use a serverside alias? Your command would not hit the limit afaik. Be a model citizen and not spam with write/overwrites. Maybe that is where you are losing speed, because as Antonius says, your code should execute in no time.

    Look at the timestamps.

    41:15:369 ∘ You have cleared alias "roflmao".
    41:15:369 ∘ Alias "roflmao" will now execute: "yawn"
    41:15:369 ∘ You are exhausted and open your mouth in an enormous yawn.
    41:15:369 ∘ 5980 (100) (99) [ex] ckdb-
    41:15:727 ∘ You have cleared alias "roflmao".
    41:15:727 ∘ Alias "roflmao" will now execute: "yawn"
    41:15:727 ∘ You are exhausted and open your mouth in an enormous yawn.
    41:15:727 ∘ 5980 (100) (99) [ex] ckdb-
    41:16:181 ∘ You have cleared alias "roflmao".
    41:16:181 ∘ Alias "roflmao" will now execute: "yawn"
    41:16:182 ∘ You are exhausted and open your mouth in an enormous yawn.

    41:59:283 ∘ 5980 (100) (99) [ex] ckdb-
    42:00:954 ∘ You are exhausted and open your mouth in an enormous yawn.
    42:00:954 ∘ 5980 (100) (100) [ex] ckdb-
    42:01:062 ∘ You are exhausted and open your mouth in an enormous yawn.
    42:01:062 ∘ 5980 (100) (100) [ex] ckdb-
    42:01:195 ∘ You are exhausted and open your mouth in an enormous yawn.
    Nexus: Accents, Autotriggers, Dragon Talismans
    "As the child did... without the rope. Then fear will find you again."

  • IsmayIsmay Posts: 620Member ✭✭✭✭✭ - Grand Achaean
    Anyone know how to change this:


    send("unenemy all")
    if matches[3]:find(",") then enemies = string.split(matches[3], ", ") else
    enemies = string.split(matches[3], " ") end
    -- display(enemies)
    for k,v in pairs(enemies) do
    send("enemy " .. v)

    end



    To where it only fires when in dragon? Tried to do this and it didn't work:

    if gmcp.Char.Status.class == "Black Dragon" then

    send("unenemy all")
    if matches[3]:find(",") then enemies = string.split(matches[3], ", ") else
    enemies = string.split(matches[3], " ") end
    -- display(enemies)
    for k,v in pairs(enemies) do
    send("enemy " .. v)


  • AjocAjoc Posts: 80Member ✭✭ - Stalwart
    Ismay said:
    if gmcp.Char.Status.class == "Black Dragon" then

    send("unenemy all")
    if matches[3]:find(",") then enemies = string.split(matches[3], ", ") else
    enemies = string.split(matches[3], " ") end
    -- display(enemies)
    for k,v in pairs(enemies) do
    send("enemy " .. v)
    end
    end
    Add the bold text. The last for-statement is not closed, nor is the overarching if-statement about your class.
  • IsmayIsmay Posts: 620Member ✭✭✭✭✭ - Grand Achaean
    I did a forced update on the mapper, and ended up losing all my maps. Is there any way to retrieve those, and avoid it in the future?
  • ZerisZeris Posts: 57Member ✭✭ - Stalwart
    How do I enable a gmcp module? I can't seem to get the syntax right. I know there are 2 ways, but I can't remember either of them. D:
  • PyoriPyori Posts: 994Member ✭✭✭✭✭ - Grand Achaean
    Zeris said:
    How do I enable a gmcp module? I can't seem to get the syntax right. I know there are 2 ways, but I can't remember either of them. D:
    sendGMCP('Core.Supports.Add ["Comm.Channel 1"]')
    sendGMCP('Core.Supports.Add ["IRE.Target 1"]')

    Like that?



    Zeris
  • ZerisZeris Posts: 57Member ✭✭ - Stalwart
    edited July 22
    I meant to post my question in the other thread. Not sure what happened. Yes that is exactly what I was looking for. Thank you.
Sign In to Comment.