Greetings,
I'm having issues trying to figure out where in this plugin my issues are arising. The issue is that when I press "2" on my keypad (which corresponds to south), the plugin sends the "up" command, and tries to open a non-existent door in the "up" direction. This spams repeatedly until I manually enter the direction.
The only workaround I've seen is for me to manually type (using letters) the directions I want, and the script will sometimes kick in.
To clarify, the plugin I'm using is a simple auto door-opening plugin. I've looked over the code from top to bottom and can see the section that is causing me issues, but can't find fault in any of the code.
Can anybody help?
As the code for the plugin isn't that long, I'll just post it below:
I'm having issues trying to figure out where in this plugin my issues are arising. The issue is that when I press "2" on my keypad (which corresponds to south), the plugin sends the "up" command, and tries to open a non-existent door in the "up" direction. This spams repeatedly until I manually enter the direction.
The only workaround I've seen is for me to manually type (using letters) the directions I want, and the script will sometimes kick in.
To clarify, the plugin I'm using is a simple auto door-opening plugin. I've looked over the code from top to bottom and can see the section that is causing me issues, but can't find fault in any of the code.
Can anybody help?
As the code for the plugin isn't that long, I'll just post it below:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, January 26, 2012, 5:34 PM -->
<!-- MuClient version 4.79 -->
<!-- Plugin "MM_Auto_Open_Doors" generated by Plugin Wizard -->
<muclient>
<plugin
name="MM_Auto_Open_Doors"
author="Forral"
id="130ffba77eaf284e58979da5"
language="Lua"
purpose="Automatically opens doors"
save_state="y"
date_written="2012-01-26 17:33:26"
requires="4.00"
version="1.0"
>
</plugin>
<!-- Get our standard constants -->
<include name="\MUSHClient\worlds\plugins\constants.lua"/>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
group="script-autodoor"
keep_evaluating="y"
match="^(.+)\: It\'s locked\.$"
regexp="y"
send_to="12"
sequence="100"
>
<send>
if GetVariable("lock") then
Note("Unlocking: " .. lastdir)
Send("cast 'knock'" .. lastdir)
end
</send>
</trigger>
<trigger
enabled="y"
group="script-autodoor"
keep_evaluating="y"
match="^(?:The)? (.*?) (is|are) closed\.$"
regexp="y"
send_to="12"
sequence="100"
>
<send>
if GetInfo(87) ~= nil then
local lastcommand = string.lower(GetInfo(87))
--local lastdir = "NONE" -- need this available elsewhere to bash
lastdir = "NONE"
local directions = {"n", "s", "e", "w", "u", "d", "nw", "ne", "sw", "se"}
local fulldirections = {
n = "NORTH",
s = "SOUTH",
e = "EAST",
w = "WEST",
ne = "NORTHEAST",
se = "SOUTHEAST",
nw = "NORTHWEST",
sw = "SOUTHWEST",
u = "UP",
d = "DOWN"
}
for k, v in pairs(directions) do
if string.match(lastcommand, v) then
lastdir = fulldirections[v]
end
end
Note("Auto-opening: " .. lastdir)
Send("OPEN " .. lastdir)
Send(lastdir)
else
Note("Autodoor: Could not retrieve the last command sent to the MUD!")
end
</send>
</trigger>
</triggers>
<!-- Variables -->
<variables>
<variable name="lock">y</variable>
</variables>
</muclient>