I have been trying to create a script that initiates after the play presses a key. To do this I was forced to script like a child having a RegisterForUpdate loop to detect this (see code below).
Spoiler
I did research and came across the SKSE functions called RegisterForKey and OnKeyDown. Reading the wiki's on them I tried out a demo code as shown belowEvent OnInit()
Debug.Notification("Initialised")
RegisterForKey(13)
RegisterForUpdate(2)
EndEvent
Event OnUpdate()
if Input.IsKeyPressed(13)
Possession()
else
debug.notification("sorry")
endif
EndEvent
Debug.Notification("Initialised")
RegisterForKey(13)
RegisterForUpdate(2)
EndEvent
Event OnUpdate()
if Input.IsKeyPressed(13)
Possession()
else
debug.notification("sorry")
endif
EndEvent
Spoiler
Event OnInit()
RegisterForKey(12)
Debug.MessageBox("Step1")
EndEvent
Event OnKeyDown(int Keycode)
if Keycode == 12
Debug.MessageBox("Working")
endif
EndEvent
Unfortunately there is no evidence of it working and I have tried numerous alterations to the code which has left me wondering whether the OnKeyDown function can be used as an Event. Have I missed something? Event OnInit()
RegisterForKey(12)
Debug.MessageBox("Step1")
EndEvent
Event OnKeyDown(int Keycode)
if Keycode == 12
Debug.MessageBox("Working")
endif
EndEvent
