I currently play a character on IRE's Lusternia mud. That mud has an alias AND target system where I can
settarget tar rat where &tar will substitute for rat.
and
alias pp kata perform &tar kick1 kick2 kick3 kick4 where I enter "pp" + return to perform a four kick combo on that defined target of rat.
SO...
I attempted to use Mudlet alias featured in place of the mud's alias. Funny enough, it did not accept the &tar coming from Mudlet, only when the defined target was used in combination with the mud's alias system.
No worries... so now I want a Mudlet LUA command to define targets AND recall them when using an alias. So when I "X rat", rat will be defined as a target which I can later use to "pp" to kick that tail off the rat.
Can anyone help?
LUA to set targets
Re: LUA to set targets
First you need to define the variable. So, set an alias with the pattern set to "^x (.*)$". This will capture the alias "x rat124" or simply "x rat" in any form.
Then in the large box below you'll want something along the lines of:
The "matches[2]" portion sends the information captured by the wildcard to the alias, whereas using matches[1] would send the whole line, including the "x " portion.
Finally, you'll want to define an attack alias/macro. The information you'll want to send to mudlet is:
The spaces after "perform " and before " kick" are important. Otherwise mudlet will send "kata performratkick1 kick2 kick3".
Then in the large box below you'll want something along the lines of:
Code: Select all
target = matches[2]
echo("target has been set to " .. matches[2])
Finally, you'll want to define an attack alias/macro. The information you'll want to send to mudlet is:
Code: Select all
send("kata perform " .. target .. " kick1 kick2 kick3")
Re: LUA to set targets
Awesome. Incredibly helpful and easy to understand. To clarify... what if I had two targets such as stealth rush mark west where mark = pvptar and west = dirtar.
would that be expressed as:
send ("stealth rush " .. pvptar .. " " .. dirtar .. "")
would that be expressed as:
send ("stealth rush " .. pvptar .. " " .. dirtar .. "")
Re: LUA to set targets
send ("stealth rush " .. pvptar .. " " .. dirtar)
Not need for the end. You were 'concatenating' (adding) nothing to the end.
Not need for the end. You were 'concatenating' (adding) nothing to the end.
Re: LUA to set targets
Thanks!
I added some foreground shading to the echo... so now setting my PVP target looks like:
Just to check, these targets are saved when you disconnect and reconnect... though they are wiped clean when you quite Mudlet and re-open the program. So I decided to set a Target Check as ^tarcheck$ which does the following:
as noted, I'll have to remove the ''') from each end line.
I added some foreground shading to the echo... so now setting my PVP target looks like:
Code: Select all
pvptar = matches[2]
fg ("white")
echo ("Enemy target has been set to ")
fg ("red")
echo ("" .. matches[2] .. "")
fg ("white")
echo (".\n")
Code: Select all
fg ("white")
echo ("Enemy target = ")
fg ("red")
echo ("" .. pvptar .. " \n")
fg ("white")
echo ("Mob target = ")
fg ("red")
echo ("" .. pvetar .. " \n")
fg ("white")
echo ("Healing scroll target = ")
fg ("red")
echo ("" .. hscroll .. " \n")
fg ("white")
echo ("Protection scroll target = ")
fg ("red")
echo ("" .. pscroll .. " \n")