[XASECO] Plugin: Auto Shuffle Tracklist

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
_relaxedracer
sunday driver
sunday driver
Posts: 73
Joined: 30 Jan 2009 09:32
Owned TM-games: All

[XASECO] Plugin: Auto Shuffle Tracklist

Post by _relaxedracer » 13 Jan 2014 16:00

Hi, maybe some-one can realise a plugin that auto shuffle the tracklist at a given time.

This would be great if you dont have that manny tracks in the list, so the order changes every day.

:pil ®elaxed®acer
Last edited by _relaxedracer on 14 Feb 2018 21:24, edited 1 time in total.
Click HERE to join FULLSPEEDMANIA 0-60k

User avatar
Groxtek. 〤
wheelbarrow operator
wheelbarrow operator
Posts: 24
Joined: 12 Jul 2014 20:03
Owned TM-games: TMUF, TM2C
Manialink(s): google.com/
Location: Sistiana, Italy
Contact:

Re: Plugin suggestion: shuffle tracklist every 24h

Post by Groxtek. 〤 » 26 Nov 2014 15:47

Nice idea, _relaxedracer!!! :D
So, I think is simple...
Yop! I'm Hex!T_

My servers:
Join here <!-- FreeZone яπг»ƒยll~¢υקै. 〤 -->
Join here <!-- FreeZone яπг»しоै๒ ѕєяvзяृ. 〤 -->

PS: Im not a pro to making plugins... :/

Image

User avatar
_relaxedracer
sunday driver
sunday driver
Posts: 73
Joined: 30 Jan 2009 09:32
Owned TM-games: All

Re: Plugin suggestion: shuffle tracklist every 24h

Post by _relaxedracer » 27 Oct 2017 07:47

Still would like to see this happen. :lovetm

Can somebody pretty please help make this? :1
Click HERE to join FULLSPEEDMANIA 0-60k

User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 143
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Manialink(s): woa
Location: Sweden
Contact:

Re: Plugin suggestion: shuffle tracklist every 24h

Post by L3cKy » 08 Feb 2018 22:50

something like that ...

Code: Select all

<?php
Aseco::registerEvent('onEverySecond', 'auto_shuffle');
global $shuffletime;
global $shuffleinterval;
$shuffleinterval = 86400; //in seconds
$shuffletime = 0;
function auto_shuffle($aseco) {
global $shuffletime, $shuffleinterval;
$time = time();
    if ($shuffletime + $shuffleinterval <= $time) {
        $shuffletime = $time;
        $rtn = $aseco->client->query('SaveMatchSettings', 'MatchSettings/autosave.txt');
        if (!$rtn) {trigger_error('[' . $aseco->client->getErrorCode() . '] SaveMatchSettings - ' . $aseco->client->getErrorMessage(), E_USER_WARNING);
        } else {
            if ($aseco->settings['writetracklist_random']) {
                $tracksfile = $aseco->server->trackdir . 'MatchSettings/autosave.txt';
                if (!$list = @file_get_contents($tracksfile)) {
                    trigger_error('Could not read match settings file ' . $tracksfile . ' !', E_USER_WARNING);
                } else {
                    $list = preg_replace('/<\/gameinfos>/', '$0' . CRLF . CRLF .
                                         "\t<filter>" . CRLF .
                                         "\t\t<random_map_order>1</random_map_order>" . CRLF .
                                         "\t</filter>", $list);
                    if (!@file_put_contents($tracksfile, $list)) {
                        trigger_error('Could not write match settings file ' . $tracksfile . ' !', E_USER_WARNING);
                    }
                }
            }
        }
    }
}
?>

NOTE: you need to change booth "MatchSettings/autosave.txt" to your matchsettings file ...

User avatar
_relaxedracer
sunday driver
sunday driver
Posts: 73
Joined: 30 Jan 2009 09:32
Owned TM-games: All

Re: Plugin suggestion: shuffle tracklist every 24h

Post by _relaxedracer » 11 Feb 2018 18:44

Works great!

I only needed to change the / into a \ in the path to matchsettings file (using windows 7)

Thanx L3cKy !! :1
Click HERE to join FULLSPEEDMANIA 0-60k

Post Reply