Here are my scripts so far:
Spoiler
Scriptname spike_cs_PrisonSleep Extends QuestReferenceAlias Property Spike_cs_PlayerAlias Auto ;Player alias - used to register for update game timeInt Property CrimeGold Auto Hidden ;Will store player bounty before arrestEvent OnStoryJail(ObjectReference akGuard, Form akCrimeGroup, Location akLocation, Int aiCrimeGold) debug.Notification("spike_cs - the Jail event has triggered") ;Used to store game time each hour on player alias script then compare on location change Spike_cs_PlayerAlias.RegisterForUpdateGameTime(1) CrimeGold = aiCrimeGold EndEvent
Spoiler
Scriptname spike_cs_PlayerAliasScript Extends ReferenceAliasReferenceAlias Property Spike_cs_PlayerAlias Auto ;Player alias - needed to apply effects to playerQuest Property Spike_cs_JailQuest Auto ;Jail quest - needed to stop the quest after player has served sentenceInt Property GameTime Auto Hidden ;Tracks hours passedEvent OnUpdateGameTime() GameTime = utility.GetCurrentGameTime() as Int debug.Notification("spike_cs - " + GameTime + " in-game hours have passed")EndEventEvent OnLocationChange(Location akOldLoc, Location akNewLoc) Spike_cs_PlayerAlias.UnregisterForUpdateGameTime() if (utility.GetCurrentGameTime() as Int) > GameTime ;Player has served sentence ;Retrieve player's bounty before sent to jail int playerbounty = (Spike_cs_JailQuest as spike_cs_PrisonSleep).CrimeGold debug.Notification("spike_cs - Player served sentence, player bounty was " + playerbounty) else ;Player has escaped debug.Notification("spike_cs - Player escaped jail") endif Spike_cs_JailQuest.Stop() EndEvent
As you can see I've set the player alias to register for update every 1 in-game hour. This allows me to keep track of what day it was while the player was still in jail then compare that against the day it is when the player exits the cell (in theory that means the value will be 1 greater only if they served their sentence).
The issue is if the player is arrested within the time period 2300-2400, the day will roll over but the script won't realize this until a full hour has passed since the player was arrested. Which means the maximum possibly period in which the script can't detect a day is 59 in-game minutes. There are various solutions running through my head for this, but I'm just not in the state of mind to follow along with them right now.