How does GetSecondsPassed actually work?

Post » Fri Oct 18, 2013 10:26 pm

I'm trying to put a scripted token on various NPCs with a timer that uses GetSecondsPassed. The token is supposed to remove itself after a set amount of time (like 2 minutes, so the timer counts down 2 minutes and then removes the token after the token script does what it needs to do, irrelevant for the question I'm asking). The script is an object script attached to a playable clothing item (only playable for testing purposes). I currently add the token via console but will eventually add it by script. When the token is on an NPC that never leaves a cell (the fighter's guild porter in Chorrol for example), the script processing drops from every frame to once every 15 seconds or so after my PC exists the cell. This much I expected.

What I didn't expect is that the token wouldn't remove itself after 2 minutes, or even 5. So I put a print to console line in the script to print the timer value every time the script is processed. When my PC is in the Chorrol exterior (by the oak tree), the token on the fighter's guild porter (who is still in the fighter's guild) seems to be processed only 3-4 times a minute judging by the print to console output. Yet the timer decreases by fractional values, not whole seconds, and certainly not by 15-20 seconds each print to console output.

So, how what exactly does GetSecondsPassed return? The amount of the timer decrease when my PC is in the fighter's guild OR outside by the oak tree seems to be 1/(current FPS) regardless of how often the script seems to be processed. Is this all GetSecondsPassed actually does, return the current time between frames? If so, the description on the CS wiki is terribly misleading. I confess I haven't set the token to be unplayable yet. Could this affect anything?

BQ: is there a better way to do this? With the results I'm getting it seems converting to game hours/days is the only way to ensure the token gets removed when I want it to.

the stripped down timer script I used to double check my results (this is attached to an playable token that is added to the porter via console):

scn timertestscriptfloat timerBegin GameMode    set timer to timer + GetSecondsPassed    printC "timer = %.5f" timerEnd
User avatar
Vicki Blondie
 
Posts: 3408
Joined: Fri Jun 16, 2006 5:33 am

Return to IV - Oblivion