Jump to content

Toggle Quest (Solved)


kxdace

Recommended Posts

Posted

I am trying to create  a button that activates a quest if it's not running and deactivates a quest if its running (toggle):

===PART One Success===

Scriptname wrScriptQuestOnOff extends ObjectReference 

       Quest property AliasesQuest auto

Event OnActivate (ObjectReference akActionRef)

 

 

       if (AliasesQuest.isRunning())

 

 

             AliasesQuest.Stop()

             debug.notification("Quest is online shutting quest down")

 

 

       elseIf(AliasesQuest.isStopped())

 

 

             AliasesQuest.Reset()

             debug.notification("Quest is offline starting quest")

 

 

       endIf

 

 

EndEvent

===PART One Success===

 

 

When the quest is active any time the right ALT button is pressed down I should get the message: "Hotkey Pressed" and when I let go it should say hotkey released. However it never does this:

===PART Two Failure===

Scriptname QF_0Quest_TestBTN_OnOff_060DF1FA Extends Quest Hidden

 

 

Bool bIsHotkeyPressed ; = False

Int Property iHotkey = 184 Auto ; R-Alt by default

 

Event OnInit()

       RegisterForSingleUpdate(0.25)

EndEvent

 

Event OnUpdate()

       If bIsHotkeyPressed != Input.IsKeyPressed(iHotkey) ; Only run code when the status changes

             bIsHotkeyPressed = !bIsHotkeyPressed ; Set bool to whatever it isn't

             If bIsHotkeyPressed ; == True

                    Debug.MessageBox("Hotkey Pressed")

             Else ; If bIsHotkeyPressed == False

                    Debug.MessageBox("Hotkey Released")

             EndIf

       EndIf

       RegisterForSingleUpdate(0.25)

 

 

EndEvent===PART Two Failure===

Please advise.

2019-07-12 19_16_42-Quest_ 0Quest_TestBTN_OnOff.jpg

2019-07-12 19_16_49-Quest_ 0Quest_TestBTN_OnOff.jpg

2019-07-12 19_21_41-Quest_ 0Quest_TestBTN_OnOff.jpg

Posted

Adding debug.MessageBox("") made it work... WTF LOL

 

Event OnInit()

      debug.MessageBox("")

       RegisterForSingleUpdate(0.25)

EndEvent

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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