Technique to run a script when the PC goes to sleep

Post » Wed Apr 13, 2016 4:00 pm

Is there a way to have a script run whenever the PC goes to sleep? I looked at the event handling functions listed on the OBSE page, and there don't seem to be any for sleeping.



I'd prefer not to have my script running every single frame or every millisecond or something. I'd like it if it only ran when the PC went to sleep.



Any suggestions?

User avatar
Brιonα Renae
 
Posts: 3430
Joined: Mon Oct 22, 2007 3:10 am

Post » Thu Apr 14, 2016 2:21 am


Begin MenuMode 1012 ; (SleepWait menu)
If IsTimePassing
If IsPCSleeping
;PC is sleeping
EndIf
EndIf
End

This won't run continuously, but only when the sleep/wait menu is open (MenuMode 1012). The game won't even consider this Begin block outside of that menu.


The IsTimePassing and IsPCSleeping conditions will allow you to check whatever the sleep/wait menu is just open, or if the time is passing and the player is sleeping (and not just waiting).

User avatar
e.Double
 
Posts: 3318
Joined: Tue Jul 24, 2007 11:17 pm


Return to IV - Oblivion