[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  BroadcastPlugin / OnBroadcastPlugin

BroadcastPlugin / OnBroadcastPlugin

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


Posted by Mr.lundmark   (51 posts)  [Biography] 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? :)
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] 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.
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] 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. :)
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] 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.
[Go to top] 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.


13,967 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]