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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  ChatMessage not working

ChatMessage not working

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 Sat 23 Oct 2010 09:52 AM (UTC)
Message
Hey!

I've set up a chat connection using
ChatAcceptCalls(23)

and

ChatCall("localhost", 23)

Once that is done, I try to iterate through all the connection id's we have and:
ChatMessage(id, 7, "Test")

That message is never received on the other user's OnPluginChatMessage. I'm currently connecting to my own computer from one mushclient to another. I'm using python-scripting for this.
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Reply #1 on Sat 23 Oct 2010 09:54 AM (UTC)
Message
I've tried connecting from one computer to another, still not working.
[Go to top] top

Posted by LezChap   (36 posts)  [Biography] bio
Date Reply #2 on Sat 23 Oct 2010 05:23 PM (UTC)
Message
Is your router/firewall blocking it?
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Reply #3 on Sat 23 Oct 2010 06:39 PM (UTC)
Message
It shouldn't, since it allows connections to go through. It also allows disconnect-messages to go through. Everything is set up fine except the passing of messages.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Sat 23 Oct 2010 07:55 PM (UTC)
Message
You found a bug, introduced in version 4.62 which had a lot of code cleanups for plugins.

Due to the way it was calling the plugins it assumed that your attempt to send a message was being rejected. You may have also noticed that even without using plugins no messages were appearing when you started chat sessions.

Fixed, I hope, in version 4.65

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Reply #5 on Sun 24 Oct 2010 07:11 AM (UTC)
Message
I think you managed to solve the bug Nick, awesome!

However, directly afterwards I think I found another bug.

My client (not the server) crashes upon connecting to the server.

I can actually see the log though:
Calling server at 127.0.0.1 port 23
Session established to localhost.

And then it crashes :/

Want me to supply the code?
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Reply #6 on Sun 24 Oct 2010 07:16 AM (UTC)

Amended on Sun 24 Oct 2010 07:17 AM (UTC) by Mr.lundmark

Message
I narrowed down the crash.

It's when I add this code:


def OnPluginChatDisplay(message, text):
	world.Note("OnPluginChatDisplay, message: " + str(message) + " text : " + str(text))
	return True
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Reply #7 on Sun 24 Oct 2010 07:23 AM (UTC)
Message
OnPluginChatMessage seems to work much better though.
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #8 on Sun 24 Oct 2010 12:11 PM (UTC)
Message
Try returning 0, or alternatively, 1.

Something in combination with Python, MUSHclient and the WSH means random errors if you return certain values. For example, in the past I have experienced crashes when not sending a return value back, but setting an explicit 0 return magically fixed it.

Whether it is a bug in Python, a bug in MUSHclient, or some weird no-mans-land of developers reading the APIs differently, I don't know, but that might very likely fix it.

But for now, try to stick to ints. And strings for callbacks wanting strings back.
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Reply #9 on Sun 24 Oct 2010 03:09 PM (UTC)
Message
Yeah that seems to solve it.

I don't understand why one function works with booleans while the other require ints?
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Sun 24 Oct 2010 08:01 PM (UTC)
Message
The partial answer is that the hard-coded calls use the type definitions in the .ODL file, for example:


[id(188)] long ChatGroup(BSTR Group, BSTR Message, BOOL Emote);


Now in this case I presume Python would enforce that you get back a long and not something else.

But the plugin callbacks use a "generic" caller (one that takes a VARIANT result I think) so they are more accepting of the data type you return. However I think Python still requires *some* sort of returned result, whereas other script languages may default to a NULL variant if you don't supply anything explicitly.

To be honest, I find the WSH interface quite confusing. Finding documentation on it is hard enough.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


25,645 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]