Jump to content

Need help learning script


Recommended Posts

ok so I started trying to add sub-menus to the script and it saves in the creation kit but doesn't function in game.

 

I appreciate any and all feedback.

Message Property MainMessageProperty Auto
Message Property aaafastbellm1 Auto
Message Property aaafastbellm1s Auto
Message Property aaafastbellm2 Auto
Message Property aaafastbellm3 Auto

Event OnActivate(ObjectReference akActionRef)
	if akActionRef == Game.getplayer()
		int ibutton = MainMessageProperty.Show()
		if ibutton == 0 ;first menu item clicked in main message
			aaafastbellm1.show()
					If ibutton == 11 ;what is supposed to be a sub menu
						aaafastbellm1s.show()
					ElseIf ibutton == 12 ; back
						aaafastbellm1.show()
					EndIf
		ElseIf ibutton == 1 ;second menu item clicked in main message
			aaafastbellm2.show()
		ElseIf ibutton == 2 ;third menu item clicked in main message
			aaafastbellm3.show()
		EndIf
	endif
EndEvent
Edited by TrustyPeaches
Link to comment
Share on other sites

You'll need another variable to detect the button pressed when opening the sub-menu. So, you'll change the sub-menu component of the script along these lines...

int ibutton2 = aaafastbellm1.show()
	If ibutton2 == 0 ;what is supposed to be a sub menu
		aaafastbellm1s.show()
	ElseIf ibutton2 == 1 ; back
		aaafastbellm1.show()
	EndIf

If you want to go back, your best bet is to make use of functions. Showing the same message again won't achieve the same functionality as it did when you first open it, as you've removed any instructions you gave it the first time. I'd put the functionality of the primary menu into a function, call that function OnActivate and when you want to go back.

 

If you want a more concise example, you can have a look at the source code to one of my mods. I deal with a great number of menus in that mod in particular, so I'm sure that you'll be able to find an example if you look. Your best bet is to open the source code and search for ">Back", ">Previous", or ">Next".

Link to comment
Share on other sites

  • Recently Browsing   0 members

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