Jump to content

MenuMode function?


Slikpik

Recommended Posts

So, I've seen the Begin MenuMode function and then numbers after that. What I think they are is just a random number that you put in. Like the script would be:

 

scn MessageScript

Short Button

Begin MenuMode 124557
    Set Button to GetButtonPressed
        If (Button == 3)
            (script goes here)
        endif
end


 

That number would be the one for the message that appears, would I use that for every other script I use that uses the same message?

 

I hope I make sense. If not, explain to me what the number is after MenuMode please.

 

 

Link to comment
Share on other sites

Terminology: menuMode is a blocktype, not a function.

 

menuMode itself:

 

The 'begin menuMode' block executes when the game is in menu mode. Essentially, if the game is not in gameMode, it's in menu mode. Messages are menuModes, as are the PipBoy, dialog, companion wheel, etc.

 

Each TYPE of menu has a specific designation. For example, the message box menu is 1001, that's the numeric code that appears after 'begin menuMode'.

 

A full list of the numbers can be found here.

 

Here's a script I use for handling message buttons in DARC:PH:

scn DARC07scptTeleporterActiMobile

ref rTarget
short sCharge
short sMenu
short sMyButton
short sFBs
short sMessageFlag

begin onActivate

	Set sCharge to DARC07qstTeleporterControl.sCharges
	Set sMessageFlag to 1

end

begin GameMode

	if sMessageFlag == 1
		Set sMenu to 1
		Set sMessageFlag to 0
		Set sCharge to DARC07qstTeleporterControl.sCharges
		ShowMessage DARC07msgFTUMenu01 sCharge
	elseIf sMessageFlag == 2
		Set sMessageFlag to 0
		Set sMenu to 2
		Set sCharge to DARC07qstTeleporterControl.sCharges
		Set sFBs to Player.getItemCount FissionBattery
		ShowMessage DARC07msgFTUMenu02 sFBs sCharge
	elseIf sMessageFlag == 3
		Set sMessageFlag to 0
		Set sMenu to 3
		ShowMessage DARC07msgFTUMenuError
	elseIf sMessageFlag == 4
		Set sMessageFlag to 0
		Autosave
		Set DARC07qstTeleporterControl.sCharges to DARC07qstTeleporterControl.sCharges - 1
		Set sCharge to DARC07qstTeleporterControl.sCharges
		Set rTarget to DARC07refTeleportMarker
		DARC07refBunkerMainDoor.Lock 255
		Set DARC07qstTeleporterControl.bTeleported to 1
		player.moveTo rTarget
		ShowMessage DARC07msgFTUCUCnt sCharge
	endIf

end

begin MenuMode 1001

	Set sMyButton to GetButtonPressed

	if sMenu == 1
		if sMyButton == 0
			if sCharge > 0
				Set sMessageFlag to 4
			else
				Set sMessageFlag to 3
			endIf
		elseIf sMyButton == 1
			player.addItem DARC07tokenTeleClean 1 1
		elseIf sMyButton == 2
			Set sMessageFlag to 2
		endIf
	elseIf sMenu == 2
		if sMyButton == 0
			player.removeItem FissionBattery 2
			Set DARC07qstTeleporterControl.sCharges to DARC07qstTeleporterControl.sCharges + 1
			Set sCharge to DARC07qstTeleporterControl.sCharges
			ShowMessage DARC07msgFTUCUCnt sCharge
		elseIf sMyButton == 1
			player.removeItem FissionBattery 4
			Set DARC07qstTeleporterControl.sCharges to DARC07qstTeleporterControl.sCharges + 2
			Set sCharge to DARC07qstTeleporterControl.sCharges
			ShowMessage DARC07msgFTUCUCnt sCharge
		elseIf sMyButton == 2
			player.removeItem FissionBattery 6
			Set DARC07qstTeleporterControl.sCharges to DARC07qstTeleporterControl.sCharges + 3
			Set sCharge to DARC07qstTeleporterControl.sCharges
			ShowMessage DARC07msgFTUCUCnt sCharge
		elseIf sMyButton == 3
			player.removeItem FissionBattery 8
			Set DARC07qstTeleporterControl.sCharges to DARC07qstTeleporterControl.sCharges + 4
			Set sCharge to DARC07qstTeleporterControl.sCharges
			ShowMessage DARC07msgFTUCUCnt sCharge
		elseIf sMyButton == 4
			player.removeItem FissionBattery 10
			Set DARC07qstTeleporterControl.sCharges to DARC07qstTeleporterControl.sCharges + 5
			Set sCharge to DARC07qstTeleporterControl.sCharges
			ShowMessage DARC07msgFTUCUCnt sCharge
		endIf
	endIf

end
Edit: Hi Llama. :wink: Edited by Xaranth
Link to comment
Share on other sites

...Wow. That's funny.

 

Used as an object condition, it doesn't work right, and if you use it in a script, it can only be used in a menuMode block making it mostly (I can think of a couple cases) redundant. I love this game. Really.

Link to comment
Share on other sites

Thanks. While we're on messages, what's wrong with this?

 

scn MISSING3QuestScript

Short bMDoOnce
Short MButton

Begin GameMode
	if (bMDoOnce != 1)
		ShowMessage MISSING3Startup
		StartQuest Missing3
		Set bMDoOnce to 1
			If IsModLoaded "The Unlocker.esp"
				ShowMessage Missing3SlickUnlocker
			endif
	endif
end

Begin MenuMode 1001
Set MButton to GetButtonPressed
	if (MButton == 0)
		con_QuitGame
	endif
end

 

I want it to quit game but nothing happens when I press the button. What do I need to make it exit game?

Edited by Slikpik
Link to comment
Share on other sites

Uhm., I suspect your menumode is out of sync with the quest script; a quest script by default runs only once every five seconds. What you need to do is pass the menu handling code to a token or something else that will run constantly. The menuMode code in the questScript will only run if you happen to be in menumode with it on; you basically have a one-frame window to catch it.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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