My First Script

Discussion related to Turbo Sliders and beta version feedback.

Moderator: Forum Moderators

Post Reply
y4nn1ck
Posts: 16
Joined: Thu May 05, 2005 1:15 pm
Contact:

My First Script

Post by y4nn1ck » Mon Oct 10, 2005 2:34 pm

Hello,

You can see my first very little script with the 1.06 new log système.
If someone is interresting by this i can post the code
this script allow you to show live information on a web page, for the moment the web server must be on the same server than the turbosliders one.

you can see it in action here

y4nn1ck

User avatar
Mike Nike
Community User Level: 5
Community User Level: 5
Posts: 1132
Joined: Sat Oct 30, 2004 3:11 pm
Contact:

Post by Mike Nike » Tue Oct 11, 2005 3:11 am

I am interested each time ;)

At my clanpage, http://www.csas-clan.info/include.php?path=start.php, there is a script running too, though for TS 0.86 Linux.

It would be surely nice, if all dedicated server on the serverlist would give their serverstatus public - so we could have a set of server information collected at one page, immediately, like in old times. Okay, of course it would be better, if that would be the case already from the development page (JGG).

Anyway, are you going to work more for it y4nnick, or do you like to keep your script at its current development status?

User avatar
Ande
Game Developer
Game Developer
Posts: 487
Joined: Thu Oct 14, 2004 9:43 pm

Post by Ande » Tue Oct 11, 2005 6:56 am

Mike Nike wrote: It would be surely nice, if all dedicated server on the serverlist would give their serverstatus public - so we could have a set of server information collected at one page, immediately, like in old times.
The difference is that in the old times, servers told every change in their configuration by contacting the master server. This generated lots of unnecessary traffic. As clients will anyway ping the servers to get the ping time, there was not much overhead to give a status update at the same time. It would still be perfectly possible to make a script to gather the same information you can see with TS client when it goes to server list. It would require using UDP packets to send the pings, though.

y4nn1ck
Posts: 16
Joined: Thu May 05, 2005 1:15 pm
Contact:

Post by y4nn1ck » Tue Oct 11, 2005 6:59 am

Hello,

for sure i continu to work on my script, becausethe originaly idea, is to make stats like i do manually here i'm new in dev so this script is the first lap ;) for me.

actually i think that for the live information we can't have more information, the script as you can see in the code (at the end) is based on the file racstats.log, normalement we can read it a the end of th race for the last race stat but the file is create at the start of race with this

Code: Select all

RaceStats
Date 2005 9 27
Time 21 26 53
Track Mucilia
TrackMaker fABTAR
RaceNo 1
RaceNumber 10
LapNumber 6
CarMode 1
StartOrder 0
Ghost 0
Pro 1
Car EasySlider
Points 1  10 8 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0
GivePointsForAborted 0
This is the only thing we can have during a race, my work focalise now on the player stats a the end of race

I don't know how your script work, but i think the only way to have real live information is to have a "stats" TCP port like it is in game like Counter-Strike, is it possible with TS 1.06 ?

It can be really interresting, for having more informations like who's on the server and for exemple live best lap, current postion, and points in cups.
And may be TS could appear in software like HLSW or The All seeing eyes that can incruise popularity of TS

This is the code, i just put the PHP, the design is not interresting :)

Code: Select all

$file = "/way/of/ts/server/place/racestats.log";

// We open the file in reading mode
$fp = @fopen($file, "r");
// check if the file exist
if ($fp) 
	{
                // Reading the file line per line until the end
		while (!feof ($fp)) 
		{
			$line = fgets($fp);
                        // We find the datas that we need
			eregi("Track (.*)", $line, $track);
			eregi("RaceNo (.*)", $line, $raceno);
			eregi("RaceNumber (.*)", $line, $racenum);
			eregi("Car (.*)", $line, $car);
		}
	
	}
        
        // Removing space at the end of each variable
	$track = rtrim($track[1]);
	$raceno = rtrim($raceno[1]);
	$racenum = rtrim($racenum[1]);
I take from scrrenshot about circuit, i check that the screen exist, else i put a nopics screen

Code: Select all

$track_image = strtolower($track);
		$track_view = 'images/tracks/'.$track_image.'.jpg';
		
		if (file_exists($track_view))
				{
				$image_disp = 'images/tracks/'.$track_image.'.jpg';
				}
			else
				{
				$image_disp = 'images/tracks/nopics.jpg';
				}
Finally i show a table with informations and close the file

Code: Select all

<table>
			<tr>
				<th>Currently playing: <?php echo $track; ?></th>
			</tr>
			<tr>
				<td><img src="<?php echo $image_disp; ?>" /></td>
			</tr>
			<tr>
				<td>Race Number <?php echo $raceno.'/'.$racenum; ?></td>
			</tr>
		</table>

<?php fclose($fp); ?>
I want that the page refresh every 30s so i hade this in <head></head> section of my html/php page

Code: Select all

<meta http-equiv="refresh" content="30">
since i test the script on my server i see that the cups is stop when no human player is on the server, so if you take a look at my script think about it if the circuit doesn't change ;)

User avatar
Ande
Game Developer
Game Developer
Posts: 487
Joined: Thu Oct 14, 2004 9:43 pm

Post by Ande » Tue Oct 11, 2005 7:12 am

y4nn1ck wrote: I don't know how your script work, but i think the only way to have real live information is to have a "stats" TCP port like it is in game like Counter-Strike, is it possible with TS 1.06 ?
Currently this is not possible. There is the UDP port from which you can see the information you see in the server list but nothing more. It might be a good idea to have something like that, though, and support for All seeing eye etc. would be good, too. Before I implemented the current server list system, ASE was considered but there were some problems, I don't remember what :). I need to re-evaluate the current situation some day.

y4nn1ck
Posts: 16
Joined: Thu May 05, 2005 1:15 pm
Contact:

Post by y4nn1ck » Tue Oct 11, 2005 7:57 am

hum :D it's so good !!!
So like i say in my last post i try to work on statistics, may be i put in the live page all informations availables like car, ghostmode....

Thanks

User avatar
road_oktane
Community User Level: 2
Community User Level: 2
Posts: 158
Joined: Wed Jan 19, 2005 3:16 pm
Contact:

Post by road_oktane » Tue Oct 11, 2005 10:14 pm

Yannik i'm very interested on running this script on TSB - Terra Server,

you did that statistics by hand or script too?

y4nn1ck
Posts: 16
Joined: Thu May 05, 2005 1:15 pm
Contact:

Post by y4nn1ck » Wed Oct 12, 2005 4:31 am

fo now i made it by hands :(, but i work on a automatic version with the raceslog file of the 1.06

User avatar
road_oktane
Community User Level: 2
Community User Level: 2
Posts: 158
Joined: Wed Jan 19, 2005 3:16 pm
Contact:

Post by road_oktane » Thu Oct 13, 2005 12:50 am

[quote="y4nn1ck"]fo now i made it by hands :(, but i work on a automatic version with the raceslog file of the 1.06[/quote]

Please, tell me when you finish it!

Guest

Post by Guest » Thu Oct 13, 2005 4:33 am

ok no problem i post here when it's done ! :)

y4nn1ck
Posts: 16
Joined: Thu May 05, 2005 1:15 pm
Contact:

Post by y4nn1ck » Thu Oct 27, 2005 1:38 pm

Hello,

Some news about the script (may be good news :lol: )

The log analysing script is done
The database to put the stats is done
The script is on beta testing on my server
No output available for now i start o work on next week

i put some screeshot of the database here
http://y4nn1ck.org/files/turbosliders/autostats/

All the datas you see on the screenshots are automaticaly insert at the end of ech race, by my script.

I hope next week i can show you a beta version of the display stats part :wink:

User avatar
Mike Nike
Community User Level: 5
Community User Level: 5
Posts: 1132
Joined: Sat Oct 30, 2004 3:11 pm
Contact:

Post by Mike Nike » Thu Oct 27, 2005 2:21 pm

Nice to see you keep on working on it :)
I am not sure anymore, but unfortunately your server was a bit warpy/laggy for me, so i stopped testing it. When i tested, then i might have given statements/comments in the TS chat (visible in log.txt).
If you are going to work on a real player administration and statistics for your dedicated server, then you might like to check out some documents / ideas etc. of my TS 0.86 Windows based Server Admin Tool and the .exe itself. Just write me a private message, then i send you the downloadlink/permission back, if you want so.

y4nn1ck
Posts: 16
Joined: Thu May 05, 2005 1:15 pm
Contact:

Post by y4nn1ck » Wed Nov 02, 2005 10:26 am

Hello again

Like i said in my last post, beta tests of my script are still in progress, and seems to work fine.

I notice an issue, don't know where it come from, sometimes Endscript execution stop working, need a ts server restart to reactivate the execution, so my script who is executing by this, don't work.
I put some echo in my script to see actions in log file, and maybe to find what happen when the script stop working, but nothing i saw the echo of my script, but at a moment at the end of a race nothing, and when i look in my database nothing to, so the script stop working !! restarting the ts server, all is ok !

My server is on a Linux Box fro the moment, so i plan to test it on a Windows Box to see if the same thing appear.

And like i hope i'm proud to show you the first live results here this is the first beta output !

Guest

Post by Guest » Fri Nov 18, 2005 3:51 pm

Hello

After a long testing and debugging time of the import script, i put a new version of my script in production v.0.9 Beta, with a small design,

I have lots work after the first tests, that i don't think about when i start to code this script like :

mysql version -> test on 4.0 and 4.1
php -> test on 4.x and 5.X
Linux and Windows script version....

The time is come to write somes documentations and other things to make a available the first public version, i hope to have the time this week end to make this.

You can find the script running on my server at the same place here

New features must come in future version but i must stop now, so i can give you a public version.

y4nn1ck
Posts: 16
Joined: Thu May 05, 2005 1:15 pm
Contact:

Post by y4nn1ck » Fri Nov 18, 2005 3:54 pm

Sorry it's me in the last post :oops:

Click on the View Link to see th stats

User avatar
Mike Nike
Community User Level: 5
Community User Level: 5
Posts: 1132
Joined: Sat Oct 30, 2004 3:11 pm
Contact:

Post by Mike Nike » Fri Nov 18, 2005 9:55 pm

This looks like pretty nice work :)
Well done - i am going to test and study it earlier or later a bit more (anyway the server is "laggy" or warpy).

What i can say so far: the summarize of startday/endday did not work so like it was maybe wanted.
2005-11-17 and 2005-11-18 showed only the result of 17'.
I guess it is meant 0:00 o clock...so it was clear it shows only the 17' results...

Edit:
i tested 3 cups now...
bug: only 4 of 5 races are in the statistic each cup

JA_JC-Raceway 33.715 s Ippon-Peto! Nov 15, 2005 at 10:27 for example did not update to 33.25x (last curve driven over sand -> 33.1x ruined - argh :S ;))

Oh, and maybe you should NOT allow Exporting Records to the server.
On the one hand the registration time is anyway too short and on the other you would prefer to have serverrecords only, i guess.

The bots are partly driving nervy...
Once i got in "[orange] diesel", the track, a 13.1x or 13.0x, not sure...but a very tight and very nice lap coming...and a bot far in front of me...crashs...drive backward and crashs into me (OMG! ^^...).
And at another track, long lap, more or less the same - last curve bot crash, i crash into after nice lap...this can be nervy ;)

y4nn1ck
Posts: 16
Joined: Thu May 05, 2005 1:15 pm
Contact:

Post by y4nn1ck » Fri Nov 18, 2005 11:58 pm

Hello

thanks for this testing results !!!

For the Start date/End date you must specifie a time so for a day statistics you must type For exemple Start Date : 2005-11-17 00:01:00 / End Date 2005-11-17 23:59:00

For the race and your best time not in stats, it's the same explication, it's based on the server points distribution :
If there's only one player on the server th stats and race are not insert in database, i have the choice but i see that the server do the same.
Oh, and maybe you should NOT allow Exporting Records to the server.
yes i must look at that

For the bot, this is not the first time i hear about that :) but i love them they drive like .... me :lol:

thanks again

PS: I write a good part of the docs tonight

y4nn1ck
Posts: 16
Joined: Thu May 05, 2005 1:15 pm
Contact:

Post by y4nn1ck » Mon Nov 21, 2005 4:01 pm

Hello,

I don't know if i can make a new post for that, so for the moment i answer here !

The first public version of TSStats is ready, you can download it here :

Version info : TSStatS v0.9 Beta

In ZIP format
In tar.gz format

You can find a documentation on how to install and requirements (excuse my english :oops: like here)

Also you can request some helps on my board here

http://forum.y4nn1ck.org/

Post Reply