Register forum user name Search FAQ

Gammon Forum

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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Plugins ➜ plugins dont stay disabled after quit?

plugins dont stay disabled after quit?

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


Posted by Arana   (20 posts)  Bio
Date Thu 26 Aug 2010 06:56 PM (UTC)
Message
if i disable any plugin from the world plugins GUI, then save the world, load the world again, the plugins are enabled again, this happens not only to me but to other friends also, is this how it is supposed to be?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 26 Aug 2010 09:02 PM (UTC)

Amended on Thu 26 Aug 2010 09:03 PM (UTC) by Nick Gammon

Message
It doesn't automatically do that, because it would need to save the disabled state somewhere.

However I have added it to some plugins.


First, make sure in the plugin header that it saves its state like this:


<plugin
   name="Aardwolf_Helplist"
   author="Nick Gammon"
   id="8a8e24942fe60f88bcaf1807"
   language="Lua"
   purpose="Makes a helper window with hyperlinks"
   date_written="2008-06-26 12:21:22"
   requires="4.29"
   version="1.0"
   save_state="y"
   >


The rest is probably different, but make sure that the "save_state" line is there.

Then add a function to the plugin that remembers, when its state is saved, whether or not it is disabled:


function OnPluginSaveState ()
  SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
end -- OnPluginSaveState


Then when the plugin loads we check that "enabled" variable, and if false, call EnablePlugin to disable ourselves right now:


function OnPluginInstall ()

  -- any initialization here ...

  if GetVariable ("enabled") == "false" then
    ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.")
    check (EnablePlugin(GetPluginID (), false))
    return
  end -- they didn't enable us last time
  
end -- OnPluginInstall


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Arana   (20 posts)  Bio
Date Reply #2 on Thu 26 Aug 2010 09:27 PM (UTC)
Message
thank you, that will do it, even tho i have to edit all the plugins xD


hmmm
could it be possible to disable the plugins using another plugin? that way we could write a "plugin manager plugin"
that and only that one would need to keep record of what lpugins should be disabled and then turn them off or on accordingly.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 26 Aug 2010 11:06 PM (UTC)
Message
Ah yes I think you could do that. You would need to get the plugin list (GetPluginList) and using the resulting list do the


GetPluginInfo (id, 17)


for each one, and then save that as a variable (eg. plugin ID concatenated with "enabled").

Then when the plugin manager loads it could disable the other plugins as required.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


12,437 views.

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

Go to topic:           Search the forum


[Go to top] top

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