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.
Entire forum
➜ MUSHclient
➜ General
➜ Handling same trigger with more than one instance of a plugin
Handling same trigger with more than one instance of a plugin
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Kovarid
(15 posts) Bio
|
Date
| Mon 08 Dec 2014 06:47 AM (UTC) |
Message
| This is a little tough to explain, so bare with me.
I am using a version of Nick's Chatgrabber miniwindow plugin, from http://www.gammon.com.au/forum/?id=10728.
I have modified it for a MUSH, so that you can select which custom channels you want to show up in your window, but it uses a generic trigger "<*> *", which is then passed through a function to determine if it's a channel we want in our window.
If it is a channel we want, great, we display it in the miniwindow, and the trigger omits it from the output window due to it's options.
The tricky part is, I'm finding many users want to clone the plugin with a new pluginID, so they can have more than one miniwindow and have different channels going to different windows.
If each uses the same trigger, but may or may not want that line depending on if the channel is enabled by the user... so if it doesn't want the line, the expected behavior is for the line to stay in the output window. However, since the trigger is set to omit from output, I need to echo it back manually.
If more than one instance of the plugin is running, and more than 1 window doesn't want to handle channel_x, I'll get more than one manually-echo'd copy of the line in the output window.
I'm kind of out of ideas and looking for input on how to handle this.
I'm thinking maybe adding some checks to see if more than one instance is loaded, and having the 'main' instance of the plugin handle all the triggers and passing it around using CallPlugin(), and the slaves will respond true or false if they wanted that line. If that slave doesn't want it, check others. If we're at the last slave, and no one wants it, go ahead and echo it back to the output.
But there may be an easier way to handle this.
Thanks in advance! | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #1 on Mon 08 Dec 2014 07:57 AM (UTC) Amended on Mon 08 Dec 2014 07:58 AM (UTC) by Fiendish
|
Message
|
Quote: I'm thinking maybe adding some checks to see if more than one instance is loaded, and having the 'main' instance of the plugin handle all the triggers and passing it around using CallPlugin(), and the slaves will respond true or false if they wanted that line. If that slave doesn't want it, check others. If we're at the last slave, and no one wants it, go ahead and echo it back to the output.
That's a fine way to do it. You could also split the echoing part off into its own plugin, but it won't necessarily be easier depending on your user interface. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Kovarid
(15 posts) Bio
|
Date
| Reply #2 on Thu 11 Dec 2014 02:25 AM (UTC) Amended on Thu 11 Dec 2014 04:06 AM (UTC) by Kovarid
|
Message
| Okay, so here I am so far with this modified plugin.
For some reason the serialized table is not being loadstring()'d properly in message_handler()
Using some Note()'s to show debug output, I can see it was received properly, but it's not being saved to a table properly.
Can anyone point me in the right direction as to what I'm doing wrong?
The main bits that are causing issues are in message_handler()
Received communication from master: mystyles = {
[1] = {
textcolour = 9079434,
backcolour = 986895,
length = 27,
style = 1,
text = "<OOC> mar'Qon says, "llala"",
},
}
{
}
CallPlugin: 0
The plugin itself is too big to post here, so here it is on pastebin:
http://pastebin.com/AysSApzF
Edit: Nevermind! Using setenvf() fixed the problem. | 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.
10,867 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top