[XAseco] Switch Server Plugin 1.0 UPDATE 1.08

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

Moderators: Xymph, TM-Patrol

Post Reply
SaKrifeD
cyclist
cyclist
Posts: 43
Joined: 07 Jan 2008 16:56
Owned TM-games: TMU, TMN

[XAseco] Switch Server Plugin 1.0 UPDATE 1.08

Post by SaKrifeD » 26 Jan 2009 19:32

Hey,

Version 1.0 - finished ;)

Changelog paradies ;)

Added two new events
Aseco::registerEvent('onRestartChallenge', 'sakswitch_writeInfo');
Aseco::registerEvent('onRestartChallenge', 'sakswitch_on');

Changelog 10
- click on button to get more information like current track & players
- join link moved to more information
- config in front of all scripts
- choose just one directory on your root and CHMOD 777

Changelog 03
- choose between: show always / hide at end of race

Changelog 02
~ new style
~ easy to configurate
~ add so much server you want
~ wrong maxplayer count, like -240, changed to ??


How it works:
If a player joins or leave the server the plugin write actual information in a txt-file.
Every second the server reads the other txt-file to get newest information and renew the manialink.

Install
You install the plugin on servers and configure them.
Create blank txt-files according to your serverlogin name. For example: serverlogin=clanserver1 -> txt-files=clanserver1.txt
Look up the attributes of txt-files (reading/writing) set them and restart xAseco.
Join servers to write the first information in txt files.

In next version...- nothing ;)


Image

Download @rr-mania.com / Download section

Hope you enjoy the new comfort ;)

Best Regards
SaKrifieD
Last edited by SaKrifeD on 13 May 2009 21:01, edited 8 times in total.
Image

sAsCh-A
cyclist
cyclist
Posts: 43
Joined: 21 Nov 2008 22:48
Owned TM-games: TMUF
Location: Germany, Bochum
Contact:

Re: [XAseco] Switch Server Plugin

Post by sAsCh-A » 27 Jan 2009 06:15

Just tested it and dont understand what i have todo :)

a little readme were usefull.

I'am still waiting to the next release.

It seems to be nice

SaKrifeD
cyclist
cyclist
Posts: 43
Joined: 07 Jan 2008 16:56
Owned TM-games: TMU, TMN

Re: [XAseco] Switch Server Plugin

Post by SaKrifeD » 27 Jan 2009 09:44

Sorry for this short install guide ;)

Now the detailed version:

I don't know your server structure. But I show my structure and you have to transfer it.

I installed two server and xaseco:

/home/foreverprorounds/TrackmaniaServer/
/home/foreverprorounds/xaseco

/home/foreverprorounds2/TrackmaniaServer/
/home/foreverprorounds2/xaseco

Created a new directory called "changeinfo"
/home/changeinfo
Create there two blank txt-files: server1.txt and server2.txt
Look up that your user who execute xaseco is allowed to read and write these files. If you don't know how, set attributes 777.

Server 1
Edit plugin.sak.switch.php and edit the commented three lines.
$switchtarget = 'loginnameserver2';
$text = file_get_content("../../changeinfo/server2.txt");
$dateiname = "../../changeinfo/server1.txt";
hint: ../../ means that the script have to go two directory backwards. In my structure your are now in home directory.

put plugin.sak.switch.php into xaseco plugin directory.
/home/foreverprorounds/xaseco/plugins/

Added to plugins.xml to active new plugin:
<plugin>plugin.sak.switch.php</plugin>

Server 2
Edit plugin.sak.switch.php and edit the commented three lines.
$switchtarget = 'loginnameserver1';
$text = file_get_content("../../changeinfo/server1.txt");
$dateiname = "../../changeinfo/server2.txt";
hint: ../../ means that the script have to go two directory backwards. In my structure your are now in home directory.

put plugin.sak.switch.php into xaseco plugin directory.
/home/foreverprorounds2/xaseco/plugins/

Added to plugins.xml to active new plugin:
<plugin>plugin.sak.switch.php</plugin>

Restart XAseco on both server. Join server 1 and you'll see a button without information. Just "Click to switch". Click button and switch to server 2. You'll see information from server 1 . Click button and switch back to server 1. Now you'll see information from server 2.

Hope this is detailed enough...
Image

BBMV
sunday driver
sunday driver
Posts: 55
Joined: 18 Dec 2008 11:48
Owned TM-games: TMUF, TMS, TMO, TM2
Location: Germany -> Hessen -> Wiesbaden

Re: [XAseco] Switch Server Plugin

Post by BBMV » 27 Jan 2009 11:23

Hi, great addon :-)

but can you explain what to do to change that for 3 or 4 servers? i dont know what i have to add in your code to use for more than 2 servers.

and next question, is it possible to add a feature to only show in scoreboard or race or always like the ads from fufi?

SaKrifeD
cyclist
cyclist
Posts: 43
Joined: 07 Jan 2008 16:56
Owned TM-games: TMU, TMN

Re: [XAseco] Switch Server Plugin

Post by SaKrifeD » 27 Jan 2009 12:41

but can you explain what to do to change that for 3 or 4 servers? i dont know what i have to add in your code to use for more than 2 servers.
This tool is just for two servers. But you can edit the readInfo function something like that:
count all txt files, except the file from this server
loop while <= count-txt-files {show a manialink}

or sth like that (untested):

Code: Select all

function sakswitch_readInfo($aseco, $command) {
	
        $switchtarget = array ();
	$switchtarget[0] = 'server2';
	$switchtarget[1] = 'server3';
	$switchtarget[2] = 'server4';
	
	$text = array();
	$text[0] = file_get_contents("../../directory/server2.txt");
	$text[1] = file_get_contents("../../directory/server3.txt");
	$text[2] = file_get_contents("../../directory/server4.txt");
	
        $ca = count ($switchtarget);
        $ci = 0;
        $posq = 39;
        $posl =  38;
        $posls = 36;

        $xml = '<manialinks><manialink id="3849955">';
	$xml .= '<frame>';
        while ($ci <= $ca) {
	$xml .= '<quad posn="-64.7 '.$posq.' 2" sizen="14.5 5" halign="left" valign="top" style="Bgs1InRace" substyle="NavButton" manialink="tmtp://#spectate='.$switchtarget[$ci].'" />';
	$xml .= '<format textsize="1"/>';
	$xml .= '<label sizen="14.5 3.5"  posn="-63.8 '.$posl.' 3" halign="left" text="'.$text[$ci].'"/>';
	$xml .= '<format textsize="1"/>';
	$xml .= '<label sizen="14.5 3.5"  autonewline="1" posn="-63.8 '.$posls.' 3" halign="left" text="Click to switch"/>';
        $posq = posq-6;
        $posl =  posl-6;
        $posls = posls-6;   
        $ci++;     	
}
        $xml .= '</frame>';
	$xml .= '</manialink></manialinks>';
	$aseco->client->query("SendDisplayManialinkPage", $xml, 0, false);	

}
Edit the array for each server.

It's a little bit more work. I put it on my todo list ;)

is it possible to add a feature to only show in scoreboard or race or always like the ads from fufi?
register other aseco events. For example endofrace. And close them at onStartup... I hope you know what I mean.

Sorry. Lunchtime is over. It's working time.
Image

BBMV
sunday driver
sunday driver
Posts: 55
Joined: 18 Dec 2008 11:48
Owned TM-games: TMUF, TMS, TMO, TM2
Location: Germany -> Hessen -> Wiesbaden

Re: [XAseco] Switch Server Plugin

Post by BBMV » 27 Jan 2009 15:52

THx, i build it so that it works for the first time but displayed always, i dont know anything about that register event things i am not a coder, so would be fine if you implement that option in next release.


is there a chance to get the ladderlimit from the server also displayed? like in my signature?

SaKrifeD
cyclist
cyclist
Posts: 43
Joined: 07 Jan 2008 16:56
Owned TM-games: TMU, TMN

Re: [XAseco] Switch Server Plugin

Post by SaKrifeD » 27 Jan 2009 17:45

A new version is online.

If the server was empty, the count var was blank. Now it shows 0 players.
If you are too lazy to download just add a line before foreach and after else: $cpl = 0;

I'll develop this plugin next weeks and try to added all proposals.
Image

User avatar
www.22ndsas.org.uk
happy cruiser
happy cruiser
Posts: 110
Joined: 08 Jun 2006 17:17
Owned TM-games: Orig, Sunrise, Tmnuf
Location: East Coast (UK)
Contact:

Re: [XAseco] Switch Server Plugin

Post by www.22ndsas.org.uk » 28 Jan 2009 17:49

Hi is there a way to bring it down a bit as it conflicts with my clock :P
Image
Image

SaKrifeD
cyclist
cyclist
Posts: 43
Joined: 07 Jan 2008 16:56
Owned TM-games: TMU, TMN

Re: [XAseco] Switch Server Plugin

Post by SaKrifeD » 28 Jan 2009 18:01

Yes, just edit position of the quad and the two labels.

actual:
quad posn X 39 X (background)
label posn X 38 X (servername and player)
label posn X 36 X (click to switch)

if you want to bring it down, change to

quad posn X 33 X (background)
label posn X 32 X (servername and player)
label posn X 30 X (click to switch)

but thats not a good position. you have to choose your right position.

- try and error
- read manialink tutorial, especially "position"

greetz
SaK
Image

Amisxp
road tourist
road tourist
Posts: 81
Joined: 26 Dec 2008 10:28
Owned TM-games: TMUF
Location: Slovenia, Maribor

Re: [XAseco] Switch Server Plugin

Post by Amisxp » 28 Jan 2009 19:48

omg thank u so much!!! +1 :3 :gobananas: xD

edit: oh and 1 more thing....i want this to be shown only in race (<dispaly>race</display>) and not always (<dispaly>always</display>), but i dont know where could i change this code. so help plx :1 :lovetm

User avatar
oliverde8
solid chaser
solid chaser
Posts: 1135
Joined: 07 Oct 2006 07:03
Owned TM-games: TMU
Manialink(s): oliverde8
Location: Turkey
Contact:

Re: [XAseco] Switch Server Plugin

Post by oliverde8 » 28 Jan 2009 22:51

Hi,
wouldn't it be easier to connect the second server using GBXRemote.inc and ask for information time to time. I am not sure if it would be fast enought or if it would slow down Aseco but if it don't, it would give you quite a lot of possibilities as having current track....
without using a file read

I don't know it is only a suggestion :D the idea is very nice
ImageImage
Manialink : oliverde8color>
Servers : STATS <> United | VeryShort | Made In Turkey

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

Re: [XAseco] Switch Server Plugin

Post by f*ckfish » 29 Jan 2009 12:48

Amisxp wrote:omg thank u so much!!! +1 :3 :gobananas: xD

edit: oh and 1 more thing....i want this to be shown only in race (<dispaly>race</display>) and not always (<dispaly>always</display>), but i dont know where could i change this code. so help plx :1 :lovetm
The <display> tags only exist in the widgets, there's no manialink equivalent. This has to be implemented directly into the plugin via events.
oliverde8 wrote:Hi,
wouldn't it be easier to connect the second server using GBXRemote.inc and ask for information time to time. I am not sure if it would be fast enought or if it would slow down Aseco but if it don't, it would give you quite a lot of possibilities as having current track....
without using a file read

I don't know it is only a suggestion :D the idea is very nice
I wrote such a plugin myself for nouseforname and came up with the same method. First I tried directly querying the servers which is really fast, but there's a big downside: if one server is down, all Xasecos crash. With the textfile method everything works fine, now with his 6 or 7 or eight servers, don't know for sure. If one gets down, it just disappears from the list, without any Xaseco freezing.
inactive, sorry

SaKrifeD
cyclist
cyclist
Posts: 43
Joined: 07 Jan 2008 16:56
Owned TM-games: TMU, TMN

Re: [XAseco] Switch Server Plugin

Post by SaKrifeD » 29 Jan 2009 14:13

oliverde8 wrote:Hi,
wouldn't it be easier to connect the second server using GBXRemote.inc and ask for information time to time. I am not sure if it would be fast enought or if it would slow down Aseco but if it don't, it would give you quite a lot of possibilities as having current track....
without using a file read
Thx for your suggestion. That was my first try... But I had problem with the remote. That's the reason I took txt-files.
You can put everything in the txt-files. Like current track, players, times... The only information I need is "How many players are on the other server".
In next version I'll added LPs...

Greetz
SaK
Image

TripleT
smooth traffic navigator
smooth traffic navigator
Posts: 193
Joined: 12 Feb 2008 15:14
Owned TM-games: TMNF
Location: Germany

Re: [XAseco] Switch Server Plugin

Post by TripleT » 29 Jan 2009 15:11

i never would show this button always there is a bug in the game, so the game crashes if you mouseover a manialink which is shown always further information HERE

SaKrifeD
cyclist
cyclist
Posts: 43
Joined: 07 Jan 2008 16:56
Owned TM-games: TMU, TMN

Re: [XAseco] Switch Server Plugin

Post by SaKrifeD » 29 Jan 2009 15:43

TripleT wrote:i never would show this button always there is a bug in the game, so the game crashes if you mouseover a manialink which is shown always further information HERE
I see a red door and I want it painted black...

Thank for the hint. Did you tried the script before posting?
I tested it:
mouserover @ finish @ mapchange @spec @driving @voting... mouseover the whole time. nothing was happend.

Please tell me if you tested my script before posting in this thread...
Image

Post Reply