Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Message
| Triggers which have a failing script now report the internal trigger name instead of a blank name (if the "real" name is blank).
This is implemented in version 5.07 (pre-release) which you can download following the instructions here:
http://www.gammon.com.au/forum/?id=13903
You can find which one this is by going to the triggers configuration dialog box (the one with a list of triggers in it) and pasting this into the "filter" box:
function filter (name, trigger)
return name == "*trigger269"
end -- filter
You would, of course, change the trigger number as required.
This box is next to "Filter by:" in the dialog box. Then check "Filter by" and the matching trigger will be the only one in the list.
If the trigger is in a plugin you can run this script in the Immediate window (Ctrl+I) to find it:
WANTED_TRIGGER = "*trigger269"
local plugins = GetPluginList() or {}
table.insert (plugins, "") -- add main world to plugins list
for _, pluginID in pairs (plugins) do
local tl = GetPluginTriggerList (pluginID) or {}
local pluginName = "main world file"
if pluginID ~= "" then
pluginName = GetPluginInfo (pluginID, 1)
end -- of not main world file
for id, name in ipairs (tl) do
if name == WANTED_TRIGGER then
local matchText = GetPluginTriggerInfo (pluginID, name, 1)
ColourNote ("orange", "", string.format ("Trigger '%s' in %s found! Match text: ", name, pluginName))
ColourNote ("darkgray", "", " " .. matchText)
end -- if
end -- for
end -- of each plugin
Change the first line above to match the reported trigger with the error and it should display what plugin it is in, and what the match text is.
An alternative approach is to run this script in the Immediate window (or make an alias out of it if you want, sending it all to "script"):
local plugins = GetPluginList() or {}
table.insert (plugins, "") -- add main world to plugins list
for _, pluginID in pairs (plugins) do
local tl = GetPluginTriggerList (pluginID) or {}
local pluginName = "main world file"
if pluginID ~= "" then
pluginName = GetPluginInfo (pluginID, 1)
end -- of not main world file
for id, name in ipairs (tl) do
if GetPluginTriggerInfo (pluginID, name, 21) > 0 and -- matched?
GetPluginTriggerInfo (pluginID, name, 15) == sendto.script and -- send to script?
not GetPluginTriggerInfo (pluginID, name, 34) then -- failed script?
local matchText = GetPluginTriggerInfo (pluginID, name, 1)
ColourNote ("orange", "", string.format ("Trigger '%s' in %s has a failed script! Match text: ", name, pluginName))
ColourNote ("darkgray", "", " " .. matchText)
end -- if
end -- for
end -- of each plugin
That reports every trigger that has matched, is sending to script, and has a failed script.
If you use this (last) script then you don't need to install the new pre-release of MUSHclient because it doesn't require you to know the trigger name. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|