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

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  Plugin broadcast.
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Plugin broadcast.

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


Pages: 1 2  

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Tue 24 May 2005 01:40 PM (UTC)
Message
Is there anyway to make something like a "Broadcast" command? For example, a speedwalk plugin could broadcast "Destination reached", and other plugins that would have the OnPluginBroadcast event would read the message and act accordingly. Currently I can send something to the world and have the other plugin trigger on that, but that is inefficient and I would have to change my plugin (If I wanted to use plugin A but not plugin B, the broadcast would be transparent and all plugins would just ignore the broadcast). I suppose it is something like DDE for plugins...

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by tobiassjosten   Sweden  (79 posts)  [Biography] bio
Date Reply #1 on Tue 24 May 2005 02:43 PM (UTC)
Message
Do it with aliases and world.Execute()? It's how I've solved it.

Simplicity is Divine | http://nogfx.org/
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #2 on Tue 24 May 2005 02:45 PM (UTC)
Message
That'll still send to world if the plugin that receives the information isn't installed though...

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #3 on Tue 24 May 2005 02:48 PM (UTC)
Message
Oh, also, CallPlugin isn't a good way for this because there might be many plugins that could use that info. A Broadcast function would enable people to write plugins that cooperated with other plugins without the need to modify the latter.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #4 on Tue 24 May 2005 06:54 PM (UTC)

Amended on Tue 24 May 2005 07:29 PM (UTC) by Flannel

Message
UDP? Although that gets messy.

Or you could write a handler plugin. All of your (previous) execute commands could be prefixed with a string (so your new plugin can catch commands for it) and then inside that plugin you could dish out the information to other plugins (have each plugin register with the handler, or have the handler figure out callable procedures of each new plugin).

This seems... familiar...
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3931

Something LIKE that. Although I agree, having unknown IDs is a good thing. You could broadcast a 'Kill' message, and have all your plugins do whatever they should do once something dies (except the handler would worry about everything).

That seems very useful. Especially once a framework has been setup (once you have a plugin listening for a death message or whatever), it can be easy to add a set of triggers for a particular server (whether those triggers are on the world level, or on the plugin level would be irrelevant).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #5 on Tue 24 May 2005 07:29 PM (UTC)

Amended on Tue 24 May 2005 07:34 PM (UTC) by Flannel

Message
Actually, You could just prefix all of your executes with something, and then have one generic alias that catches those, and doesn't send anything (with a high sequence).
Just a fall through that throws the command out.

The prefix is only needed because it means you only need one alias to toss it out.
I suppose we could ask nick for an option (either a flag, or a new sendto) that acts as an execute command, but never, under any circumstances, gets sent to the server, but that seems like a lot of work, for not a lot of gain. (Unless there are other advantages?)

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #6 on Tue 24 May 2005 07:48 PM (UTC)
Message
UDP would be too messy, yes, especially if the port was in use... I also recall the handler plugin, although I would prefer if I didn't have to use one. I think it would be a nice feature and relatively easy for Nick to add, and many people could benefit from it. The execute approach doesn't work very well because I really don't want to have to change the sender plugin to that extent. If there was a broadcast command, plugins could broadcast "Pluginname: Dest_reached" or something and not care if anyone was listening, they could do it just in case. I believe this is a very useful feature, since the plugin architecture allows for (and encourages) plugins to cooperate to do one job, but there aren't really any universal functions to help plugins do that.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #7 on Tue 24 May 2005 07:56 PM (UTC)

Amended on Tue 24 May 2005 07:59 PM (UTC) by Flannel

Message
How would a listener listen then?

Theyd have to be listening for specific messages (with an arbitrary name prefix)? or just for messages from certain plugins?

You can broadcast with execute, and include a null route in your own plugin, if you're going to include the plugin name in each message. Although I think including a plugin name (as a prefix) is a bit clumsy, since you'll be forcing each plugin to know which other plugins it needs to listen to (or have things that listen for *:* if theyre listening for multiple messages from multiple plugins, which seems like a lot of extra computation with all the other messages and other plugins).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #8 on Tue 24 May 2005 08:01 PM (UTC)
Message
There would be an OnPluginBroadcast function that returned the broadcast text. The plugin name thing is just an example, you could just broadcast "Dest_reached" or whatever. Also, the only plugin that has to know the plugin name to listen to is the plugin you are making, and you probably already know what you want to listen to. Using execute would be slower, since you would have to evaluate all the aliases, and generally it would pass through several systems it doesn't need to.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #9 on Tue 24 May 2005 10:22 PM (UTC)
Message
Come to think of it, this would allow for plugin separation. For example, I have a plugin to fight that also heals. If this was implemented I could have a healing plugin that broadcast "Done healing", the fighting plugin would receive that and resume fighting. I could then remove the fighting plugin and replace it with another plugin that worked off healing without changing any of the code. Another user could make one plugin that worked with my healing one without having to change mine.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #10 on Tue 24 May 2005 11:50 PM (UTC)

Amended on Tue 24 May 2005 11:54 PM (UTC) by Flannel

Message
Yeah, it would allow for plugins to become modular. Like I was saying earlier (hmm, maybe I deleted it, no there it is, at the end), you can have a set of plugins that does all of the stuff behind the scenes, and then you just need to include a plugin to localize it to a server (triggers to catch things, and skeleton command aliases to reply).

Problem with making it a plugin callback is that then we would force it to be a plugin only thing.
Having an interface with the world would be handy so I could have my aforementioned localization stuff be in my world file, instead of my plugin.
Actually, I suppose the localization would be better suited for a plugin, since chances are you'd be distributing it, but you get the idea.

I know this is going to be a great improvement for plugins, I'm just not sure that it should become its own message system.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #11 on Tue 24 May 2005 11:57 PM (UTC)
Message
Well, as for the world, the callback could be added, like the rest of the callbacks. Also, "message system" makes it sound more complicated that it is, it's just a loop that does "CallPlugin 'x', 'OnPluginBroadcast', data".

By the way, the plugin implementation is:

Sub sbBroadcast(strData)
    Dim lstPlugins
    lstPlugins = GetPluginList
    If Not IsEmpty (lstPlugins) Then
      For Each plPlugin In lstPlugins
         CallPlugin GetPluginInfo (plPlugin, 7), "OnPluginBroadcast", strData
      Next
    End If
End Sub


But it's easy to implement, useful and having it rely on one plugin that would mess everything up if it wasn't installed is too big a price to pay.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #12 on Wed 25 May 2005 (UTC)
Message
I feel that this feature is not only useful, but essential for having plugins that work as intended, and I'm surprised noone suggested it before. I think plugins were designed and are supposed to work like this.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Tsunami   USA  (204 posts)  [Biography] bio
Date Reply #13 on Wed 25 May 2005 02:06 PM (UTC)
Message
I definately agree with Poromenos. Back when I was getting started with MC, I expected that the plugins would be able to work like this so I made mine very modular. One for healing, one for fighting, one for anti-theft, etc... Then I started to realize however that all of them depended on some of the same constants (I play IRE, so balance, eq, etc..) It was inefficient to have each plugin try and catch these and react to them on their own, especially since then they would be competing with each other for execute precendence instead of working together. In the end, I just solved it by putting everything in one big plugin so they could share variables etc... This idea would go a long way towards a more modularized approach, and I especially like the idea of being able to work with other peoples plugins in a much more 'oop' way if you like.
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #14 on Fri 17 Jun 2005 07:43 PM (UTC)
Message
I'm beginning to worry about Nick... He hasn't posted in a month and he used to check the forums every day... Anyone know where he is?

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[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,830 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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 FutureQuest]