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 ➜ Python ➜ Plugin Enabling/Disabling

Plugin Enabling/Disabling

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


Posted by Elin   (13 posts)  Bio
Date Mon 17 Jul 2006 06:31 PM (UTC)
Message
Hello,

I am scripting in Python, and I wrote a plugin that I want to be able to turned on and off. To try to do this, I wrote a setof alises in another plugin to do this:

<alias
script="enable_forging"
match="^loadforging$"
enabled="y"
regexp="y"
sequence="100"
>
</alias>

<alias
script="disable_forging"
match="^killforging$"
enabled="y"
regexp="y"
sequence="100"
>
</alias>

Which run these scripts:

def enable_forging (name, match, wildcards):
world.PluginEnable("da0205586e9980a45150159c", true)

def disable_forging (name, match, wildcards):
world.PluginEnable("da0205586e9980a45150159c", false)


In the plugin that I want to be able to turn on/off, I have the following:

def OnPluginEnable():

world.note("Forging plugin enabled.")
world.send("")

def OnPluginDisable():

world.note("Forging plugin disabled.")
world.send("")

However, when I try to use my killforging or loadforging alises, I get this error:

Traceback (most recent call last):
File "<Script Block >", line 145, in disable_forging
world.PluginEnable("da0205586e9980a45150159c", false)
File "C:\Python24\Lib\site-packages\win32comext\axscript\client\pyscript.py", line 144, in __getattr__
return getattr(self._scriptItem_.dispatchContainer,attr)
File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 496, in __getattr__
raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: world.PluginEnable


It looks like something is wrong with the Python library itself (maybe because I'm using Python 2.4?). Is there any way I can get this to work? Also, I'm not even sure my OnPluginEnable functions are okay. Couldn't find an example for Python.

How can I fix this? Thanks.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 17 Jul 2006 09:55 PM (UTC)
Message
The function is EnablePlugin not PluginEnable.

See: http://www.gammon.com.au/scripts/doc.php?function=EnablePlugin


- Nick Gammon

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

Posted by Elin   (13 posts)  Bio
Date Reply #2 on Mon 17 Jul 2006 10:53 PM (UTC)
Message
...

Thanks, Nick.
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.


14,616 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.