Jump to content

Adding Message Box to Toggle Script


Recommended Posts

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 Auto
ObjectReference Property HFON Auto

Event OnActivate(ObjectReference akActionRef)
If akActionRef == Game.GetPlayer()
If HFON.IsDisabled()
HFOff.Disable()
HFON.Enable()
Else
HFON.Disable()
HFOff.Enable()

Endif
Endif

Endevent

 

Link to comment
Share on other sites

Create a Message record

Add a message property

Assign 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:

 

 

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.

Link to comment
Share on other sites

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 :

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 by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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