how do I use OBSE GetUserTime correctly to get seconds (not

Post » Wed Dec 09, 2009 1:01 am

Some split second timing issues in a script get messed up if the player or a mod uses “bullet time”.

Example

;;;;;;;;;;;Reset the bow jerk after shot is fired

(When the bow jerk starts jerk was set to .3)

if jerk != 1 && jerk != 0
set jerk to ( jerk - getsecondspassed )
if jerk <= 0
setmousespeedx 0
setmousespeedy 0
set jerk to 1
endif
endif


If the player goes into bullet time where the game time is set down like this:

con_SetIniSetting "fGlobalTimeMultiplier:General" .2; sets bullet time

Then the “jerk” movement goes on for several player real time seconds.
Here is what I am wondering, can GetUserTime be used in place of getsecondspassed?

Kind’a like this (pseudo code):

(When the bow jerk starts Set jerk to .3 + GetUserTime )

Then

if jerk != 1 && jerk != 0
if jerk == GetUserTime
setmousespeedx 0
setmousespeedy 0
set jerk to 1
endif
endif

But how do I use GetUserTime correctly to get seconds (not minutes or hours) from the players PC?
User avatar
P PoLlo
 
Posts: 3408
Joined: Wed Oct 31, 2007 10:05 am

Post » Wed Dec 09, 2009 12:40 am

[quickpost]On your second piece of code: Your syntax is incorrect. For starters, you'll need to use eval in if conditions to use OBSE expressions involving arrays. Secondly, getUserTime returns a StringMap, not a float/int. You'll need to subscript it to get the required values., for instance, getUserTime[ "Millisecond" ] returns the number of milliseconds that has passed at the time of the function call.[/quickpost]
User avatar
Tyrel
 
Posts: 3304
Joined: Tue Oct 30, 2007 4:52 am

Post » Wed Dec 09, 2009 7:20 am

huh?

array? what array?

is getusertime one of the array only functions?

For starters, you'll need to use eval in if conditions to use OBSE expressions involving arrays.

User avatar
Kari Depp
 
Posts: 3427
Joined: Wed Aug 23, 2006 3:19 pm


Return to IV - Oblivion