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
➜ Bug reports
➜ BroadcastPlugin / OnBroadcastPlugin
BroadcastPlugin / OnBroadcastPlugin
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Mr.lundmark
(51 posts) Bio
|
Date
| Thu 17 Sep 2009 05:11 PM (UTC) |
Message
| If I have this in one of my functions in a python plugin:
world.BroadcastPlugin(100, "hello")
and in another python plugin:
def OnPluginBroadcast (msg, id, name, text):
world.Note("toodles")
and in a third plugin, this time in lua:
function OnPluginBroadcast (msg, id, name, text)
end
then I get these errors:
Script error
World: p
Execution of line 495 column 0
Immediate execution
Traceback (most recent call last):
File "<Script Block >", line 495, in RunPath
world.BroadcastPlugin(100, "hello")
File "<COMObject world>", line 2, in BroadcastPlugin
COM Error: Type mismatch. (0x-7ffdfffb)
Line in error:
world.BroadcastPlugin(100, "hello")
It goes away if I remove the OnPluginBroadcast in the second-python plugin.
Or is it really something that I missed? :) | Top |
|
Posted by
| Mr.lundmark
(51 posts) Bio
|
Date
| Reply #1 on Thu 17 Sep 2009 06:03 PM (UTC) |
Message
| Actually, the Lua-script doesn't even need to be there. If I simply try to call a PluginBroadcast() from one python plugin and catch it in another python plugin, I seem to be getting these errors. | Top |
|
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Reply #2 on Thu 17 Sep 2009 08:37 PM (UTC) Amended on Thu 17 Sep 2009 09:33 PM (UTC) by Worstje
|
Message
| Somehow, MUSHclient, the WSH and the Python scripting engine have a conceptual disagreement about functions being called. I don't know why, but I do know how to solve it! :)
def OnPluginBroadcast (msg, id, name, text):
world.Note("toodles")
return 0
The return 0 makes all the difference. I ran into this with OnPluginSent() and other callbacks that don't require you to return a value, but with Python end up as a requirement due to this quirk. :) | Top |
|
Posted by
| Mr.lundmark
(51 posts) Bio
|
Date
| Reply #3 on Fri 18 Sep 2009 09:24 AM (UTC) |
Message
| Ahhhh... I see, thanks Worstje.
That should definetly be added to the documentation. | 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.
15,626 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top