Jump to content

OnWait() event?


irswat

Recommended Posts

I have a check in a script that needs to run 2 times a day. If I player waits more than 13 hours the logic that triggers this check fails and I need to handle the exception in this case. I'm thinking I could do something like if it's daytime, and the check from the night before hasn't happened then call the check from the night before. However this may fail if someone has one of those mods that allows for people to wait up to 31 days.

Link to comment
Share on other sites

Option 1 - Check if the menu is currently open

UI.IsMenuOpen("Sleep/Wait Menu")

http://www.creationkit.com/index.php?title=IsMenuOpen_-_UI

http://www.creationkit.com/index.php?title=UI_Script#Valid_Menu_Names

 

Option 2 - Catch when the menu opens and closes

Event OnInit()
  RegisterForMenu("Sleep/Wait Menu")
EndEvent
 
Event OnMenuOpen(String MenuName)
  If MenuName == "Sleep/Wait Menu"
    ;do something
  EndIf
EndEvent
 
Event OnMenuClose(String MenuName)
  If MenuName == "Sleep/Wait Menu"
    ;do something
  EndIf
EndEvent
Link to comment
Share on other sites

I came up with a similar solution. I created two boolean flags NightTimeCheck and DayTimeCheck. If the check is true before the function that resets the flag is called then that means the exception has been detected...I think.

EDIT: That worked.

Edited by irswat
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...