LUA to set targets

Post Reply
Janalon
Posts: 11
Joined: Mon Apr 20, 2009 8:53 pm

LUA to set targets

Post by Janalon »

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?

Altair
Posts: 2
Joined: Wed Aug 05, 2009 1:45 pm

Re: LUA to set targets

Post by Altair »

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:

Code: Select all

target = matches[2]
echo("target has been set to " .. matches[2])
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:

Code: Select all

send("kata perform " .. target .. " kick1 kick2 kick3")
The spaces after "perform " and before " kick" are important. Otherwise mudlet will send "kata performratkick1 kick2 kick3".

Janalon
Posts: 11
Joined: Mon Apr 20, 2009 8:53 pm

Re: LUA to set targets

Post by Janalon »

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 .. "")

Caled
Posts: 403
Joined: Thu Apr 09, 2009 4:45 am

Re: LUA to set targets

Post by Caled »

send ("stealth rush " .. pvptar .. " " .. dirtar)

Not need for the end. You were 'concatenating' (adding) nothing to the end.

Janalon
Posts: 11
Joined: Mon Apr 20, 2009 8:53 pm

Re: LUA to set targets

Post by Janalon »

Thanks!

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")
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:

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")
as noted, I'll have to remove the ''') from each end line.

Post Reply