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
➜ BroadcastPlugin and OnPluginBroadcast giving strange errors
|
BroadcastPlugin and OnPluginBroadcast giving strange errors
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Elin
(13 posts) Bio
|
| Date
| Sun 23 Jul 2006 10:01 AM (UTC) |
| Message
| Hello all:
In one of my plugins, I had originally set a function to broadcast something when it was done, with the intention of having the action set a flag in another plugin. I tried writing something, and it gave me an error, so I tried writing a simple test function to test the activatino of the BroadcastPlugin function.
I have an alias in Plugin2 that activates the following script:
def test1 (name, match, wildcards):
world.BroadcastPlugin(1, "teststring")
In Plugin1, I have the following OnPluginBroadcast function written:
def OnPluginBroadcast (msg, id, name, text):
world.note("Message received.")
Even though these functions look almost exactly like the examples that were given, MUSH is giving me the following error:
Quote:
Error number: -2147352567
Event: Execution of line 206 column 0
Description: Traceback (most recent call last):
File "<Script Block >", line 206, in test1
world.BroadcastPlugin(1, "teststring")
File "<COMObject world>", line 2, in BroadcastPlugin
COM Error: Type mismatch. (0x-7ffdfffb)
Line in error:
world.BroadcastPlugin(1, "teststring")
Called by: Immediate execution
Even weirder, I had it set to world.BroadcastPlugin(1, "test string")
and had OnPluginBroadcast do:
world.note(text)
This ended up with "test string" showing up in my window, but it still gave me the error.
Anyone who has had experience with these functions able to help?
-Elin | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sun 23 Jul 2006 09:20 PM (UTC) Amended on Sun 23 Jul 2006 09:21 PM (UTC) by Nick Gammon
|
| Message
| I see what you mean. It seems the BroadcastPlugin call expects a return code. I got it to work by adding:
... to the end of the function.
I never noticed this before, in VBscript it doesn't seem to care whether you return something or not.
For example:
def OnPluginBroadcast (msg, id, name, text):
world.Note ("msg = " + str (msg))
world.Note ("id = " + id)
world.Note ("name = " + name)
world.Note ("text = " + text)
return 1
|
- 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.
11,446 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top