timer running ... possible?

Post » Tue Nov 20, 2012 7:12 am

Is it possible to setup a timer from a certain triggered event on? woudl that cumulate lag or the like? it should run forever from when triggere on ...
User avatar
pinar
 
Posts: 3453
Joined: Thu Apr 19, 2007 1:35 pm

Post » Tue Nov 20, 2012 11:36 am

Yes, timers are very possible. I'm running quite a few in my Helgen Rebuilt mod that track the number of days that pass after several specific events happen. What are you trying to do, and I'll see if I can help.
User avatar
Haley Cooper
 
Posts: 3490
Joined: Wed Jun 14, 2006 11:30 am

Post » Tue Nov 20, 2012 1:37 pm

The real question is, what do you need a timer for?

If you need to know the total time between some past event and now, it would be less expensive to just record the time the event occurred, and perform subtraction to get the time delta. CurrentTime - PastTime = TotalTime whenever TotalTime is needed to be known.

If you need something to occur a specific number of game hours after something happens, it would be less expensive to RegisterForSingleUpdateGameTime(x) and trigger it then.

I guess what I'm getting at is, if you can get away with an event-driven system instead of a polling system, go with an event-based system instead. It depends on what you're trying to do.
User avatar
Justin
 
Posts: 3409
Joined: Sun Sep 23, 2007 12:32 am

Post » Tue Nov 20, 2012 4:55 am

Ok explained in few words this is what I was thinking for having seasonal changes in my land ...

1 Record the time of the year when the player enters the land of my worldspace so if is befoure a certain date is summer / spring , after is autumn winter ....

result of two cloned worldspaces with winter or spring settings and relative textures

2 from the moment the player enters always keep track of the time of the day so that when the time of transition comes like from summer to spring I could load the transition worldspace

3 when the transition time ends I load the winter worldspace , and so on in cycle that shoudl last for as long as the player plays or has the mod installed .


Ofc this insane idea was to create a kind of seasonal change and have so different worldspaces painted in different textures where needed , with different meshes etc ....

the only problem I am seeing in this is how woudl quests work or how would references work ? what if a reference is used or picked in summer and then the player wants to end in winter? this may cause problems ..

4 the shorter and easier version of this idea is to just enable or disable Xmarkers in CK that have linked winter or summer meshes , so to load the proper ones but leave unchanged the whole landscape , eventually just adding some more snow meshes , some frozen stuff and or new snow meshes ....
User avatar
Bad News Rogers
 
Posts: 3356
Joined: Fri Sep 08, 2006 8:37 am

Post » Tue Nov 20, 2012 10:13 am

1 Record the time of the year when the player enters the land of my worldspace so if is befoure a certain date is summer / spring , after is autumn winter ....

You don't need to record that. Just get the GameYear, GameMonth, GameDay, GameHour globals and compute when necessary.

2 from the moment the player enters always keep track of the time of the day so that when the time of transition comes like from summer to spring I could load the transition worldspace

It might be better to only switch seasons when the player first enters a worldspace, instead of trying to manage it on the fly. It is doubtful anyone would sit there and watch the seasons go by, unless they were trying to do timelapse video... which would be neat, but is unnecessary in terms of gameplay.

But, yea, time in general is something you don't want to try to manage yourself. Just get the time values when necessary and perform computations on them when necessary.
User avatar
Rudi Carter
 
Posts: 3365
Joined: Fri Sep 01, 2006 11:09 pm

Post » Tue Nov 20, 2012 8:53 am


If you need to know the total time between some past event and now, it would be less expensive to just record the time the event occurred, and perform subtraction to get the time delta. CurrentTime - PastTime = TotalTime whenever TotalTime is needed to be known.


To get that would it be something like this?
...	 float PassedTime = utility.GetCurrentGameTime()...; do some things.. time is going by la la la...	 float CurrentTime = utility.GetCurrentGameTime()	 float TotalTime = CurrentTime - PassedTime 	 debug.notification("Time: "+TotalTime)
User avatar
xx_Jess_xx
 
Posts: 3371
Joined: Thu Nov 30, 2006 12:01 pm

Post » Tue Nov 20, 2012 6:47 am

That could work, but an easier method would be to just check GameHour, GameMonth, GameYear, etc. Those contain the actual time values, not the time delta since game start. Then again, if done right, the GetCurrentGameTime might be more efficient because you only need to access one global. It depends on how you'd want to accomplish it.
User avatar
victoria johnstone
 
Posts: 3424
Joined: Sat Oct 14, 2006 9:56 am


Return to V - Skyrim