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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Combination of plugins, scripts and triggers. Where do I put common parts?

Combination of plugins, scripts and triggers. Where do I put common parts?

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


Posted by Somegirl   (33 posts)  [Biography] bio
Date Mon 02 Aug 2004 08:50 PM (UTC)
Message
Okay, so I am building my system to be as streamlined and modular as possible. Speed is an important consideration as well. I am working on a curing module, an autosipper, an illusion detection module, and hope to create more. I know that some of these are available, but I have found writing them myself makes things easier for me in the long run. I want to use the completed items as plugins.
I have triggers that are common to all parts of my system. Like a trigger to check for balance, for instance. (i.e. 'you have recovered balance on all limbs') My question is should I put that trigger into each part of the system? Should I just pile the entire system together in one huge plugin or script? Can I just keep those sorts of triggers in the world file and leave them out of the plugins? What is the best way to do this?
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #1 on Tue 03 Aug 2004 02:45 PM (UTC)
Message
I tend to just duplicate the triggers in each plugin. Not so efficient, but it keeps your plugins working well as standalone items... Something that may be important if you ever plan to distribute your works of art to other people.

If you really detest duplication, then you could setup the plugins to interact with each other. There are a few methods of doing this, but the most obvious is using the MUSHclient function "CallPlugin".

http://www.mushclient.com/scripts/function.php?name=CallPlugin

Another way might be to World.Execute out a string, and in a separate plugin, you have an alias that matches that string, and then acts how you wish.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Somegirl   (33 posts)  [Biography] bio
Date Reply #2 on Tue 03 Aug 2004 10:46 PM (UTC)
Message
The way I understand it, triggers are the biggest problem in a fast system. When they try to match, your system goes through all of your triggers to match output. So I wondered if it would make it faster to put all the common triggers and timers and such in the main world script and then put all the other stuff in plugins. Or maybe make a plugin with the common stuff and then use the callback?
What do you think? Is it worth the work?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #3 on Tue 03 Aug 2004 11:28 PM (UTC)
Message
If you really dont feel like duplicating triggers, put them in a plugin. That way when/if you ever decide to distribute it, you wont have to have them edit their script file. And it'll be easier to code everything with plugins now, than to code it in the main script, and then change it all later. You'll also be able to check with your extension plugins if the core plugin is installed, and thatll help too with distribution.

You can check the time it takes for the triggers to execute in the world info. (Game > configure > info) Underneath where it has all the triggers, it will tell you just how long (or how short, in most cases) it took proccessing everything. Youll notice that it is extremely short, and unless you have a whole lot of triggers to duplicate, it wont make a huge difference.

I suppose it depends on how you plan on using it, if you want it to be completely modular, duplicate triggers, if everything already depends on other things, then youre probably better off going with a core plugin with peripherals, since theyll need a few pieces to have things work anyway.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Thu 05 Aug 2004 09:04 PM (UTC)
Message
I would put common stuff like recovery triggers into their own plugin. Are they supposed to affect other plugins too? If so, using the world.Execute trick will let you call one plugin from another. Or, use CallPlugin.

In terms of speed, being in a plugin is just as fast as being in the main world. Probably the slowest would be to duplicate the same thing in each plugin, as that is then causing it to be evaluated more than once.

- 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.


16,940 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]