Plugin Enabling/Disabling

Posted by Elin on Mon 17 Jul 2006 06:31 PM — 3 posts, 16,635 views.

#0
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.
Australia Forum Administrator #1
The function is EnablePlugin not PluginEnable.

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

#2
...

Thanks, Nick.