[XASECO2] Plugin: Best Checkpoint Times 1.0.2 (UPDATE)

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
User avatar
undef.de
Pit Crew
Pit Crew
Posts: 1309
Joined: 31 Aug 2009 18:38
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
Location: Germany
Contact:

[XASECO2] Plugin: Best Checkpoint Times 1.0.2 (UPDATE)

Post by undef.de » 25 Sep 2011 17:57

Best Checkpoint Times

This Plugin is similar with the "Best Checkpoints Widget" from afisse, but it looks like my "Personal Best Checkpoints" Plugin.

With this Widget you can see who has the fastest Time/Score at the related Checkpoint. The last fastest Time/Score blinks, so you can easy find the latest beaten Checkpoint.
If nobody has a fastest Time/Score at some Checkpoint, then the Widget displays empty times. After someone drives through a Checkpoint, this time is indicated in the Widget.

Currently it supports the Gamemodes: Rounds, TimeAttack, Team, Laps, Cup, Stunts

For more Information, Screenshots, Documentation and Downloads, please visit the related Site at my Labs:
http://www.undef.name/XAseco2/Best-Checkpoint-Times.php
Last edited by undef.de on 23 Sep 2013 22:29, edited 11 times in total.
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm

User avatar
Leigham
happy cruiser
happy cruiser
Posts: 139
Joined: 26 Mar 2011 01:04
Owned TM-games: TMUF, TMNF, TM²
Manialink(s): None

Re: [XASECO2] Plugin: Best Checkpoint Times 1.0.0 (NEW)

Post by Leigham » 25 Sep 2011 18:15

Nice plugin undef :) As always.
"Never surrender, sometimes retreat"

Image

Scottish Flat Trax servers

«从々.»«ॐ²³»
sunday driver
sunday driver
Posts: 58
Joined: 28 Jun 2010 16:35
Owned TM-games: TMNF, TMUF, TM²C
Manialink(s): lolzone
Location: Germany
Contact:

Re: [XASECO2] Plugin: Best Checkpoint Times 1.0.0 (NEW)

Post by «从々.»«ॐ²³» » 26 Sep 2011 22:46

Leigham wrote:Nice plugin undef :) As always.
word,

but it is a little bit oversized for some xaseco2 default settings.
maybe I am wrong, but on my config it was to big.
thats why I reconfigured it.
however, the map with most checkpoints on my mini server have 10, so I don´t need this big panel with 20 possible cprecs :)

Image

undef and all, here is the code :)

Code: Select all

<?php

/*
 * Plugin Best Checkpoint Times
 * This Plugin display the best Checkpoint-Time from a Player, like the Plugin from 'afisse',
 * (see http://www.tm-forum.com/viewtopic.php?t=22232). But it uses the same look-and-feel
 * like my PersonalBestCheckpoints (see http://www.tm-forum.com/viewtopic.php?f=127&t=25976).
 *
 * This Plugin works only with TM2!
 * ----------------------------------------------------------------------------------
 * Author:		undef.de
 * Version:		1.0.0
 * Date:		2011-09-20
 * Copyright:		2011 by undef.de
 * Home:		http://www.undef.de/Trackmania/Plugins/
 * System:		XAseco2/0.90+
 * Game:		Trackmania2 (ManiaPlanet)
 * ----------------------------------------------------------------------------------
 *
 * LICENSE: This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * ----------------------------------------------------------------------------------
 *
 * Dependencies:	none
 */

/* The following manialink id's are used in this plugin (the 915 part of id can be changed on trouble):
 * 92001		id for manialink for the Widget itself
 * 92002		id for manialink Checkpoint-Times and Differences
 * 92003		id for manialink for the Help
 * 92004		id for action to display Help
 * 92005		id for action to close Help
 */

Aseco::registerEvent('onSync',				'bct_onSync');
Aseco::registerEvent('onCheckpoint',			'bct_onCheckpoint');
Aseco::registerEvent('onPlayerConnect',			'bct_onPlayerConnect');
Aseco::registerEvent('onPlayerInfoChanged',		'bct_onPlayerInfoChanged');
Aseco::registerEvent('onPlayerManialinkPageAnswer',	'bct_onPlayerManialinkPageAnswer');
Aseco::registerEvent('onBeginMap2',			'bct_onBeginMap2');
Aseco::registerEvent('onEndMap1',			'bct_onEndMap1');
Aseco::registerEvent('onRestartMap',			'bct_onRestartMap');


global $bct_config;

/* Just a note for my editor -> utf-8 äöüß */

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

function bct_onSync ($aseco) {
	global $bct_config;


	if (defined('XASECO2_VERSION') && version_compare(XASECO2_VERSION, 0.90, '<') ) {
		trigger_error('[plugin.info_widget.php] Not supported XAseco2 version ('. XASECO2_VERSION .')! Please update to min. version 0.90!', E_USER_ERROR);
	}

	if ( (defined('XASECO2_VERSION')) && ($aseco->server->getGame() != 'MP') ) {
		trigger_error('[plugin.best_checkpoint_times.php] This plugin supports only TM2 (ManiaPlanet), can not start with a "'. $aseco->server->getGame() .'" Dedicated-Server!', E_USER_ERROR);
	}

	// Set 'checkpoint_list' off, this place we need
	setCustomUIField('checkpoint_list', false);

	$bct_config['MANIALINK_ID'] = '920';
	$bct_config['VERSION'] = '1.0.0';

	// Register this to the global version pool (for up-to-date checks)
	$aseco->plugin_versions[] = array(
		'plugin'	=> 'plugin.best_checkpoint_times.php',
		'author'	=> 'undef.de',
		'version'	=> $bct_config['VERSION']
	);

	$bct_config['WIDGET']['POSITION_X'] = 8.6;
	$bct_config['WIDGET']['POSITION_Y'] = -36;
	$bct_config['WIDGET']['TEXTSIZE'] = 1;
	$bct_config['WIDGET']['TEXTSCALE'] = 0.9;
	$bct_config['SHOW_MAX_CHECKPOINTS'] = 10;			// 20 is max.

	// Set current state
	$bct_config['CURRENT_STATE'] = 'race';
	$bct_config['CHALLENGE'] = array();
	$bct_config['CHECKPOINT_TIMES'] = array();
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

function bct_onPlayerConnect ($aseco, $player) {
	global $bct_config;


	// Need to do a trick, because on XAseco StartUp, there is no Challenge loaded
	// and XAseco can not give the number of Checkpoints. So just fill the maximum.
	// When the Challenge is loaded, then this get fixed to the correct number of
	// Checkpoints.
	// If a Player joins when XAseco runs a longer time, then there is the correct
	// number of Checkpoints, because the Challenge is already loaded.
	$bct_config['CHALLENGE']['NUM_CPS'] = (isset($bct_config['CHALLENGE']['NUM_CPS']) ? $bct_config['CHALLENGE']['NUM_CPS'] : $bct_config['SHOW_MAX_CHECKPOINTS']);

	// Display the empty Widget
	bct_buildWidget($player->login);
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

// called @ onPlayerInfoChanged
function bct_onPlayerInfoChanged ($aseco, $info) {
	global $bct_config;


	// Nothing todo at Score
	if ($bct_config['CURRENT_STATE'] != 'score') {

		// Get Player
		$player = $aseco->server->players->getPlayer($info['Login']);

		if ($info['SpectatorStatus'] > 0) {
			$xml =  '<?xml version="1.0" encoding="UTF-8"?>';
			$xml .= '<manialinks>';
			$xml .= '<manialink id="'. $bct_config['MANIALINK_ID'] .'01"></manialink>';
			$xml .= '<manialink id="'. $bct_config['MANIALINK_ID'] .'02"></manialink>';
			$xml .= '</manialinks>';

			// Hide at Scoretable
			$aseco->client->query('SendDisplayManialinkPageToLogin', $player->login, $xml, 0, false);
		}
		else {
			// Display the empty Widget
			bct_buildWidget($player->login);

			// Display the Checkpoints Time for Player
			bct_buildCheckpointsTimeInlay();
		}
	}
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

// called @ onPlayerManialinkPageAnswer
function bct_onPlayerManialinkPageAnswer ($aseco, $answer) {
	global $bct_config;


	// If id = 0, bail out immediately
	if ($answer[2] == 0) {
		return;
	}

	// Get Player
	$player = $aseco->server->players->getPlayer($answer[1]);

	if ($answer[2] == $bct_config['MANIALINK_ID'] .'04') {			// Display Help

		bct_buildHelpWindow($player->login, true);

	}
	else if ($answer[2] == $bct_config['MANIALINK_ID'] .'05') {		// Close Help

		bct_buildHelpWindow($player->login, false);

	}

}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

// called @ onBeginMap2
function bct_onBeginMap2 ($aseco, $challenge_item) {
	global $bct_config;


	// Set current state
	$bct_config['CURRENT_STATE'] = 'race';

	// Display the empty Widget to all Players)
	bct_buildWidget(false);

	// Save the number of Checkpoints of this Map and if this Map is a Multilap
	$bct_config['CHALLENGE']['NUM_CPS'] = $challenge_item->nbchecks;
	$bct_config['CHALLENGE']['MULTILAP'] = $challenge_item->laprace;

	// Setup the Array of CheckpointTimes with empty entries for all Checkpoints
	for ($cp = 0; $cp < $bct_config['CHALLENGE']['NUM_CPS']; $cp ++) {
		$bct_config['CHECKPOINT_TIMES'][$cp]['Score'] = 0;
		$bct_config['CHECKPOINT_TIMES'][$cp]['Nickname'] = '$ff0---';
	}

	bct_buildCheckpointsTimeInlay();
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

// called @ onRestartMap
function bct_onRestartMap ($aseco, $challenge_item) {
	global $bct_config;


	// Set current state
	$bct_config['CURRENT_STATE'] = 'race';
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

// TMN: [0]=PlayerUid, [1]=Login, [2]=Time, [3]=Score, [4]=CheckpointIndex
// TMF: [0]=PlayerUid, [1]=Login, [2]=TimeScore, [3]=CurLap, [4]=CheckpointIndex
function bct_onCheckpoint ($aseco, $checkpt) {
	global $bct_config;


	// Set the author of this action
	$player = $aseco->server->players->getPlayer($checkpt[1]);
	$score = $checkpt[2];
	$round = $checkpt[3];
	$CheckpointId = $checkpt[4];


	// Bail out if no setup was done at bct_onBeginMap2(),
	// this is a problem at a running Server with Players on.
	if ( !isset($bct_config['CHECKPOINT_TIMES'][$CheckpointId]) ) {
		return;
	}


//	$aseco->console('***B CP:'. sprintf("%02d", $CheckpointId) .' RND:'. $round .' TIME:'. $score);

	// Special work for Multilaps Maps in Gamemode 'Laps'
	if ( ($aseco->server->gameinfo->mode == 4) && ($bct_config['CHALLENGE']['MULTILAP'] == true) ) {
		// 4 = Laps

		// Correct CheckpointId in Multilaps Maps
		$finish = false;
		if ( ($CheckpointId+1) == ($bct_config['CHALLENGE']['NUM_CPS'] * $round) ) {
			$round -= 1;
		}
		if ($round > 0) {
			// The Checkpoints counts up, but i need the Id of the Checkpoint
			$cp = ($CheckpointId - ($bct_config['CHALLENGE']['NUM_CPS'] * $round));
			if ($cp >= 0) {
				$CheckpointId = $cp;
			}
		}
	}

//	$aseco->console('***A CP:'. sprintf("%02d", $CheckpointId) .' RND:'. $round .' TIME:'. $score .LF);


	// Check if the actual Player has a better Score/Time
	$refresh = false;
	if ($bct_config['CHECKPOINT_TIMES'][$CheckpointId]['Score'] > 0) {

		if ( ($aseco->server->gameinfo->mode == 6) && ($score > $bct_config['CHECKPOINT_TIMES'][$CheckpointId]['Score']) ) {
			// 6 = Stunts: Higher = Better
			$bct_config['CHECKPOINT_TIMES'][$CheckpointId]['Score'] = $score;
			$bct_config['CHECKPOINT_TIMES'][$CheckpointId]['Nickname'] = bct_handleSpecialChars($player->nickname);
			$refresh = true;
		}
		else if ($score < $bct_config['CHECKPOINT_TIMES'][$CheckpointId]['Score']) {
			// All other: Lower = Better
			$bct_config['CHECKPOINT_TIMES'][$CheckpointId]['Score'] = $score;
			$bct_config['CHECKPOINT_TIMES'][$CheckpointId]['Nickname'] = bct_handleSpecialChars($player->nickname);
			$refresh = true;
		}
	}
	else {
		$bct_config['CHECKPOINT_TIMES'][$CheckpointId]['Score'] = $score;
		$bct_config['CHECKPOINT_TIMES'][$CheckpointId]['Nickname'] = bct_handleSpecialChars($player->nickname);
		$refresh = true;
	}

	if ($refresh == true) {
		// Display the Inlay to all Players
		bct_buildCheckpointsTimeInlay($CheckpointId);
	}
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

// called @ onEndMap1
function bct_onEndMap1 ($aseco, $race) {
	global $bct_config;


	// Set current state
	$bct_config['CURRENT_STATE'] = 'score';

	$xml =  '<?xml version="1.0" encoding="UTF-8"?>';
	$xml .= '<manialinks>';
	$xml .= '<manialink id="'. $bct_config['MANIALINK_ID'] .'01"></manialink>';
	$xml .= '<manialink id="'. $bct_config['MANIALINK_ID'] .'02"></manialink>';
	$xml .= '</manialinks>';

	// Reset the Array of CheckpointTimes
	$bct_config['CHECKPOINT_TIMES'] = array();

	// Hide at Scoretable
	$aseco->client->query('SendDisplayManialinkPage', $xml, 0, false);
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

function bct_buildWidget ($login = false) {
	global $aseco, $bct_config;


	$xml =  '<?xml version="1.0" encoding="UTF-8"?>';
	$xml .= '<manialinks>';
	$xml .= '<manialink id="'. $bct_config['MANIALINK_ID'] .'02">';
	$xml .= '<frame posn="'. $bct_config['WIDGET']['POSITION_X'] .' '. $bct_config['WIDGET']['POSITION_Y'] .' 3">';
	$xml .= '<label posn="34.2 -0.5 0.12" sizen="2.85 9" action="'. $bct_config['MANIALINK_ID'] .'04" focusareacolor1="FFF9" focusareacolor2="FFFF" text=" "/>';
	$xml .= '</frame>';
	$xml .= '</manialink>';
	$xml .= '<manialink id="'. $bct_config['MANIALINK_ID'] .'01">';
	$xml .= '<frame posn="'. $bct_config['WIDGET']['POSITION_X'] .' '. $bct_config['WIDGET']['POSITION_Y'] .' 3">';
	$xml .= '<quad posn="-0.5 -0.4 0.11" sizen="32.9 9" style="BgsPlayerCard" substyle="ProgressBar"/>';
	$xml .= '<quad posn="16.4 -0.95 0.13" sizen="0.1 8" bgcolor="9F95"/>';
	$xml .= '</frame>';
	$xml .= '</manialink>';
	$xml .= '</manialinks>';

	if ($login != false) {
		// Send to $login
		$aseco->client->query('SendDisplayManialinkPageToLogin', $login, $xml, 0, false);
	}
	else {
		// Send to all Players
		$aseco->client->query('SendDisplayManialinkPage', $xml, 0, false);
	}
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

function bct_buildHelpWindow ($login, $display = true) {
	global $aseco, $bct_config;


	$message = array(
		'With this Widget you can see who has the fastest Time/Score at the related Checkpoint. The last fastes Time/Score blink,',
		'so you can easy find the last beated Checkpoint.',
		'',
		'If nobody has a fastest Time/Score at some Checkpoint, then the Widget display emtpy times. After someone drive thrue a',
		'Checkpoint, this time are indicated in the Widget.',
	);

	$xml =  '<?xml version="1.0" encoding="UTF-8"?>';
	$xml .= '<manialinks>';
	$xml .= '<manialink id="'. $bct_config['MANIALINK_ID'] .'03">';

	if ($display == true) {
		$xml .= '<frame posn="-40.8 30.55 18.50">';	// BEGIN: Window Frame
		$xml .= '<quad posn="-0.2 0.2 0.01" sizen="55.8 39" style="Bgs1InRace" substyle="BgTitle2"/>';
		$xml .= '<quad posn="1.8 -4.1 0.02" sizen="61.7 49.9" bgcolor="0018"/>';

		// Header Line
		$xml .= '<quad posn="-0.6 0.6 0.02" sizen="57.6 6" style="Bgs1InRace" substyle="BgTitle3_3"/>';
		$xml .= '<quad posn="-0.6 0.6 0.03" sizen="57.6 6" style="Bgs1InRace" substyle="BgTitle3_3"/>';

		// Title
		$xml .= '<quad posn="1.8 -0.7 0.04" sizen="3.2 3.2" style="BgRaceScore2" substyle="ScoreLink"/>';
		$xml .= '<label posn="5.5 -1.7 0.04" sizen="60.4 0" textsize="2" scale="0.9" textcolor="000F" text="Help for Best Checkpoint Times"/>';

		// Close Button
		$xml .= '<frame posn="76.7 -0.15 0.05">';
		$xml .= '<quad posn="0 0 0.01" sizen="4.5 4.5" action="'. $bct_config['MANIALINK_ID'] .'05" style="Icons64x64_1" substyle="ArrowUp"/>';
		$xml .= '<quad posn="1.2 -1.2 0.02" sizen="2 2" bgcolor="EEEF"/>';
		$xml .= '<quad posn="0.7 -0.7 0.03" sizen="3.1 3.1" style="Icons64x64_1" substyle="Close"/>';
		$xml .= '</frame>';

		$xml .= '<label posn="7.6 -55.8 0.04" sizen="18 2" halign="center" valign="center" textsize="1" scale="0.7" url="http://www.undef.de/Trackmania/Plugins/" focusareacolor1="0000" focusareacolor2="FFF5" textcolor="000F" text="BEST CHECKPOINT TIMES/'. $bct_config['VERSION'] .'"/>';


		// Set the width of MessageWindow
		$width = 65;
		$line_height = 1.65;
		$position = 0;

		$xml .= '<frame posn="3 -6 0">';
		foreach ($message as $msg) {
			if ($msg) {
				$xml .= '<label posn="0 '. $position .' 0.05" sizen="'. ($width-2.6) .' 0" halign="left" textsize="1" textcolor="FFFF" text="'. $msg .'"/>';
			}
			$position -= $line_height;
		}
		$xml .= '</frame>';


		$xml .= '</frame>';	// Window
	}

	$xml .= '</manialink>';
	$xml .= '</manialinks>';

	// Send Help to given Player
	$aseco->client->query('SendDisplayManialinkPageToLogin', $login, $xml, 0, false);
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

function bct_buildCheckpointsTimeInlay ($cpid = -1) {
	global $aseco, $bct_config;


	// Set actual Checkpoint
	$CheckpointId = (($cpid != -1) ? $cpid : 0);

	$xml =  '<?xml version="1.0" encoding="UTF-8"?>';
	$xml .= '<manialinks>';
	$xml .= '<manialink id="'. $bct_config['MANIALINK_ID'] .'02">';
	$xml .= '<frame posn="'. $bct_config['WIDGET']['POSITION_X'] .' '. $bct_config['WIDGET']['POSITION_Y'] .' 3">';

	$lines = 1;
	$posx = 0;
	$posy = 0;
	$offsety = 1.37;
	$CheckpointCount = 0;
	for ($cp = 0; $cp < $bct_config['CHALLENGE']['NUM_CPS']; $cp ++) {

		// Show max. $bct_config['SHOW_MAX_CHECKPOINTS'] Checkpoints
		if (($cp+1) > $bct_config['SHOW_MAX_CHECKPOINTS']) {
			break;
		}

		// Do not show Finish
		if (($CheckpointCount+1) == $bct_config['CHALLENGE']['NUM_CPS']) {
			break;
		}

		// Break if Checkpoint is not set
		if ( !isset($bct_config['CHECKPOINT_TIMES'][$cp]) ) {
			break;
		}


		// Check for max. line count
		if ($lines == 6) {
			$lines = 1;
		}
		$posy = -($offsety * $lines);

		// Check for next block
		if ( ($CheckpointCount == 5) || ($CheckpointCount == 10) ) {
			$posx += 16.5;
		}

		// Highlight last reached Checkpoint
		if ( ($CheckpointCount == $CheckpointId) && ($cpid != -1) ) {
			// Highlight current Checkpoint
 			$xml .= '<format style="TextTitle2Blink"/>';
		}
		else {
			// No Highlight
 			$xml .= '<format style="TextCardSmallScores2Rank"/>';
		}

		$xml .= '<label posn="'. ($posx + 1.85) .' '. $posy .' 0.14" sizen="1.5 0" halign="right" textsize="'. $bct_config['WIDGET']['TEXTSIZE'] .'" scale="'. $bct_config['WIDGET']['TEXTSCALE'] .'" text="$FFF'. ($cp+1) .'."/>';
		$xml .= '<label posn="'. ($posx + 6.3) .' '. $posy .' 0.14" sizen="4.3 0" halign="right" textsize="'. $bct_config['WIDGET']['TEXTSIZE'] .'" scale="'. $bct_config['WIDGET']['TEXTSCALE'] .'" text="$FFF'. (($aseco->server->gameinfo->mode == 6) ? $bct_config['CHECKPOINT_TIMES'][$cp]['Score'] : bct_formatTime($bct_config['CHECKPOINT_TIMES'][$cp]['Score'])) .'"/>';
		$xml .= '<label posn="'. ($posx + 6.8) .' '. $posy .' 0.14" sizen="11 0" textsize="'. $bct_config['WIDGET']['TEXTSIZE'] .'" scale="'. $bct_config['WIDGET']['TEXTSCALE'] .'" text="$FFF'. $bct_config['CHECKPOINT_TIMES'][$cp]['Nickname'] .'"/>';


		$CheckpointCount++;
		$lines++;
	}

	$xml .= '</frame>';
	$xml .= '</manialink>';
	$xml .= '</manialinks>';

	$aseco->client->query('SendDisplayManialinkPage', $xml, 0, false);
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

// Stolen from basic.inc.php and adjusted
function bct_formatTime ($MwTime, $hsec = true, $length = 3) {


	if ($MwTime == -1) {
		return '???';
	}
	else {
		$hours = floor(($MwTime / 1000) / 3600);
		$minutes = floor($MwTime / (1000 * 60));
		$seconds = floor(($MwTime - $minutes * 60 * 1000) / 1000);
		$tseconds = substr($MwTime, strlen($MwTime)-3);
		if ($hsec) {
			if ($hours) {
				return sprintf('%d:%02d:%02d.%0'. $length .'d', $hours, $minutes, $seconds, $tseconds);
			}
			else {
				return sprintf('%d:%02d.%0'. $length .'d', $minutes, $seconds, $tseconds);
			}
		}
		else {
			if ($hours) {
				return sprintf('%d:%02d:%0'. $length .'d', $hours, $minutes, $seconds);
			}
			else {
				return sprintf('%d:%0'. $length .'d', $minutes, $seconds);
			}
		}
	}
}

/*
#///////////////////////////////////////////////////////////////////////#
#									#
#///////////////////////////////////////////////////////////////////////#
*/

function bct_handleSpecialChars ($string) {
	global $re_config;


	// Remove links, e.g. "$(L|H|P)[...]...$(L|H|P)"
	$string = preg_replace('/\${1}(L|H|P)\[.*?\](.*?)\$(L|H|P)/i', '$2', $string);
	$string = preg_replace('/\${1}(L|H|P)\[.*?\](.*?)/i', '$2', $string);
	$string = preg_replace('/\${1}(L|H|P)(.*?)/i', '$2', $string);

	// Remove $S (shadow)
	// Remove $H (manialink)
	// Remove $W (wide)
	// Remove $I (italic)
	// Remove $L (link)
	// Remove $O (bold)
	// Remove $N (narrow)
	$string = preg_replace('/\${1}[SHWILON]/i', '', $string);


	// Convert &
	// Convert "
	// Convert '
	// Convert >
	// Convert <
	$string = str_replace(
			array(
				'&',
				'"',
				"'",
				'>',
				'<'
			),
			array(
				'&',
				'"',
				'&apos;',
				'>',
				'<'
			),
			$string
	);
	$string = stripNewlines($string);	// stripNewlines() from basic.inc.php

	return validateUTF8String($string);	// validateUTF8String() from basic.inc.php
}

?>
sry, how do I add a collapse function?
TM² [url=maniaplanet://#join=loltech]Δ!lluminati Confirmed!Δ[/url]

User avatar
undef.de
Pit Crew
Pit Crew
Posts: 1309
Joined: 31 Aug 2009 18:38
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
Location: Germany
Contact:

Re: [XASECO2] Plugin: Best Checkpoint Times 1.0.1 (UPDATE)

Post by undef.de » 09 Oct 2011 16:50

Just wanna say: There is an update out there... see my first post.
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm

User avatar
undef.de
Pit Crew
Pit Crew
Posts: 1309
Joined: 31 Aug 2009 18:38
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
Location: Germany
Contact:

Re: [XASECO2] Plugin: Best Checkpoint Times 1.0.2 (UPDATE)

Post by undef.de » 13 Nov 2011 16:12

Just wanna say: There is an update out there... see my first post.
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm

nomadian
highway camper
highway camper
Posts: 4
Joined: 25 Mar 2013 21:25
Owned TM-games: TMO, TMUF, TM²C/S

Re: [XASECO2] Plugin: Best Checkpoint Times 1.0.2 (UPDATE)

Post by nomadian » 29 Mar 2013 22:31

Nice plugin!
I'm using the edits that "«从々.»«ॐ²³»" suggested as the standard widget is too big. But now I have this white bar hanging in the middle of no-where that i can't seem to get rid of. (The bar opens the help of the widget).
I have no need for this bar. May I ask where it is created in the plugin and how to disable it?

Maniac_Lauterer
wheelbarrow operator
wheelbarrow operator
Posts: 21
Joined: 29 Oct 2013 09:13
Owned TM-games: TM2

Re: [XASECO2] Plugin: Best Checkpoint Times 1.0.2 (UPDATE)

Post by Maniac_Lauterer » 03 Nov 2013 14:41

Hi ! Can i change this script two a one-column-script with only 10 checkpoints ...? It is way to wide and i do not need the appearance of checkpoint 11-20 in the second column...

Thanks!
Last edited by Maniac_Lauterer on 03 Nov 2013 23:59, edited 1 time in total.

askuri
road tourist
road tourist
Posts: 83
Joined: 21 Apr 2013 10:01
Owned TM-games: All except TMO
Manialink(s): im
Location: Germany/Rhineland-Palatinate
Contact:

Re: [XASECO2] Plugin: Best Checkpoint Times 1.0.2 (UPDATE)

Post by askuri » 03 Nov 2013 15:13

What about using om23's version of this plugin? That should be what your searching for

Maniac_Lauterer
wheelbarrow operator
wheelbarrow operator
Posts: 21
Joined: 29 Oct 2013 09:13
Owned TM-games: TM2

Re: [XASECO2] Plugin: Best Checkpoint Times 1.0.2 (UPDATE)

Post by Maniac_Lauterer » 04 Nov 2013 09:00

Ok, its still 2 columns, but probably it helps me understand the script by comparing both scripts. But it works nearly fine with my existing panels...!

medlo
highway camper
highway camper
Posts: 1
Joined: 22 Nov 2013 20:32
Owned TM-games: TM2

Re: [XASECO2] Plugin: Best Checkpoint Times 1.0.2 (UPDATE)

Post by medlo » 22 Nov 2013 20:36

Hi
Could someone tell me how to hide the clicable white help bar? I can't find a way to do it. Thanks

User avatar
undef.de
Pit Crew
Pit Crew
Posts: 1309
Joined: 31 Aug 2009 18:38
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
Location: Germany
Contact:

Re: [XASECO2] Plugin: Best Checkpoint Times 1.0.2 (UPDATE)

Post by undef.de » 22 Nov 2013 20:46

medlo wrote:Hi
Could someone tell me how to hide the clicable white help bar? I can't find a way to do it. Thanks
There is no option to do that.
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm

Post Reply