Posted by
| Nick Gammon
Australia (23,042 posts) bio
Forum Administrator |
Message
| Yes it seems to do it to me too. I made a few changes to at least eliminate the error message. This is the current plugin that works reasonably well:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, April 17, 2007, 9:38 AM -->
<!-- MuClient version 3.85 -->
<!-- Plugin "g15_keyboard_test" generated by Plugin Wizard -->
<!--
Set prompt in SMAUG like this:
prompt <%h/%Hhp %m/%Mm %v/%Vmv %x/%Xxp>
-->
<muclient>
<plugin
name="g15_keyboard_test"
author="Nick Gammon"
id="cf2fb62495f34eb887d7edaa"
language="Lua"
purpose="Shows using the Logitech G15 keyboard"
date_written="2007-04-17 09:37:23"
requires="3.80"
version="1.0"
>
</plugin>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
match="^\<(?P<health>\d+)\/(?P<maxhealth>\d+)hp (?P<mana>\d+)\/(?P<maxmana>\d+)m (?P<move>\d+)\/(?P<maxmove>\d+)mv (?P<xp>\d+)\/(?P<xptolevel>\d+)xp\>"
regexp="y"
send_to="12"
sequence="100"
>
<send>
if not g15.IsOpen () or not g15.IsConnected () then
return
end -- if
if not hp_text then
hp_text = g15.AddText ("static", "small", "right", 40, 0, 0)
hp_bar = g15.AddProgressBar ("filled", 100, 8, 50, 0)
mana_text = g15.AddText ("static", "small", "right", 40, 0, 10)
mana_bar = g15.AddProgressBar ("filled", 100, 8, 50, 10)
move_text = g15.AddText ("static", "small", "right", 40, 0, 20)
move_bar = g15.AddProgressBar ("filled", 100, 8, 50, 20)
end -- if
hp_text:set ("hp: %<health>")
hp_bar:percent (%<health> / %<maxhealth> * 100)
mana_text:set ("m: %<mana>")
mana_bar:percent (%<mana> / %<maxmana> * 100)
move_text:set ("mv: %<move>")
move_bar:percent (%<move> / %<maxmove> * 100)
</send>
</trigger>
<trigger
enabled="y"
match="Exits: *"
send_to="12"
sequence="100"
>
<send>
if not g15.IsOpen () or not g15.IsConnected () then
return
end -- if
if not exits_text then
exits_text = g15.AddText ("static", "small", "left", 160, 0, 30)
end -- if
exits_text:set ((string.gsub ("%0", "%a+", exits_subs)))
</send>
</trigger>
</triggers>
<!-- Script -->
<script>
<![CDATA[
function OnPluginInstall ()
assert (package.loadlib ("G15_Display.dll", "luaopen_g15")) ()
if g15 and g15.IsOpen () then
g15.SetAsForeground (true)
end -- if opened ok
-- exits substitutions table
exits_subs = {
north = "n",
south = "s",
east = "e",
west = "w",
northeast = "ne",
northwest = "nw",
southeast = "se",
southwest = "sw",
up = "u",
down = "d",
-- add more here
}
end -- OnPluginInstall
function OnPluginClose ()
if g15 and g15.IsOpen () then
g15.Close ()
end -- initialized
end -- OnPluginClose
]]>
</script>
</muclient>
All I can suggest is to do what I did when developing, and not use a plugin. That way the keyboard driver can stay initialized, while you test modifications to your trigger routines.
I found that restarting MUSHclient did it - this is a relatively quick operation. The plugin will just reload automatically if it is in the plugin list, so the only real time waster will be reconnecting to the MUD. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|