Message Menu's

Post » Sat May 28, 2011 6:19 pm

Hi all,

Due to the limit for the number of options you can have on a stand Message window in-game, I've had to create 2 Message windows that link from one to the other to continue the number of ootions available.

I.e.

MessageBox1: Option 1, Option 2, Option 3... Option 9

Option 1 would set a global variable to 1, Option 2 to 2 etc, however pressing Option 9 on this first MessageBox brings up MessageBox2.

MessageBox2: Option 10, Option 11, Option 12... Option 17

Option 10 would set the same global variable to 10 and so forth.

Now for some reason, when I have to press Option 9 to take me to the second part of the menu, and no matter what option I press (e.g. Option 13, Option 10 etc), the stored Global Variable is 17.

I can't fathom why it's doing this.

My code's below, so if anyone at all could graciously help, I'd as ever be indebted :)

scn TARDISdataStorageSCRIPTshort Button;tardisMenuChoice 1 == Datastore 1 screen 1;tardisMenuChoice 2 == Datastore 1 screen 2	begin onActivate player	ShowMessage TARDISdatastore1	set tardisMenuChoice to 1endbegin gameMode	set Button to GetButtonPressed	if tardisMenuChoice == 1		if ( Button == 0 )			set tardisdstore1 to 1			set tardisMenuChoice to 0			showmessage TARDISdstore1set		elseif ( Button == 1 )			set tardisdstore1 to 2			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 2 )			set tardisdstore1 to 3			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 3 )			set tardisdstore1 to 4			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 4 )			set tardisdstore1 to 5			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 5 )			set tardisdstore1 to 6			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 6 )			set tardisdstore1 to 7			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 7 )			set tardisdstore1 to 8			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 8 )			set tardisMenuChoice to 2			ShowMessage TARDISdatastore1a		elseif ( Button == 9 )			set tardisMenuChoice to 0		endif	endif	if tardisMenuChoice == 2		if ( Button == 0 )			set tardisMenuChoice to 0			set tardisdstore1 to 9			showmessage TARDISdstore1set		elseif ( Button == 1 )			set tardisMenuChoice to 0			set tardisdstore1 to 10			ShowMessage TARDISdstore1set		elseif ( Button == 2 )			set tardisMenuChoice to 0			set tardisdstore1 to 11			ShowMessage TARDISdstore1set		elseif ( Button == 3 )			set tardisMenuChoice to 0			set tardisdstore1 to 12			ShowMessage TARDISdstore1set		elseif ( Button == 4 )			set tardisMenuChoice to 0			set tardisdstore1 to 13			ShowMessage TARDISdstore1set		elseif ( Button == 5 )			set tardisMenuChoice to 0			set tardisdstore1 to 14			ShowMessage TARDISdstore1set		elseif ( Button == 6 )			set tardisMenuChoice to 0			set tardisdstore1 to 15			ShowMessage TARDISdstore1set		elseif ( Button == 7 )			set tardisMenuChoice to 0			set tardisdstore1 to 16			ShowMessage TARDISdstore1set		elseif ( Button == 8 )			set tardisMenuChoice to 0			set tardisdstore1 to 17			ShowMessage TARDISdstore1set		elseif ( Button == 9 )			set tardisMenuChoice to 0		endif	endifend


Cheers,

Kris
User avatar
Talitha Kukk
 
Posts: 3477
Joined: Sun Oct 08, 2006 1:14 am

Post » Sat May 28, 2011 12:58 pm

Use an "elseif" statement instead of a separate conditional block when checking "if tardisMenuChoice == 2", i.e.
Spoiler
scn TARDISdataStorageSCRIPTshort Button;tardisMenuChoice 1 == Datastore 1 screen 1;tardisMenuChoice 2 == Datastore 1 screen 2begin onactivate player	ShowMessage TARDISdatastore1	set tardisMenuChoice to 1endbegin gameMode	set Button to GetButtonPressed	if tardisMenuChoice == 1		if ( Button == 0 )			set tardisdstore1 to 1			set tardisMenuChoice to 0			showmessage TARDISdstore1set		elseif ( Button == 1 )			set tardisdstore1 to 2			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 2 )			set tardisdstore1 to 3			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 3 )			set tardisdstore1 to 4			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 4 )			set tardisdstore1 to 5			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 5 )			set tardisdstore1 to 6			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 6 )			set tardisdstore1 to 7			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 7 )			set tardisdstore1 to 8			set tardisMenuChoice to 0			ShowMessage TARDISdstore1set		elseif ( Button == 8 )			set tardisMenuChoice to 2			ShowMessage TARDISdatastore1a		elseif ( Button == 9 )			set tardisMenuChoice to 0		endif	elseif tardisMenuChoice == 2		if ( Button == 0 )			set tardisMenuChoice to 0			set tardisdstore1 to 9			showmessage TARDISdstore1set		elseif ( Button == 1 )			set tardisMenuChoice to 0			set tardisdstore1 to 10			ShowMessage TARDISdstore1set		elseif ( Button == 2 )			set tardisMenuChoice to 0			set tardisdstore1 to 11			ShowMessage TARDISdstore1set		elseif ( Button == 3 )			set tardisMenuChoice to 0			set tardisdstore1 to 12			ShowMessage TARDISdstore1set		elseif ( Button == 4 )			set tardisMenuChoice to 0			set tardisdstore1 to 13			ShowMessage TARDISdstore1set		elseif ( Button == 5 )			set tardisMenuChoice to 0			set tardisdstore1 to 14			ShowMessage TARDISdstore1set		elseif ( Button == 6 )			set tardisMenuChoice to 0			set tardisdstore1 to 15			ShowMessage TARDISdstore1set		elseif ( Button == 7 )			set tardisMenuChoice to 0			set tardisdstore1 to 16			ShowMessage TARDISdstore1set		elseif ( Button == 8 )			set tardisMenuChoice to 0			set tardisdstore1 to 17			ShowMessage TARDISdstore1set		elseif ( Button == 9 )			set tardisMenuChoice to 0		endif	endifend

Just in case you haven't seen it already, if you're interested I've written a tutorial on making different types of menus using http://geck.gamesas.com/index.php/ShowMessage - http://www.cipscis.com/fallout/tutorials/menu.aspx

Cipscis
User avatar
Dona BlackHeart
 
Posts: 3405
Joined: Fri Dec 22, 2006 4:05 pm

Post » Sat May 28, 2011 7:59 am

As ever Cipscis, you are a lifesaving genius :)

Massively obliged, I'll certainly take a look, I pretty much live via your Script checker :)
User avatar
Pawel Platek
 
Posts: 3489
Joined: Sat May 26, 2007 2:08 pm


Return to Fallout 3