[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Communication Miniwindow Not Functioning

Communication Miniwindow Not Functioning

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


Posted by Solaobajiuik   (7 posts)  [Biography] bio
Date Fri 07 Oct 2016 12:03 AM (UTC)
Message
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,
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sat 08 Oct 2016 02:52 AM (UTC)
Message
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?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Sat 08 Oct 2016 02:54 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Solaobajiuik   (7 posts)  [Biography] bio
Date Reply #3 on Wed 19 Oct 2016 02:44 PM (UTC)
Message
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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Wed 19 Oct 2016 07:51 PM (UTC)
Message
Within a plugin triggers (that are in the plugin) can call scripts that are in the same plugin.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


13,629 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]