[Xaseco] Cross server chat 0.41 - (on hold) 4.11.2010

Discuss everything about Xymph's Aseco flavoured server control scripts for TM Forever / classic TMN and for TM² Canyon.

Moderators: Xymph, TM-Patrol

reaby
smooth traffic navigator
smooth traffic navigator
Posts: 213
Joined: 02 Jul 2009 21:24
Owned TM-games: TMUF

[Xaseco] Cross server chat 0.41 - (on hold) 4.11.2010

Post by reaby » 26 Apr 2010 21:34

Cross server Chat 0.41

Purpose of the plugin is to provide a chat link between two or more servers. The improved plugin, when done, should not crash xaseco, if the link to other servers fail. The plugin is compatible with custom chat.

Version 0.41
* missing files added

Version 0.4
* added new feature: webchat

Image

Somewhat working version
Working version can be obtained here: Download version 0.41

Chat commands

/xlink -> will popup list of external servers, if you click on servername it will show all players connected to the server.
/pmx [login] [message] -> will try to send a whisper to login over linked network. There's no check what-so-ever, so no error message if player wasn't found.

Known Issues
* telnet session must be initialized by pressing enter once or plugin will halt.
Last edited by reaby on 09 Nov 2010 21:05, edited 10 times in total.

User avatar
Ant
TM-Patrol
TM-Patrol
Posts: 1845
Joined: 01 Dec 2007 17:04
Owned TM-games: TMN, TMUF, TM Wii
Location: London, England
Contact:

Re: [Xaseco] Cross server chat plugin - !!!EXPERIMENTAL BETA

Post by Ant » 27 Apr 2010 00:11

From looking at this (I don't think its implemented) I reckon a good idea would be to have the messages from players on the 1st server to be in a particular colour, and the messages from players on the 2nd server to be in another colour.

That way you won't get confusion in some areas of conversation, what dya reckon ?

User avatar
TheM
Pit Crew
Pit Crew
Posts: 286
Joined: 25 Feb 2009 16:43
Owned TM-games: TMU(F), TMN(F), TM2
Location: Brabant, Netherlands
Contact:

Re: [Xaseco] Cross server chat plugin - !!!EXPERIMENTAL BETA

Post by TheM » 27 Apr 2010 06:46

Reaby, first of all nice idea. :1010
But I don't like the way you've scripted it.
Because what you're doing now is everytime someone wants to cross-server chat...
... a new connection is made.

You could better make the connection in the "onStartup" part, and use it in de "onChat" part.

Just a suggestion, but I think that would be better ;)

Code: Select all

<?php
/**
  * CROSS SERVER CHAT
  *
  * Provides parsing & custom look & filtering to chat & CROSS SERVER CHAT!
  * Created by Reaby
  * Modified by TheM
  *
  */

Aseco::registerEvent('onStartup',      'cChat_onStartup');
Aseco::registerEvent('onChat',         'cChat_chat');

function cChat_onStartup ($aseco, $command) {
	global $customChat;
	global $chat_client;

	// CROSS SERVER CHAT SETTIGNS, PUT TARGET SERVER HERE!
	$ip = 'xxx.xxx.xxx.xxx'; 
	$port = '5000';         
	$AuthLogin = 'SuperAdmin';
	$AuthPassword = 'SuperAdmin';

	$chat_client = new IXR_Client_Gbx;
                
	if (!$chat_client->InitWithIP($ip, $port,100)) {
		trigger_error("[".$chat_client->getErrorCode()."] ".$chat_client->getErrorMessage());
	}
	if (!$chat_client->query('Authenticate', $AuthLogin, $AuthPassword)) {
		trigger_error("[".$chat_client->getErrorCode()."] ".$chat_client->getErrorMessage());
	}   

	$aseco->client->query('ChatEnableManualRouting', true);  // do the trick to disable on game chat :)
	$customChat = new customChat();
} // cChat_onStartup

class customChat {
	public $player;
} // customChat

function cChat_chat($aseco, $command) {
	global $customChat;
	global $chat_client;

	if($command[0] != $aseco->server->login) {  // check if chat text is really from player, not from server.
		$aseco->client->query('GetPlayerInfo', $command[1]);    // get nickname instead of login...
		$info = $aseco->client->getResponse();     //
		$nick = $info['NickName'];   // assign nickname from data.
		$login = $command[1];
		$chat = $command[2];  // we want to process chat text later, so save it to temp variable
		$timestamp = date("H:i",time()); // timestamp
		if ($command != '' && substr($command[2], 0, 1) != '/' ) {  // check is command is ment to be server releated
			//  this will compose the message to game, yellow text will be replaced with white here.
            
			//$message =  "\$n" . $timestamp . "\$z\$s " . $nick . "  \$z\$s\$fff" . $chat;   // <-- uncomment this if you want to use timestamps
			//$message =  "\$z\$s".$nick . "  \$z\$s\$fff" . $chat;                             // <-- uncomment this if you want white text
            $message =  "\$z\$s[".$nick ."\$z\$s] " . $chat;                        // <-- uncomment this if you want normal trackmania text
                   
			$aseco->client->query('ChatSendServerMessage', $aseco->formatColors($message));  // send chat to game
			$chat_client->query('ChatSendServerMessage', ">>> ".$aseco->formatColors($message)); // send chat to cross server
		} else {
			$customChat->Player = $command[1];
			return; // return if command is server releated, else it will get executed twice.
		}   
	} else {   // and server messages are shown
          $message = $command[2];
          $aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $customChat->Player);
 	}
} // cChat_chat
?>

reaby
smooth traffic navigator
smooth traffic navigator
Posts: 213
Joined: 02 Jul 2009 21:24
Owned TM-games: TMUF

Re: [Xaseco] Cross server chat plugin - !!!EXPERIMENTAL BETA

Post by reaby » 27 Apr 2010 11:37

Yeah, I didn't manage to get xaseco start with gbx remote at onstartup... dunno why.. maybe i had some glitch on it.. need to test more.

reaby
smooth traffic navigator
smooth traffic navigator
Posts: 213
Joined: 02 Jul 2009 21:24
Owned TM-games: TMUF

Re: [Xaseco] Cross server chat plugin - !!!EXPERIMENTAL BETA

Post by reaby » 27 Apr 2010 11:56

XXX-Ant wrote:From looking at this (I don't think its implemented) I reckon a good idea would be to have the messages from players on the 1st server to be in a particular colour, and the messages from players on the 2nd server to be in another colour.
Yeah, I change it to have normal chat as yellow and the other servers chat as white. At the moment there is >>> before cross server chat message.

I'll test things this evening. If i can't get the onstartup thing working, then i do a trigger command for start/enable & disable cross server chat, maybe that's best approach.

I was so excited last night when i got the plugin actually to work, that i had to release the code without further testing :)

Xymph
Pit Crew
Pit Crew
Posts: 5650
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: [Xaseco] Cross server chat plugin - !!!EXPERIMENTAL BETA

Post by Xymph » 27 Apr 2010 12:03

reaby wrote:Yeah, I didn't manage to get xaseco start with gbx remote at onstartup... dunno why.. maybe i had some glitch on it.. need to test more.
A lot of things aren't initialized yet at onStartup. Better use onSync for this.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

reaby
smooth traffic navigator
smooth traffic navigator
Posts: 213
Joined: 02 Jul 2009 21:24
Owned TM-games: TMUF

Re: [Xaseco] Cross server chat plugin - !!!EXPERIMENTAL BETA

Post by reaby » 27 Apr 2010 14:10

Xymph wrote:
reaby wrote:Yeah, I didn't manage to get xaseco start with gbx remote at onstartup... dunno why.. maybe i had some glitch on it.. need to test more.
A lot of things aren't initialized yet at onStartup. Better use onSync for this.
Thanks, it did the trick!

TecnoTurbo
wheelbarrow operator
wheelbarrow operator
Posts: 18
Joined: 25 Aug 2008 15:32
Owned TM-games: TMNF

Re: [Xaseco] Cross server chat plugin - 0.1 (update 27.4.201

Post by TecnoTurbo » 27 Apr 2010 21:11

Uhm, you could implement something like..
If no errors connecting via XMLRCP then enable manual routing true..
ELSE
enable manual routing false..

If i'm not wrong, this:
Beware, chat may become unusable if one of the servers is offline.
should be avoided... no?

EDIT:
And...something to make a CROSS CHAT GROUP? Among 2/3/4 servers..

reaby
smooth traffic navigator
smooth traffic navigator
Posts: 213
Joined: 02 Jul 2009 21:24
Owned TM-games: TMUF

Re: [Xaseco] Cross server chat plugin - 0.1 (update 27.4.201

Post by reaby » 27 Apr 2010 22:07

TecnoTurbo wrote:Uhm, you could implement something like..
If no errors connecting via XMLRCP then enable manual routing true..
ELSE
enable manual routing false..
If there's now error with XMLRCP, xaseco will not start.
TecnoTurbo wrote: EDIT:
And...something to make a CROSS CHAT GROUP? Among 2/3/4 servers..
Cross chat group... doable, but well.. i guarantee nothing.
Beware, chat may become unusable if one of the servers is offline.
I can't test the plugin properly when I code it, because i don't have second computer for another trackmania client to test it with... so i have done this with help of a friend who is sitting on testing server, while i'm on the other server and chatting when i ask him to write something with msn.

jamie_macdonald
TM-Patrol
TM-Patrol
Posts: 1612
Joined: 10 Jul 2008 19:48
Owned TM-games: TMUF, TMNF, TMS
Manialink(s): ET
Location: London, UK
Contact:

Re: [Xaseco] Cross server chat plugin - 0.1 (update 27.4.201

Post by jamie_macdonald » 28 Apr 2010 12:52

nice try reaby, very nice of you to share, i will find a use for this one day i am sure :)

jouko100
speedy pilot
speedy pilot
Posts: 375
Joined: 10 Mar 2007 09:33
Location: finland
Contact:

Re: [Xaseco] Cross server chat plugin - 0.1 (update 27.4.201

Post by jouko100 » 29 Apr 2010 13:25

nice plugin.I can use it.

nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

Re: [Xaseco] Cross server chat plugin - 0.1 (update 27.4.201

Post by nocturne » 29 Apr 2010 18:40

Why not have the option to not use manual chat routing? If the custom formatting isn't desired/used on the original server (and can be displayed on second server as you wish), then it'd cut the work down by half.

Also, if there is an 'on crash' event in Xaseco (sure there is), you might as well code in a function to disable manual routing in the event of xaseco crashing so normal chat is restored.

Xymph
Pit Crew
Pit Crew
Posts: 5650
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: [Xaseco] Cross server chat plugin - 0.1 (update 27.4.201

Post by Xymph » 29 Apr 2010 18:58

nocturne wrote:Also, if there is an 'on crash' event in Xaseco (sure there is)
There isn't, but I suppose it might come in handy in some situations, so the next release will add an onShutdown event.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

reaby
smooth traffic navigator
smooth traffic navigator
Posts: 213
Joined: 02 Jul 2009 21:24
Owned TM-games: TMUF

Re: [Xaseco] Cross server chat plugin - 0.1 (update 27.4.201

Post by reaby » 30 Apr 2010 08:24

nocturne wrote:Why not have the option to not use manual chat routing? If the custom formatting isn't desired/used on the original server (and can be displayed on second server as you wish), then it'd cut the work down by half.
Well.. on a request next my released revision will have this as an option, if somebody isn't first :)
It's possible to gain diffierent chatting colors for remote server without it too.
nocturne wrote: Also, if there is an 'on crash' event in Xaseco (sure there is), you might as well code in a function to disable manual routing in the event of xaseco crashing so normal chat is restored.
If Xaseco crashes == shutdowns the chat will revert to normal. I've tested this earlier with custom chat plugin, so chatting will not stop.

But what I haven't tested is if the connection to server1 to server2 disconnects, as server2 goes down.. does the server1 chat begin to lag / come unusable due the fact that XMLRCP has long timeouts...

nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

Re: [Xaseco] Cross server chat plugin - 0.1 (update 27.4.201

Post by nocturne » 01 May 2010 07:43

reaby wrote:But what I haven't tested is if the connection to server1 to server2 disconnects, as server2 goes down.. does the server1 chat begin to lag / come unusable due the fact that XMLRCP has long timeouts...
Nope... what happens is Xaseco will crash due to a client timing out, even if it's not the original one.. at least that's my experience with my original Aseco version. Adding in a global var to identify the client's connected state upon startup and using it to disable sending chat to a nonexistant client may help out if the end-user has the xaseco start script set to automatically restart.
reaby wrote:Well.. on a request next my released revision will have this as an option, if somebody isn't first :)
It's possible to gain diffierent chatting colors for remote server without it too.
Well, currently the plugin doesn't change the display of the original server's chat by default, so there isn't really any point of doubling the work by enabling manual chat routing anyways. Of course the second server's display can be edited as wished without it (as I stated). In the end, it'd all be more sensible with a simple config file at least, or at least by putting all the relevant config vars in one spot in the plugin...

Post Reply