Communication Miniwindow Not Functioning

Posted by Solaobajiuik on Fri 07 Oct 2016 12:03 AM — 5 posts, 20,045 views.

#0
So, I found a plugin here that I liked called: Generic_Chat_Miniwindow by Fiendish.

I decided to incorporate it into the Utility Plugin I am creating so that I can stop explaining to people how to set it up.

I have added the chattrigger script directly to the plugin and am trying to use:

<triggers>
  <trigger
   enabled="y"
   group="CommunicationTest"
   keep_evaluating="y"
   match="^You are a member of the (.+) race\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>CallPlugin ("f6812fbbea7ca2d1a7476970", "chattrigger", "%0")</send>
  </trigger>
</triggers>


as the trigger to send to the script.

The ChatTrigger function I have edited to be


function chattrigger (name, line, wildcards, styles)
    require "serialize"

--    check (CallPlugin ("f6812fbbea7ca2d1a7476970", 
--                       "display", serialize.save_simple (styles)))

	display (serialize.save_simple(styles))

end -- chattrigger

so that the Plugin was not calling the plugin. I just skipped the callplugin line and went straight to the source. When I attempted to use Check(display.....) it gave me an error of:

Error number: 0
Event:        Run-time error
Description:  C:\Program Files (x86)\MUSHclient\lua\check.lua:24: bad argument #2 to 'format' (number expected, got nil)

stack traceback:

	[C]: in function 'format'

	C:\Program Files (x86)\MUSHclient\lua\check.lua:24: in function 'check'

	[string "Plugin: Dead_of_Night_Basic"]:7: in function <[string "Plugin: Dead_of_Night_Basic"]:1>
Called by:    Function/Sub: chattrigger called by trigger

Reason: processing trigger "" when matching line: "You gossips (ooc) 'test'"


However, after i remove the check() it works fine for the triggers inside of the plugin. However, the triggers that I made outside of the plugin e.g. the example above, it gives me

Error number: 0
Event:        Run-time error
Description:  C:\Program Files (x86)\MUSHclient\lua\serialize.lua:233: Cannot serialize nil

stack traceback:

	[C]: in function 'error'

	C:\Program Files (x86)\MUSHclient\lua\serialize.lua:233: in function 'save_item_simple'

	C:\Program Files (x86)\MUSHclient\lua\serialize.lua:90: in function 'save_simple'

	[string "Plugin: Dead_of_Night_Basic"]:7: in function <[string "Plugin: Dead_of_Night_Basic"]:1>
Called by:    Function/Sub: chattrigger called by Plugin Dead_of_Night_Basic

Reason: Executing plugin Dead_of_Night_Basic sub chattrigger


I'm open to any help that you may be able to provide so that I can finish this utility plugin.

Thanks,
Australia Forum Administrator #1
Quote:

When I attempted to use Check(display.....) it gave me an error ...


The check function (not Check) is designed for the MUSHclient functions that return error codes - which is most but not all of them. It simply checks if the error code is zero (which is OK) and if not looks up the error number in a table and shows the appropriate error.

It isn't designed to be used with any old function that someone writes.




Quote:

However, the triggers that I made outside of the plugin e.g. the example above, it gives me ...


Can you show an example of doing that please?
Australia Forum Administrator #2
Your function "chattrigger" looks like it is supposed to be called from the trigger (as the trigger script) but the trigger you posted is not calling it that way.

I think you are confusing a couple of different techniques here.
#3
Is there a way to have the TriggerScript call a scriptfunction that's within a Plugin? I didn't think that was possible.

However, if it is, then I can get this working easier.
Australia Forum Administrator #4
Within a plugin triggers (that are in the plugin) can call scripts that are in the same plugin.