Hi guys, I am pretty new to the mudlet and I am struggling with one simple thing (used to be simple in tintin++)...not sure if it's possible here.
So, I've created trigger which does following:
trigger capture
^You join (.*)'s group.$
trigger output
leader = matches[2]
Now I have variable leader set, and I am trying to re-use it other trigger string capture, but I am failing badly.
trigger capture
^@leader orders all his followers to '(.*)'.$
trigger output
send ("order all" .. matches[2])
Please help.
how-to
Re: how-to
@leader isn't a Mudlet thing - use (\w+) instead, and check that variable against the one you saved, so:
Re: how-to
and here is an example from my script where I make new triggers using parts from other triggers. This is basically what you are asking how to do. You can see how matches[3] is being grabbed from the trigger line and permBeginOfLineStringTrigger makes a new trigger with the contents of matches[3] in it.
Code: Select all
local trigger_name = matches[3].." (Venom)"
permBeginOfLineStringTrigger(trigger_name, "Venom Wipe Triggers", {[[Being careful not to poison yourself, you wipe off all the venoms from ]]..matches[3]}, [[
nightfallUI.Combat.venomed_weapons["]]..matches[3]..[["] = nil
disableTrigger("]]..trigger_name..[[")
]])
Re: how-to
Thank you both for quick reply. I will play around a bit today
Re: how-to
Another thing with alias.
I have alias with this pattern
^spells (.*)$
output of alias
if (matches[2] == NIL) then
send ("abil -l spell ")
else
send ("abil -l spell " ..matches[2])
end
basically I want to test on the fly if there is something in matches[2] or not. Alias works only when I put something after spells (for example spells ranger).
Please help
I have alias with this pattern
^spells (.*)$
output of alias
if (matches[2] == NIL) then
send ("abil -l spell ")
else
send ("abil -l spell " ..matches[2])
end
basically I want to test on the fly if there is something in matches[2] or not. Alias works only when I put something after spells (for example spells ranger).
Please help
Re: how-to
Have you tried:
if(matches[2] == "")
?
if(matches[2] == "")
?
Re: how-to
Try this. Pattern: ^spells(?: (.*))?$
Code:
Code:
Code: Select all
if matches[2] then
send("abil -| spell " .. matches[2])
else
send("abil -| spell ")
end
Re: how-to
Perfect - it works, thanks!Jor'Mox wrote: ↑Sun Apr 29, 2018 5:08 pmTry this. Pattern: ^spells(?: (.*))?$
Code:Code: Select all
if matches[2] then send("abil -| spell " .. matches[2]) else send("abil -| spell ") end
Re: how-to
Another how-to question
How to setup mudlet so when I type 10w my character moves ten times w?
also I tend to use multiple chains like 10w5w2nd something along those lines..
How to setup mudlet so when I type 10w my character moves ten times w?
also I tend to use multiple chains like 10w5w2nd something along those lines..