Help on message box script

Post » Mon Nov 19, 2012 3:17 am

Hello
i have made a trigger and attached a sript to it, it will open a message box on trigger enter.
in my message box i made 2 menu buttons
menu button 0 = option1
menu button 1 = option 2
after loading the game and test the trigger, i have to click twice on option 1 in order to close the message box, and click 3 times on option 2 to close the message box.
what do i need to add in my script in order to close the message box in one click into any option ?
here is my script below.
thx

Scriptname GP_TriggerText extends ObjectReference

Message Property showmessage Auto

EVENT onTriggerEnter(objectReference triggerRef)

if triggerRef == Game.getPlayer()

showmessage.show()

if (showmessage.show() == 0)

Debug.Notification("Option 1")

elseif (showmessage.show() == 1)

Debug.Notification("Option 2")

endif

endif

EndEVENT
User avatar
Hayley O'Gara
 
Posts: 3465
Joined: Wed Nov 22, 2006 2:53 am

Post » Sun Nov 18, 2012 9:37 pm

Try:
Spoiler
ScriptName GP_TriggerText Extends ObjectReferenceActor Property PlayerREF AutoMessage Property ShowMessage Auto Event OnTriggerEnter(ObjectReference akActionRef)	If akActionRef == PlayerREF 		Int iButton = ShowMessage.Show()		If iButton == 0			Debug.Notification("Option 1")		ElseIf iButton == 1			Debug.Notification("Option 2")		EndIf	EndIf EndEvent

Also: [spoiler][code][/code][/spoiler], please? Note that you can turn off/on the WYSIWYG editor with the switch in the upper left when posting/editing if posting code to retain indentation.
User avatar
Sanctum
 
Posts: 3524
Joined: Sun Aug 20, 2006 8:29 am

Post » Sun Nov 18, 2012 8:26 pm

thx a lot Justin, it works perfect !
I forgot to set the trigger do once, it keeps triggering :(
how do i set it trigger once ?
thx.
User avatar
Johnny
 
Posts: 3390
Joined: Fri Jul 06, 2007 11:32 am

Post » Mon Nov 19, 2012 4:52 am

Spoiler
ScriptName GP_TriggerText Extends ObjectReferenceActor Property PlayerREF AutoMessage Property ShowMessage AutoAuto State AutoState	Event OnTriggerEnter(ObjectReference akActionRef)		If akActionRef == PlayerREF			Int iButton = ShowMessage.Show()			If iButton == 0				Debug.Notification("Option 1")			ElseIf iButton == 1				Debug.Notification("Option 2")			EndIf		EndIf		GoToState("")	EndEventEndStateEvent OnTriggerEnter(ObjectReference akActionRef)	; Do NothingEndEvent
...or...
Spoiler
ScriptName GP_TriggerText Extends ObjectReferenceBool bDoOnceActor Property PlayerREF AutoMessage Property ShowMessage AutoEvent OnTriggerEnter(ObjectReference akActionRef)	If bDoOnce	ElseIf akActionRef == PlayerREF		bDoOnce = True		Int iButton = ShowMessage.Show()		If iButton == 0			Debug.Notification("Option 1")		ElseIf iButton == 1			Debug.Notification("Option 2")		EndIf	EndIfEndEvent
User avatar
Cathrin Hummel
 
Posts: 3399
Joined: Mon Apr 16, 2007 7:16 pm


Return to V - Skyrim