KiokothePirate Posted August 16, 2019 Posted August 16, 2019 How can you add a message box to a script like the one shown below? I want the player to be able to walk up to the activator, activate it, and then get a message box that will allow them to say yes or no. If they say yes, the toggle script runs, if they say no, nothing happens. ObjectReference Property HFOff AutoObjectReference Property HFON AutoEvent OnActivate(ObjectReference akActionRef)If akActionRef == Game.GetPlayer() If HFON.IsDisabled() HFOff.Disable() HFON.Enable() Else HFON.Disable() HFOff.Enable() EndifEndifEndevent
IsharaMeradin Posted August 16, 2019 Posted August 16, 2019 Create a Message recordAdd a message propertyAssign the message you created Assuming Yes is the first button (value 0) and No is the second button (value 1)Put inside the OnActivate event: Reveal hidden contents Int ibutton = myMessage.Show() If ibutton == 0 ;insert toggle stuff Else ;do nothing EndIf FYI - It has been a while since I messed with message boxes. If I got something wrong, hopefully someone can point out the flaws.
maxarturo Posted August 16, 2019 Posted August 16, 2019 (edited) Adding a little more detail to IsharaMeradin post. ( If it's alright with you, i don't mean to intrude ). First create a message MENU, here is video tutorial : Then your script should look something like this, or this one if you like : Reveal hidden contents ObjectReference Property HFOff Auto ObjectReference Property HFON Auto Message Property MyYesNoMenu Auto {MENU to show for Options YES or NO} Auto State Waiting Event OnActivate(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() Int iButton = MyYesNoMenu.Show() ; Your MENU If iButton == 0 ; Button YES If ( HFON.IsDisabled() ) HFON.Enable() Else HFON.Disable() EndIf If ( HFOff.IsDisabled() ) HFOff.Enable() Else HFOff.Disable() EndIf Endif If iButton == 1 ; Button NO - EXITS MENU - DOES NOTHING GoToState("Waiting") EndIf Endif Endevent EndState EDIT : Grammar mistake... Edited August 17, 2019 by maxarturo
KiokothePirate Posted August 16, 2019 Author Posted August 16, 2019 (edited) Awesome! Thanks to the both of you. I'll check this out and see if it works. Edit: Just tried it out and it worked perfectly! Thanks again! Edited August 17, 2019 by KiokothePirate
Recommended Posts