AutoStab

Hi Amoeba, I hope this helps.
Acquiring target from leader:
pattern: ^(\w+) -- 'target (.*)'$
script- check leader and store target ***select perl-regex from the box**
if matches[2] == groupLeader then
local words = matches[3]:split(" ")
currentTarget = words[#words]
echo(" :::: Target is now: ".. currentTarget .. "\r\n")
end
then
pattern:^Exits$
script-check if my autostabbing is engaged and if so, stab target:
if autostab=true then send("backstab "..currentTarget) end
and an alias for turning it on and off..
pattern:^autostab$
script:
autostab=autostab or false ---to define it, or put this in your definitions script
if autostab==false then autostab=true echo("stab on") else autostab=false echo("stab off") end
That's the brunt of it. I don't mind helping flushing it out either for example you could add:
...then if fighting==false then backstab(currentTarget) else send("grouptell 'cant stab, im fighting'") ...or wutever
I set up the fighting flag by setting up a script that sets the flag every time MSDPOPPONENT changes, if opponent=="" then fighting=false. I like this setup because in a script I can set fighting=true and I wouldn't stab on multiple occurences of a pattern. For example if i trigger to stab kobold on kobold standing here and there's 10 kobolds in the room, it would only stab 1 because after the first one fighting=true. but after the fight fighting returns back to false when msdpopponent updates.
Addendum:
The above requires you have a couple group definitions set up. If you don't know what this means, go to scripts and create a new script and name it group definitions.
groupLeader=groupLeader or ""
currentTarget=currentTarget or ""
Now everytime mudlet starts, it will execute the above, which means, if this variable exists, keep it the same, otherwise create it and set it to ""
So now make a new alias with the pattern ^leader (\w+)$ that executes:
leader=matches[2]
echo("leader="..matches[2])
Acquiring target from leader:
pattern: ^(\w+) -- 'target (.*)'$
script- check leader and store target ***select perl-regex from the box**
if matches[2] == groupLeader then
local words = matches[3]:split(" ")
currentTarget = words[#words]
echo(" :::: Target is now: ".. currentTarget .. "\r\n")
end
then
pattern:^Exits$
script-check if my autostabbing is engaged and if so, stab target:
if autostab=true then send("backstab "..currentTarget) end
and an alias for turning it on and off..
pattern:^autostab$
script:
autostab=autostab or false ---to define it, or put this in your definitions script
if autostab==false then autostab=true echo("stab on") else autostab=false echo("stab off") end
That's the brunt of it. I don't mind helping flushing it out either for example you could add:
...then if fighting==false then backstab(currentTarget) else send("grouptell 'cant stab, im fighting'") ...or wutever
I set up the fighting flag by setting up a script that sets the flag every time MSDPOPPONENT changes, if opponent=="" then fighting=false. I like this setup because in a script I can set fighting=true and I wouldn't stab on multiple occurences of a pattern. For example if i trigger to stab kobold on kobold standing here and there's 10 kobolds in the room, it would only stab 1 because after the first one fighting=true. but after the fight fighting returns back to false when msdpopponent updates.
Addendum:
The above requires you have a couple group definitions set up. If you don't know what this means, go to scripts and create a new script and name it group definitions.
groupLeader=groupLeader or ""
currentTarget=currentTarget or ""
Now everytime mudlet starts, it will execute the above, which means, if this variable exists, keep it the same, otherwise create it and set it to ""
So now make a new alias with the pattern ^leader (\w+)$ that executes:
leader=matches[2]
echo("leader="..matches[2])