Page 1 of 1

True second for TimerInterval?

Posted: Thu Jan 23, 2014 11:23 pm
by lexdr
Interval for timer should be in seconds:

Code: Select all

Timer:setTimerInterval(interval)
Sets the timer interval in seconds.
However, some simple tests reveal on my computer that 1 second in TimerInterval corresponds to two true seconds.
Is there a problem on my computer or did I missed something?

Re: True second for TimerInterval?

Posted: Thu Jan 23, 2014 11:51 pm
by lexdr
Actually, I was testing akroma222's magic shield spells and the author said:
I find the spells stay in effect for roughly twice as long as the time I have set them to... or maybe that is just my warped sense of time?
So that it might be a side effect of casting?!

Re: True second for TimerInterval?

Posted: Fri Jan 24, 2014 12:01 am
by DesperateGames
Normally the timer Interval should be the same as entered (and now comes the big surprise) as long as the timer is on the same level as the party is currently on. This issue is discussed a bit further down in the thread you have linked in your post:
Just a quick note here on time... if the timers are on the same level as the party, they are updated every second, however if they are 1 level above or below they are done on alternate seconds (making timers last twice as long!).. higher or lower than that and they are done on an as and when basis.
For that reason, for any timed spells, I have been spawning the timers on the party level at the moment the spells are cast and destroying them... this reduces the chance that the timer will be on a different level of the dungeon than the party. (still open to abuse if players cast spells and then deliberately change levels, but without a lot of extra coding to move timers between levels, that's hard to fix)

Re: True second for TimerInterval?

Posted: Fri Jan 24, 2014 12:09 am
by lexdr
Oh I've missed that. :?
Thank you DesperateGames.

Re: True second for TimerInterval?

Posted: Fri Jan 24, 2014 2:52 pm
by Komag
I highly recommend setting up a universal timer system, one main timer on each level, and just tie into it for anything like this along the way.

Re: True second for TimerInterval?

Posted: Fri Jan 24, 2014 5:04 pm
by lexdr
Thank you for your recommendation. :)
Is it based on effectiveness measurement (less cpu consuming that spawning temporary timers for example) or for ease of use?

Re: True second for TimerInterval?

Posted: Fri Jan 24, 2014 8:04 pm
by Komag
Definitely ease of use, and possible efficiency. For any decent dungeon you'll need timers a lot, and if you constantly spawn or set up new ones when you could just tie into a single master set then you'll be creating needless complexity.

Re: True second for TimerInterval?

Posted: Sun Jan 26, 2014 12:31 pm
by Isaac
What about spawning a timer with the party each time the arrive on a new floor, or return to the previous one?

Yes I certainly remember experimenting with a ''feather-fall" effect that relied on the default timers, and discovering that as I increased the number of floors the party fell through, I had increased inaccuracy of the timer I was using... One can assume it's not the timer per se, but that all processing is likely fractionated on the other floors in both directions; and likely further so on the floors beyond the immediate neighboring ones.

There is always getStatistic('play_time').