Access Global Timer from plugin

Posted by Manacle on Tue 04 Jan 2011 07:32 AM — 2 posts, 12,559 views.

#0
I'm trying to enable/disable global timers from a plugin based upon certain circumstances, but I can't seem to access them.

When I run '.Note(IsTimer("TestTimer"))' from my input bar, I receive the response that I expect - eOK.

When I call a function in my plugin with the same line (minus the scripting prefix, of course), I receive indication that that timer doesn't exist (return code 30017).

Is it possible to access a timer I've manually added to my preferences from the scope of my plugin?
Australia Forum Administrator #1
No, not easily. Plugins are supposed to be independent of the main script, so if you uninstall them, or send a copy to a friend, there aren't "parts missing" because they rely on timers and triggers in the main world.

The easiest thing to do is simply copy the timer into the plugin. Hit the "copy" button (not the copy menu item) on the timers list in the preferences dialog to get a copy. See here for more details:

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Then open the plugin .xml file, and in an appropriate place (eg. not inside the middle of a trigger) paste the resulting timer XML. Then you now have the timer inside the plugin.