Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Bug reports ➜ Please provide the trigger pattern when no label is available from an error

Please provide the trigger pattern when no label is available from an error

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Kahenraz   (75 posts)  Bio
Date Mon 22 Apr 2019 07:10 AM (UTC)
Message
I have an error that occurs periodically:

Immediate execution
[string "Trigger: "]:4: unexpected symbol near '0'


I'm not sure where it is. Can triggers which have no label report their pattern on an error?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 22 Apr 2019 10:57 PM (UTC)
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

Posted by Kahenraz   (75 posts)  Bio
Date Reply #2 on Tue 23 Apr 2019 03:26 AM (UTC)
Message
Thank you. This helped me to track down the offending trigger.

I also noticed that when I check the box for "Filter by:" I get the following error dialog:

---------------------------
MUSHclient
---------------------------
Cannot find the function 'filter' - item 'filter' is nil
---------------------------
OK   
---------------------------



This does not affect the filter operation and only seems to be an issue when the filter is empty.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Tue 23 Apr 2019 05:15 AM (UTC)
Message
That's right. When you click the "Filter by" box you are promising to provide a filter function in the filter box. This function makes the decision (which can be quite complex) as to whether a particular trigger should be displayed or not. If there is no such function you would get that error message.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,219 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.