Controlling chat-functionality completely with scripts?

Posted by j0nas on Mon 29 Sep 2003 02:53 PM — 4 posts, 20,508 views.

#0
I'd like to be able to control the chat-functionality of MUSHclient entirely using scripts, in this case Perlscript. I'd like to be able to remove any chat-output from the main window, and have it all go through my script before being displayed to the user.

What I'm trying to accomplish with this is a connection with an external Java-application I've written, allowing the Java-app to take over some of the nastier parts of my script, the parts that are becoming too complicated to work well with the blocking nature of scripts in MUSHclient. I'd like my script to be able to send data to other chat-users, and in return process the data returned from these users, all without bothering the user at the keyboard with more than the output the script decides he needs to see.

I've been looking at what's available right now, and either I'm misunderstanding the scripting-support mentioned in http://www.mushclient.com/mushclient/chat.htm , or this can't be done right now.

Any tips would be appreciated. :)
#1
Update, these are some functions I'm trying to use to 'mute' the chat-output to the text-window. They're not working at all, perhaps I'm doing something wrong?


sub OnPluginChatMessage {
	my ($id, $message, $text) = @_;
	return 0;
}

sub OnPluginChatDisplay {
	my ($message, $test) = @_;
	return 0;
}


Furthermore, the Java-application mentioned previously is already written, and will establish communication over the zChat-protocol without any hassle. It sends and recieves information, all that's left is the perlscript-backend for MUSHclient, and I'll be able to pull off some amazing things. :) If the script-part starts working semi-decently, I'll be sure to post the Java-source under the Tips & Tricks for those interested, with Nick's permission.
Australia Forum Administrator #2
You can totally control chat with scripting. It was written to do that. See:

http://www.gammon.com.au/forum/?bbsubject_id=1692

I tested your script:


sub OnPluginChatDisplay {
	my ($message, $test) = @_;
	return 0;
}


It worked as advertised - the message did not appear in the output window. However it must be in a plugin (it is a plugin callback) - it won't work in a regular script file.
#3
Yes, doing it in a plugin works perfectly, thanks.