Page 1 of 1

3 events to 1 function

Posted: 29 Nov 2008 18:05
by lgrfbs-sweden
Hi
Can I do it like this in a aseco script:

Code: Select all

Aseco::registerEvent('onPlayerConnect', 'chk_dt'); // Check the date and time ag
Aseco::registerEvent('onBeginRace', 'chk_dt'); // Check the date and time agains
Aseco::registerEvent('onPlayerChat', 'chk_dt'); // Check the date and time again
So this 3 events call same functions?

Re: 3 events to 1 function

Posted: 30 Nov 2008 00:02
by Xymph
lgrfbs-sweden wrote:Can I do it like this in a aseco script:

Code: Select all

Aseco::registerEvent('onPlayerConnect', 'chk_dt'); // Check the date and time ag
Aseco::registerEvent('onBeginRace', 'chk_dt'); // Check the date and time agains
Aseco::registerEvent('onPlayerChat', 'chk_dt'); // Check the date and time again
So this 3 events call same functions?
Depends on what you want to do inside that function, as each is called with different parameters (e.g. a player object for onPlayerConnect). But if you're not using any of the possible parameters, that should work I think.

Re: 3 events to 1 function

Posted: 30 Nov 2008 04:01
by lgrfbs-sweden
thanks will try it.
It is a code for a live scorebord script for competition/race and then the end time, for example the race ends 2008-11-30 13:30 then the clock step over this time the script will send the "Game end" to the external php file and go to sleep until next race will begin.

So by using this 3 event I will in worse case have a resolution on 6 minute (a map is 6 minute)

Re: 3 events to 1 function

Posted: 30 Nov 2008 13:44
by Xymph
lgrfbs-sweden wrote:It is a code for a live scorebord script for competition/race and then the end time, for example the race ends 2008-11-30 13:30 then the clock step over this time the script will send the "Game end" to the external php file and go to sleep until next race will begin.

So by using this 3 event I will in worse case have a resolution on 6 minute (a map is 6 minute)
You can use the onEverySecond event to help you track elapsed time, as long as you're very careful what you do inside your event handler.

Re: 3 events to 1 function

Posted: 30 Nov 2008 21:45
by lgrfbs-sweden
Okey, thanks don't know about "onEverySecond" until now.
the only thing this will do is check for end date and time for a race as allready begin.
We have not upgrade ours server yet therefor we are await new server hardware so the old
TMN server with aseco 0.91 is still runing here, will "onEverySecond" work anyway ?

Re: 3 events to 1 function

Posted: 01 Dec 2008 08:45
by Xymph
lgrfbs-sweden wrote:We have not upgrade ours server yet therefor we are await new server hardware so the old
TMN server with aseco 0.91 is still runing here, will "onEverySecond" work anyway ?
That version is so badly out of date it's not even funny anymore. Anyway, this event was introduced in v0.95.

Re: 3 events to 1 function

Posted: 01 Dec 2008 10:52
by lgrfbs-sweden
Okey, I will bend the arm on my sysop then. :)