To reproduce the problem I'm having, two files are necessary. A plugin, and a main script file. They look like this:
--- Plugin ---
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="PluginAddTimerTest"
author="-"
id="788b9fdcf934fecbb21e5306"
language="Lua"
purpose="-"
date_written="2008-09-19"
requires="3.80"
version="1.0"
>
</plugin>
<script>
<![CDATA[
Execute("/addTimerTestTrigger()")
]]>
</script>
</muclient>
-- End Plugin ---
--- Main Script ---
local totalMessage = "";
testCallbacks = {}
function partialMessage(message)
if type(message) == "boolean" then
if message then
message = "true"
else
message = "false"
end
end
if type(message) == "number" then
message = "" .. message
end
if not(type(message) == "string") then
message = "<" .. type(message) .. ">"
end
totalMessage = totalMessage .. message
end
function message(message)
partialMessage(message)
print("[script] " .. totalMessage)
totalMessage = ""
end
function addTimerTestTrigger()
if testCallbacks.AddTimerTest then
for i,o in pairs(testCallbacks.AddTimerTest) do
o()
end
end
end
function timedEvent()
message("TimedEvent triggered!")
end
function addTimerTest()
message("AddTimer returns: " .. AddTimer('', 0, 0, 2, '', timer_flag.Enabled + timer_flag.OneShot + timer_flag.Temporary, 'timedEvent'))
end
testCallbacks.AddTimerTest = testCallbacks.AddTimerTest or {}
table.insert(testCallbacks.AddTimerTest, addTimerTest)
--- End Main Script ---
The code may look a little strange, but remember that it is taken out of a larger context. To reproduce the fault, install the script file and add the plugin, then try the following input(input marked with '>', output follows):
>/addTimerTestTrigger()
[script] AddTimer returns: 0
[script] TimedEvent triggered!
/Execute("/addTimerTestTrigger()")
[script] AddTimer returns: 0
[script] TimedEvent triggered!
/ReloadPlugin("PluginAddTimerTest")
[script] AddTimer returns: 30009
Again, MUSHclient 4.27. Is there anything I can do to fix this?
Edit: Tried to format the code a little bit better, but initial tabs and spaces seem to be ignored. Maybe if I knew the forum's markups, but... :)