Jump to content

Please help to create a multi-menu MessageBox


Recommended Posts

I am at loss. I read the Guide at wiki and another one at Nexus, but they are so complicated, and they only got me so far...


I want to make a book that prompts a MessageBox (above its actual contents, like in Oghma Infinium) with four initial choices when you read it both from the floor and from the inventory (hence both Activate and Equip beginnings). These choices being the three skill specializations and "exit" button. Upon clicking the specializations, another menu should appear with seven respective skills plus the "back" button. Each skill button should increase the respective skill with ModPCSkill command by one, while keeping you inside the same specialization menu. The "back" button should return you to the initial menu where you select specializations. It is way beyond my understanding. I only managed to make a single-layer menu that keeps you inside of it, when you choose the first three options.



ScriptName MyBook


short Choosing
short Choice


Begin OnActivate


Activate
Set Choosing to 1


End


Begin OnEquip


Set Choosing to 1


End


Begin MenuMode


If ( Choosing == 1 )
MessageBox "Select Specializations", "Combat", "Magic", "Stealth", "Exit"
Set Choosing to 2
Set Choice to -1
ElseIf ( Choosing == 2 )
If ( Choice == -1 )
Set Choice to GetButtonPressed
ElseIf ( Choice == 0 )
Set Choosing to 1
ElseIf ( Choice == 1 )
Set Choosing to 1
ElseIf ( Choice == 2 )
Set Choosing to 1
ElseIf ( Choice == 3 )
Set Choosing to 0
EndIf
EndIf


If ( Choosing == 0 )
return
EndIf


End


Please, I have no background in coding and any feedback will be greatly appreciated.

Link to comment
Share on other sites

Here is a nice and tested example:

scn RomRMessageBoxesScript
short doOnce
short choice
short mbox

begin OnActivate Player
	if doOnce == 0
		set mbox to 1
		set choice to -1
		set doOnce to 1
		Activate
	endif
end

begin GameMode
	;message boxes 
	if mbox == 1
		MessageBox "Message boxes test","Box 2","Box 3","Exit"
		set mbox to 0 - mbox
	endif
	if mbox == 2
		MessageBox "Box 2","Choice 1","Back"
		set mbox to 0 - mbox
	endif
	if mbox == 3
		MessageBox "Box 3","Choice 1","Choice 2","Back"
		set mbox to 0 - mbox
	endif
	;check
	if mbox < 0
		set choice to GetButtonPressed
	endif
	;process boxes
	if mbox == -1
		if choice == 0
			set mbox to 2
			set choice to -1
		elseif choice == 1
			set mbox to 3
			set choice to -1
		elseif choice == 2
			set mbox to 0
			set choice to -1
			set doOnce to 0
		endif
	endif
	if mbox == -2
		if choice == 0
			Message "You selected choice 1."
			set mbox to 0 - mbox
			set choice to -1
		elseif choice == 1
			set mbox to 1
			set choice to -1
		endif
	endif
	if mbox == -3
		if choice == 0
			Message "Selected choice 1."
			set choice to -1
			set mbox to 0 - mbox
		elseif choice == 1
			Message "Selected choice 2."
			set choice to -1
			set mbox to 0 - mbox
		elseif choice == 2
			set choice to -1
			set mbox to 1
		endif
	endif
end

It's using only one extra variable. Flipping to negative and positive value of this variable will show number of message box you want to show and its state too. Tested while attaching to some chest, but it can be easily adapted to your needs.

Edited by RomanR
Link to comment
Share on other sites

  • Recently Browsing   0 members

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