Mudlet Questions

SiamSiam Whispered Voice
edited April 2013 in Mechanic's Corner

I just went back to using Mudlet today, and I need your help. I've lost what little I've learned in the past. :) Basically, I want to capture the amount of esteem I have, and should it be greater than a set amount(for example: 100), I'd like to imbue the captured amount to a figurine. I was thinking of basing it off of QSC. Help, please? :)

| Siam Star-eyes, Echo of the Wyrd ---------------------------------- #86 |
| Essence: 27,866,684 Power: 10p ( 92%) Karma: 10% Esteem: 156 |
| Health : 4810/4810 Mana : 6175/6300 Ego : 6684/7500 Analytical |
|-------------------------------------------------------------------------|
Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

#bringShikariback 


«13456710

Comments

  • I think the pattern would be...

    ^\| Essence: .+ Power: \d+p \( \d+\%\) Karma: \d+\% Esteem: (\d+) \|$

    if you didn't care about how specific the regex was, you could just do

    ^\| Essence: .+ Esteem: (\d+) \|$

    and you'd just do...
    esteem = tonumber(matches[2])


    I can't test right now, I put lots of \ in front of characters I wasn't sure about... But I think that should work
    Take great care of yourselves and each other.
  • SiamSiam Whispered Voice
    Thanks!
    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • SiamSiam Whispered Voice
    Another problem:

    "Beseeched she, the Night for Beauty, and beauty it was she found," you sing, letting an ebony and moonhart mandolin howl with painful notes.

    I want to ignore everything else besides "you sing", see below:

    ^" * " you sing,* \.$

    I suspect I have to use the A-Z thing here, right? I can't find something similar in the new forums, though. I think I could always trigger "you sing" as a substring, but I think that'd be too crude... ;)) All help would be appreciated!
    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • ^.+\" you sing, .+.$
    Take great care of yourselves and each other.
  • SiamSiam Whispered Voice
    Thanks!
    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • SiamSiam Whispered Voice
    Regarding TempTimers, is there a way to cancel all TempTimers triggered by something?
    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • edited April 2013
    I'm unsure about that.  If there isn't you can do it this way...

    for each temptimer you create do...

    local timerID
    if not timers then timers = {} end
    timerID = tempTimer( blah, [[blah]])
    table.insert(timers, timerID)

    and then you can create a function

    function killAllTimers()
    for _, id in ipairs(timers) do
    killTimer(id)
    end
    timers = {}
    end

    note: there may be some errors, I just scribbled that up.

    edit:Thinking further, it may be easier for you to do this instead of writing all that for each timer, use customTimer(blah, [[blah]])...

    function customTimer(time, action)
    local timerID
    if not timers then timers = {} end
    timerID = tempTimer( time, action)
    table.insert(timers, timerID)
    end

    edit2: bugfix
    Take great care of yourselves and each other.
  • SiamSiam Whispered Voice
    Thanks. I would love to know the reason behind the usage of each 'function' and why it's scripted the way it is, though, so I get to learn as well.:)

     For example, why use

    if not timers then timers ={} end -- why the blank brackets?

    How does one go about using timerID? I hope you get what I mean, or that at least I don't sound stupid! Hahaha.:)
    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • TacitaTacita <3s Xynthin 4eva!!!11
    For an even simpler option, just trigger the completion messages from influences to attempt to imbue 100 esteem or however much it is you wish. Yes, it means you imbue when you don't need to - but it's also really simple ;)
  • edited April 2013
    Siam said:


    if not timers then timers ={} end -- why the blank brackets?
    This is initializing timers to ensure it's not null. If timers is not declared, it will return null, so it goes into the if statement and declares it. Thus, after this if check, we always know timers is not null (we don't NECESSARILY know it's a table, as timers having any value (e.g. an integer) will make it not null, but we can assume it as such).

    A simpler method is: timers = timers or {} 

    In that case, the 'or' means "if timers is null, use {}". It's a nice little thing to use to avoid null errors and check declarations.
  • SiamSiam Whispered Voice
    Big help! Thanks a lot @Akyaevin. :)
    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • timers = timers or {} is actually a bit quicker than the if, too. It's a good pattern to use.
  • Good to know!
    Take great care of yourselves and each other.
  • SiamSiam Whispered Voice
    You guys are a helpful bunch. :)
    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • SiamSiam Whispered Voice
    edited April 2013

    ^You pat (.*) in a friendly manner\.$ 

     patted =  patted + 1
    cecho(string.format("<green>\n\n   We have  patted % persons!\n\n",  patted ))

    The above doesn't seem to be working. :(



    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • I don't really use string.format myself, so I'm not sure about that... but why not just do this?

    cecho("<green>\n\n We have patted " .. patted .. " persons!\n\n")
    Take great care of yourselves and each other.
  • SiamSiam Whispered Voice

    I actually tried that prior. Didn't work. Both had this for the error:

    [ERROR:] object:<test> function:<Trigger3103>
             <[string "function Trigger3103()..."]:2: attempt to perform arithmetic on global 'patted' 
    (a nil value)>

    I'm guessing we need to declare that the variable patted is a number? I copied the  patted =  patted + 1 from the mudlet manual though, so I'm not sure what's happening.
    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • The "patted" variable hasn't been defined yet. You'll need to define it either on login or before doing the patted = patted + 1 line in the trigger.

  • SiamSiam Whispered Voice
    How do I define it without logging out?
    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • patted = patted or 0
    Take great care of yourselves and each other.
  • A simple thing you can do is to just stick
    if patted == nil then
        patted = 0
    end
    Before the arithmetic line.

    This might mean that the number is not saved across sessions, though. If you want to keep track of how many times you've used the patted emote across sessions. You'll need to use the loadVars() and saveVars() functions.

  • SiamSiam Whispered Voice
    edited April 2013
     Wonderful, thank you!

    Viravain, Lady of the Thorns shouts, "And You would seize Me? Fool! I am the Glomdoring! I am the Wyrd, and beneath the cloak of Night, the shadows of the Silent stir!"

    #bringShikariback 


  • Is there an addon to gun in aetherspace?
  • edited August 2013
    Siam said:

    I just went back to using Mudlet today, and I need your help. I've lost what little I've learned in the past. :) Basically, I want to capture the amount of esteem I have, and should it be greater than a set amount(for example: 100), I'd like to imbue the captured amount to a figurine. I was thinking of basing it off of QSC. Help, please? :)

    | Siam Star-eyes, Echo of the Wyrd ---------------------------------- #86 |
    | Essence: 27,866,684 Power: 10p ( 92%) Karma: 10% Esteem: 156 |
    | Health : 4810/4810 Mana : 6175/6300 Ego : 6684/7500 Analytical |
    |-------------------------------------------------------------------------|

    if tonumber(gmcp.Char.Vitals.esteem) > 100 then

    send("imbue "..mm.conf.figurine.." with " ..gmcp.Char.Vitals.esteem.. " esteem", false)

    end

    Is also the Shintar.
  • Hello! How do I highlight:

    You have recovered equilibrium.

    I want to be able to keep track of my balance
  • match: You have recovered equilibrium.  [set it to "exact match"]


    Use this to highlight it:

    selectCurrentLine() fg("green") bg("white") deselect() resetFormat()

    For an even more flashy stuff, you can also use a colour echo:

    cecho("\n<white:purple> [[ Equilibrium is back! Dance like a monkey! ]]")
  • Thank you.

    Another question, I want to set up a trigger to pick up corpses of mobs I kill, I guess it would be something along the lines of:

    match: You have slain a gnome.

    when(You have recovered equilibrium)
     then (get gnome)
    end
    how far off is this as I dont see a when command?
  • XenthosXenthos Shadow Lord
    edited August 2013
    For things you kill, you're better off getting an acquisitio enchantment.  An avaricehorn will also automatically scoop up the gold for you, too.

    Then you just need triggers to scoop up the things that drop out of the bodies.
    image
  • I am trying to write a thing where I probe a series of items (this I have and works) and would like to do something based on the number of their respective usefulness left (stick it in a table to work with later down the line). This is where I am stuck. I can send("probe item") and then trigger on the usefulness line, but the for loop will keep going and won't wait for the capture to have happened. So I am wondering if anyone has an idea for another approach to this. Yes, I know I can simply learn audit, but I'd like to spend my credits elsewhere plus it is an interesting problem that I'd like to know how to solve :P
    image
    You have received a new honour! Congratulations! On this day, you have shown your willingness to ensure a bug-free Lusternia for everyone to enjoy. The face of Iosai the Anomaly unfolds before you, and within you grows the knowledge that you have earned the elusive and rare honour of membership in Her Order.
    Curio Exchange - A website to help with the trading of curio pieces in Lusternia.
  • Hmm. The best I can think of would be to stick the IDs in a table, and everytime you get a probe, you use the first item in that table. You might not be able to trigger solely on the "it has x months of usefulness left" though, as that line doesn't exist for certain items (artifacts, etc). I think the weight line is always there though (either as "It weighs x ouces" or "it is strangely weightless"), so you might be able to do something with that.
    image
Sign In or Register to comment.