Getting the current in game hour isn't as simple as Game.GetHour() unless you've written your own function called GetHour() that I'm not aware of. I was writing a script to toggle a light at 8PM and 6AM game time, the portion of script with the math looks like this:
Event OnInit() RegisterForUpdateGameTime(2) ;; Checks the game time every 2 in-game hoursEndEventEvent OnUpdateGameTime() ;; <-- The event sent on the update that occurs every two hoursfloat GameTime = utility.GetCurrentGameTime()int GameTimeInt = (GameTime as int)float TOD = ((GameTime - GameTimeInt)*24)EndEvent
TOD represents the hour of the day, where 0 is midnight, 4 is 4AM, 8 is 8AM, 12 is NOON, 16 is 4PM, and 20 is 8PM. With some tweaking you can get the minutes too, but I'll leave that math up to you.
Anyway, looks like you're trying to do something like:
Scriptname SleepFor8Hours Extends ObjectReferenceQuest Property MyQuest AutoEvent OnSleepStart()RegisterForUpdateGameTime(8)EndEventEvent OnUpdate() Int SleepState = Game.GetPlayer().GetSleepState() If(SleepState == 3) MyQuest.Start() EndIf EndEventEvent OnSleepStop()UnregisterForUpdateGameTimeEndEvent
That will do what you're looking to do if I understand correctly, without the need for calculating game time at all.