TM-FORUM

The TrackMania universal forum ^_^
It is currently 24 Apr 2017 18:15

All times are UTC + 1 hour




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 20 Aug 2016 21:35 
Offline
pedestrian
pedestrian

Joined: 26 Oct 2011 17:01
Posts: 10
Owned TM-games: TMUF, TM2
Sorry for not getting round to releasing this here before.

Flexitime plugin for TrackMania Forever xaseco

This plugin provides the /timeleft chat command, allowing players with the appropriate privilege level to change the time left on the fly. It also optionally provides functionality similar to the customtime (providing a /timeset command) and authortime plugins.

Download
http://www.realh.co.uk/tm/plugins/flexitime-1.1.3.zip

To install
Copy plugin.flexitime.php to xaseco's plugins directory and flexitime.xml to the parent of that directory. Edit flexitime.xml (using a decent editor with syntax highlighting is strongly recommended) to customise the plugin for your server. The plugin runs its own timer in place of the standard timer so disable the latter by setting <timeattack_limit> or whatever to 0 in the server's MatchSettings config.

If you want to use the custom_time (/timeset) feature you will need to make sure your database has the appropriate table. See <http://plugins.xaseco.org/info.php?id=13>.

Example usage:

Query the time remaining:
/timeleft

Set the remaining time to 10 minutes:
/timeleft 10

Add 10 minutes to the remaining time:
/timeleft +10


Top
 Profile  
 
 Post subject:
PostPosted: 05 Oct 2016 18:10 
Offline
highway camper
highway camper

Joined: 05 Oct 2016 16:27
Posts: 1
Owned TM-games: Turbo
Some problems:
1) sometimes it puts 0:00 time to the map and it "skips" (1-2 seconds driving and final screen with "No winner!";
2) nobody gets LP;
3) when the server has 16+ online, it lags a bit (maybe server problem, not plugin)?


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 17 Nov 2016 21:50 
Offline
happy cruiser
happy cruiser
User avatar

Joined: 05 Sep 2007 14:55
Posts: 133
Location: Sweden
Owned TM-games: TMUF
Manialink(s): woa
Same problem over here sometimes it skips a track without any interaction at server synchro -> round begin.


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 18 Nov 2016 18:09 
Offline
pedestrian
pedestrian

Joined: 26 Oct 2011 17:01
Posts: 10
Owned TM-games: TMUF, TM2
I just sort of hacked this plugin together. Xaseco isn't well documented and I don't know enough about it to work out why these bugs happen.


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 19 Nov 2016 18:04 
Offline
happy cruiser
happy cruiser
User avatar

Joined: 05 Sep 2007 14:55
Posts: 133
Location: Sweden
Owned TM-games: TMUF
Manialink(s): woa
I wrote a little tricky one to fix this problem ... ^^
Over 2 Hours without any autoskip ;)

ADD
Code:
Aseco::registerEvent("onNewChallenge", "realh_flexitime_new_challenge");


ADD
Code:
   public function initTimer_begin() {
        $this->paused = false;
      $this->time_left = 60;
      $this->showHud("");
    }


ADD
Code:
function realh_flexitime_new_challenge($aseco) {
    global $realh_flexitime;
       $realh_flexitime->initTimer_begin();
}


So long ...


Last edited by L3cKy on 19 Nov 2016 23:02, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 19 Nov 2016 20:19 
Offline
pedestrian
pedestrian

Joined: 26 Oct 2011 17:01
Posts: 10
Owned TM-games: TMUF, TM2
Thanks. I've updated it on github. Your test() method does exactly the same as hidePanel() so I used that instead.


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 19 Nov 2016 20:33 
Offline
happy cruiser
happy cruiser
User avatar

Joined: 05 Sep 2007 14:55
Posts: 133
Location: Sweden
Owned TM-games: TMUF
Manialink(s): woa
Nice BUT there is one problem ... is you restart xaseco or start the server the time wont start untill you restart or skip the map.

To prevent this i just added
Code:
$this->client->query("NextChallenge");
into the aseco.php before the end of function sendHeader() ... need to find another fix for that. ^^


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 20 Nov 2016 00:18 
Offline
pedestrian
pedestrian

Joined: 26 Oct 2011 17:01
Posts: 10
Owned TM-games: TMUF, TM2
Can you restart the timer from in game? Maybe this would work:
Code:
/timeleft 60
/timeleft resume


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 20 Nov 2016 00:31 
Offline
happy cruiser
happy cruiser
User avatar

Joined: 05 Sep 2007 14:55
Posts: 133
Location: Sweden
Owned TM-games: TMUF
Manialink(s): woa
Sure i can ... but think about you have a cronjob or something and u are at work and xaseco restarts ... than the time wont start before someone force a skip or restart ...
At my fix there was a problem ... i refixed it now and it works like a charm ... the main problem is you just added only "onBeginRound" ... and forgott "onNewChallenge" ... sometimes you have over 30 seconds between "onEndRound" and "onBeginRound" ... somewhere there it comes to this mistake but dont ask me where and why XD
thats why i added "onNewChallenge" and done a "fake" timer to prevent the server to skip the track ...
The trick is to tell the plugin that a time is already running down before the round starts so the plugin cant do a skip couse of an running time ^^
At "onBeginRound" the normal initTimer() is overwriting the fake one ... it just need to fix the restart/skip when xaseco gets restartet or starter and hide the fake timer before Round begin.

I think there is the problem
Code:
$this->time_left <= 0

When it is no time of course there will be a skip ^^

ADD
Code:
Aseco::registerEvent("onNewChallenge", "realh_flexitime_new_challenge");


ADD
Code:
   public function initTimer_begin() {
        $this->paused = false;
      $this->time_left = 60;
}


ADD
Code:
function realh_flexitime_new_challenge($aseco) {
    global $realh_flexitime;
       $realh_flexitime->initTimer_begin();
}


IMPORTANT is to force a restart somewhere ... ^^
Code:
$this->client->query("NextChallenge");
i done it at the aseco.php before the end of function sendHeader() ...


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 20 Nov 2016 02:23 
Offline
pedestrian
pedestrian

Joined: 26 Oct 2011 17:01
Posts: 10
Owned TM-games: TMUF, TM2
I don't know why I thought initTimer_begin() did the same as hidePanel(), it's more like a cut down version of the original initTimer(). Now I understand the problem better, and why your fix works... but...

So I don't think there needs to be a handler for onNewChallenge as well as onBeginRound. The real problem is that I need to skip the check for time_left <= 0 when paused is true.


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 20 Nov 2016 02:30 
Offline
pedestrian
pedestrian

Joined: 26 Oct 2011 17:01
Posts: 10
Owned TM-games: TMUF, TM2
L3cKy wrote:
Nice BUT there is one problem ... is you restart xaseco or start the server the time wont start untill you restart or skip the map.

To prevent this i just added
Code:
$this->client->query("NextChallenge");
into the aseco.php before the end of function sendHeader() ... need to find another fix for that. ^^

Is that still going to be a problem, or is that just because I messed up the last fix? The handler for onStartup should result in initTimer() being called, so hopefully all will be OK when the other problem is fixed properly.


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 22 Nov 2016 13:30 
Offline
happy cruiser
happy cruiser
User avatar

Joined: 05 Sep 2007 14:55
Posts: 133
Location: Sweden
Owned TM-games: TMUF
Manialink(s): woa
Your fix isnt working ... now the plugin dont skip anymore when the timer reaches 0 XD ...


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 22 Nov 2016 14:53 
Offline
pedestrian
pedestrian

Joined: 26 Oct 2011 17:01
Posts: 10
Owned TM-games: TMUF, TM2
It was a typo ('-' instead of '->'). I'm surprised PHP ran the script at all.


Top
 Profile  
 
 Post subject: Re: [XASECO] Plugin: FlexiTime 1.1.3 (/timeleft)
PostPosted: 22 Nov 2016 18:25 
Offline
happy cruiser
happy cruiser
User avatar

Joined: 05 Sep 2007 14:55
Posts: 133
Location: Sweden
Owned TM-games: TMUF
Manialink(s): woa
Looks like the issue is gone ;)
Thanks alot for fixing.

So long ...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group