Discern TP kill line isn't working :(

^(\w+)\'s ego stands at (\d+)/(\d+)\.$   (set to regex)

local name = matches[2]

local ego = tonumber(matches[3])

local maxego = tonumber(matches[4])

local percent = math.floor(ego / maxego * 100)


if percent < 50 and name == target then

send("psi super mindburst " .. target)

else

send("psi super " .. tpattack .. " " .. target)

end


send("psi id " .. tpid .. " " .. target)

send("psi sub " .. tpsub .. " " .. target)



Nothing happens when I discern my target.  Halp :(

Best Answers

Answers

  • I'm not an expert at regex, but I saw you didn't backslash the / between the ego and max ego in your trigger. I think mudlet might still capture it properly, but you might want to try backslashing it, since if nothing happens (not even your id and sub attacks) that means the entire trigger isn't firing at all.

    Also note that with your current script, your "target" variable needs to be exactly the same as the person you're discerning, including capitalization. So if your target is stored as "lerad", it won't work, since my name shows up as "Lerad" in game messages. You'll need to use string.lower(matches[2]) to change it. Also note that once you do that, if you target with capitalization (like tab-completion) the same problem will happen in reverse unless you string.lower your targetting alias as well.

  • Even with the backslash, it's not working.  Also, my target is always capitalized (thanks to Kelly!).
  • UshaaraUshaara Schrödinger's Traitor
    Hmm, looks like it should be working. Be sure you have defined your 'tpattack', 'tpid' and 'tpsub' variables and are not treating them as local values maybe?
  • Ushaara said:
    Hmm, looks like it should be working. Be sure you have defined your 'tpattack', 'tpid' and 'tpsub' variables and are not treating them as local values maybe?
    100% did that the first run through.  The second one, though, I realize now that I didn't.

    Could it be something with the Discern output being five lines, the ego portion being the fourth?
  • Okay. So, with an echo added, I'm sure it's matching properly.  The problem is in the code.  Problem there is, I can't find it :(
  • edited March 2013
    Found it.  The trigger which is supposed to set the tpattack variable is not doing its job.

    You blast the mind of   (begin of line substring)

    tpattack = psychicvampirism

    Edit: Neither are the aliases setting the variables "tpid" and "tpsub."  What the goose.

    Edit 2: Right.  So, an alias "k1" which reads:

    tpid = stupidity
    tpsub = addiction

    is not setting those variables.  However, if I do alias "k (\w+)" which reads:

    tpid = matches[2]

    it is.  The same is happening with the above trigger.  Earlier, I had it set so that instead of setting the variable to the attack itself, it set it to either 1 or 0, then went through an if/then to send the attack.  That worked fine.  But this work.  So confused :(
  • THANK YOU!  Finally.  Working like a charm.
Sign In or Register to comment.