[XASECO] Sector Records

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

Moderators: Xymph, TM-Patrol

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] Sector Records

Post by Ant » 05 Aug 2010 08:13

keep_on_dreaming wrote:

Code: Select all

`aseco`.`secrecs_all`
The update queries are still incorrect.
So, what are the corrections ?

User avatar
michixxx93
wheelbarrow operator
wheelbarrow operator
Posts: 15
Joined: 10 Jul 2009 13:25
Owned TM-games: TMUF
Contact:

Re: [XASECO] Sector Records

Post by michixxx93 » 05 Aug 2010 22:31

This is the correct version! I've tried it several times and I always got the right result.
In this case `aseco`.`secrecs_all` and `secrecs_all` are the same, because the database `aseco` is already selected, but I'm used to write my query this way.
Image

Image

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] Sector Records

Post by Ant » 06 Aug 2010 06:57

I haven't noticed anything wrong myself either - its all working as it should do - and thats all I need to worry about :)

User avatar
keep_on_dreaming
pedestrian
pedestrian
Posts: 11
Joined: 10 May 2010 03:30
Owned TM-games: TMUF; TMU
Location: Germany
Contact:

Re: [XASECO] Sector Records

Post by keep_on_dreaming » 15 Aug 2010 05:27

But not everybody is using the default database.

There are a few other problems with this plugin:
1.) Own secrecs won't load on new challenge what causes duplicate entries in database.
2.) The secrecs sometimes aren't correctly sorted.
3.) There is no possibility to just delete 1 secrec after someone took the wrong way for example.

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] Sector Records

Post by Ant » 15 Aug 2010 18:06

Well, I don't use the default database either - mine is named something else and not Aseco but it still seems ok. The possibility to delete 1 secrec as you say would be a good idea though I reckon.

User avatar
michixxx93
wheelbarrow operator
wheelbarrow operator
Posts: 15
Joined: 10 Jul 2009 13:25
Owned TM-games: TMUF
Contact:

Re: [XASECO] Sector Records

Post by michixxx93 » 17 Aug 2010 18:15

keep_on_dreaming wrote:1.) Own secrecs won't load on new challenge what causes duplicate entries in database.
This is called on new challenge:
foreach($aseco->server->players->player_list as $player)
{
load_mysql_own($challengeNow,$player->login);
}
keep_on_dreaming wrote:2.) The secrecs sometimes aren't correctly sorted.
Could you be a little more precisely? own or all records ? The order should be correct because it's sorted by sector and btw a screenshot would help too.
keep_on_dreaming wrote:3.) There is no possibility to just delete 1 secrec after someone took the wrong way for example.
I'll see what I can do. I think a good way would be a window with the records like the jukebox.
Image

Image

User avatar
keep_on_dreaming
pedestrian
pedestrian
Posts: 11
Joined: 10 May 2010 03:30
Owned TM-games: TMUF; TMU
Location: Germany
Contact:

Re: [XASECO] Sector Records

Post by keep_on_dreaming » 21 Aug 2010 01:16

michixxx93 wrote:
keep_on_dreaming wrote:1.) Own secrecs won't load on new challenge what causes duplicate entries in database.
This is called on new challenge:
foreach($aseco->server->players->player_list as $player)
{
load_mysql_own($challengeNow,$player->login);
}
Like i told you, it isn't working.
For example:
After training a map the own secrecs are shown in the window and stored to database. When this map is running again, there aren't any own secrecs loaded, what causes a new insert query into database.
keep_on_dreaming wrote:2.) The secrecs sometimes aren't correctly sorted.
Could you be a little more precisely? own or all records ? The order should be correct because it's sorted by sector and btw a screenshot would help too.

User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 163
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Location: Berlin
Contact:

Re: [XASECO] Sector Records

Post by L3cKy » 25 Feb 2017 15:07

DB-Store Fix: // there was some problems with correct storing into the db ... now it should work correctly

chnage in plugin.bestsecs.php from line 185 this ->

Code: Select all

function update_mysql_all($recordTime,$sector,$challenge,$playerNick,$aseco)
{
	$query = "";
	if(mysql_num_rows(mysql_query("SELECT * FROM secrecs_all WHERE ChallengeID='".$challenge."' AND Sector='".$sector."' LIMIT 1;")) < 1)
	{
		$query = "INSERT INTO secrecs_all (ID,ChallengeID,Sector,PlayerNick,Time) VALUES ('0','".$challenge."','".$sector."','".$playerNick."','".$recordTime."');";
	}
	else
	{
		$query = "UPDATE `aseco`.`secrecs_all` SET `PlayerNick` = '".$playerNick."', `Time` = '".$recordTime."' WHERE ChallengeID='".$challenge."' AND Sector='".$sector."';";
	}
	mysql_query($query);
}
function update_mysql_own($recordTime,$sector,$challenge,$playerNick,$aseco)
{
	$query = "";
	if(mysql_num_rows(mysql_query("SELECT * FROM secrecs_own WHERE ChallengeID='".$challenge."' AND Sector='".$sector."' AND PlayerNick='".$playerNick."' LIMIT 1;")) < 1)
	{
		$query = "INSERT INTO `secrecs_own` (ID,ChallengeID,Sector,PlayerNick,Time) VALUES ('0','".$challenge."','".$sector."','".$playerNick."','".$recordTime."');";
	}
	else
	{
		$query = "UPDATE `aseco`.`secrecs_own` SET `PlayerNick` = '".$playerNick."', `Time` = '".$recordTime."' WHERE ChallengeID='".$challenge."' AND Sector='".$sector."';";
	}
	mysql_query($query);
}
into this ->

Code: Select all

<?php
function update_mysql_all($recordTime,$sector,$challenge,$playerNick,$aseco)
{
	if(mysql_num_rows(mysql_query("SELECT * FROM secrecs_all WHERE ChallengeID='".$challenge."' AND Sector='".$sector."' LIMIT 1;")) < 1)
	{
		$query = "INSERT INTO secrecs_all (ID,ChallengeID,Sector,PlayerNick,Time) VALUES ('0','".$challenge."','".$sector."','".$playerNick."','".$recordTime."');";
		mysql_query($query);
	}
	else
	{
		$query = "UPDATE `secrecs_all` SET `PlayerNick` = '".$playerNick."', `Time` = '".$recordTime."' WHERE ChallengeID='".$challenge."' AND Sector='".$sector."';";
		mysql_query($query);
	}
}
function update_mysql_own($recordTime,$sector,$challenge,$playerNick,$aseco)
{
	if(mysql_num_rows(mysql_query("SELECT * FROM secrecs_own WHERE ChallengeID='".$challenge."' AND Sector='".$sector."' AND PlayerNick='".$playerNick."' LIMIT 1;")) < 1)
	{
		$query = "INSERT INTO `secrecs_own` (ID,ChallengeID,Sector,PlayerNick,Time) VALUES ('0','".$challenge."','".$sector."','".$playerNick."','".$recordTime."');";
		mysql_query($query);
	}
	else
	{
		$query = "UPDATE `secrecs_own` SET `PlayerNick` = '".$playerNick."', `Time` = '".$recordTime."' WHERE ChallengeID='".$challenge."' AND Sector='".$sector."';";
		mysql_query($query);
	}
}
?>
Greetings
Last edited by L3cKy on 09 Mar 2017 20:25, edited 3 times in total.

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

Re: [XASECO] Sector Records

Post by Xymph » 25 Feb 2017 17:55

L3cKy wrote:Timefix // Now the Sectortimes shows the real time you drove at the cp instead of the time you needed from the last cp to the next one
Then by definition it isn't a sector time anymore. Split time or CP time would be a suitable name.
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

User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 163
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Location: Berlin
Contact:

Re: [XASECO] Sector Records

Post by L3cKy » 25 Feb 2017 18:13

Xymph wrote:
L3cKy wrote:Timefix // Now the Sectortimes shows the real time you drove at the cp instead of the time you needed from the last cp to the next one
Then by definition it isn't a sector time anymore. Split time or CP time would be a suitable name.
Yes you are right ... i deleted it.

amgreborn
pedestrian
pedestrian
Posts: 10
Joined: 05 Jun 2018 15:38
Owned TM-games: TMU

Re: [XASECO] Sector Records UPDATE v1.4

Post by amgreborn » 05 Jun 2018 15:50

OK I updated this whole thing. I couldn't believe what my eyes saw when I debugged this entire thing. Not acceptable. I hope it works now. If you've been using previous versions of this plugin, you should make use of /secrecs_cleanupdb. It will take a few moments to minutes to finish.

On the plugins page, it reads that the latest version is v2.0 with author Michixxx93, but the contents of the file says DarkKnight and v1.2. I named it v1.4 now with my update (I had v1.3 too, but didn't release because it wasn't quite finished).

Changelog 1.3:
- Fixed a major bug where it would assume that the gameservers database name is called "aseco"
- Fixed a severe bug where deleting secrecs wouldn't delete the entries from MySQL
- Fixed a heavy bug where improving your own secrecs would overwrite everyone elses own secrecs for that sector with your name and time (many duplicates in database)
- Fixed a minor bug where incorrect times would register (known as the sector 0 bug)

- MySQL entries of a track will now be deleted if the track was removed from the server, can be turned off in bessecs.xml

- added /delsec chat command to delete single or multiple secrecs at once

Changelog 1.4:
- Added /secrecs_cleanupdb chat command to remove duplicate secrecs, old secrecs and faulty secrecs that were caused by previous versions of this plugin

sector_records(1.4).zip

EDIT: Btw, what the hell is wrong with the TrackMania.PlayerFinish event? Once you triggered it by retiring, the event cannot be triggered again for ~5 seconds (i didnt measure the exact time, but its pretty much 5 seconds). This is only happening for this event, as far as I could tell. Also if you go through a checkpoint, and then press enter to respawn to the cp, the moment you hit enter, the counter of 5 seconds starts again. When you now retire before the 5 seconds have passed, the PlayerFinish event again, will not trigger. I looked a bit into the files and I am really not sure what causes it, but I believe its not xaseco, but the dedicated server binaries themselve. Its very weird. If you go through the finish and trigger the event, and then retire to trigger it again, it WILL work. Yeah. Additionally, if you go through cp, enter and retire, your checkpoints won't properly set back to 0 either (at the bottom middle of the screen, i dont know if thats the records eyepiece plugin or something else).

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

Re: [XASECO] Sector Records UPDATE v1.4

Post by Xymph » 05 Jun 2018 16:38

amgreborn wrote:
05 Jun 2018 15:50
On the plugins page, it reads that the latest version is v2.0 with author Michixxx93, but the contents of the file says DarkKnight and v1.2. I named it v1.4 now with my update (I had v1.3 too, but didn't release because it wasn't quite finished).
Plugin authors may use different programming vs. forum handles. After all these years I'm not sure where the 1.0/2.0 versions came from. but corrected them now. Thanks for that heads-up.
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

User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 163
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Location: Berlin
Contact:

Re: [XASECO] Sector Records

Post by L3cKy » 06 Jun 2018 07:50

Coolio ... thx for the update :)

BUT please change the nouse functions (nouseButtonOn & nouseButtonHandleClick) into independent names otherwise xaseco will crash with an error if you use the nouse.button plugin already.

Also the event

Code: Select all

Aseco::registerEvent('onEndRace', '...ButtonOff');
is missing otherwise the buttons will overlay at the score screen.


Last but not least ... I think this way is faster ^^

Code: Select all

DELETE FROM secrecs_all WHERE ChallengeID NOT IN (SELECT Uid FROM challenges)
DELETE FROM secrecs_own WHERE ChallengeID NOT IN (SELECT Uid FROM challenges)


Greetings

amgreborn
pedestrian
pedestrian
Posts: 10
Joined: 05 Jun 2018 15:38
Owned TM-games: TMU

Re: [XASECO] Sector Records

Post by amgreborn » 06 Jun 2018 15:57

I don't know about the nouse functions, I did not touch those and I didn't even look at them. I also have no time to do any more coding at this moment.

Code: Select all

DELETE FROM secrecs_all WHERE ChallengeID NOT IN (SELECT Uid FROM challenges)
DELETE FROM secrecs_own WHERE ChallengeID NOT IN (SELECT Uid FROM challenges)

This is for deleting old secrecs whos tracks are removed right? If so, it wouldn't work. After deleting a track, the database entry of that track is also not removed. So when you select the Uid from challenges, you would get more uids than there really are left on the server. I found that using 'GetChallengeList' gives you the real challenge list that is currently in the servers rotation. A bad workaround would be using /dbtools cleanupdb, which removes left over challenge uids, and then I could execute that command above. I thought about just cleaning up the left over challenge entries myself, but I felt like the sector plugin shouldn't have rights to do anything with the challenge column, which is why I chose the way I did.

User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 163
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Location: Berlin
Contact:

Re: [XASECO] Sector Records

Post by L3cKy » 08 Jun 2018 15:31

Yes u are right ... totaly forgot that i use dbtools after deleting some tracks ... ^^
But the nouse functions defently need other names.

Post Reply