Menu Handler

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Jump to navigation Jump to search


The Menu Handler controls main-menu and pause-menu presentation. PauseMenu_Enabled allows or prevents use of the pause menu; PauseMenu_Show changes whether it is shown, and MainMenu_SetBGPhase selects a main-menu background phase.

Before you start

  1. Open the map script inside your own mod. Keep its generated includes, cScrMap : iScrMap class and callback structure. See Add your first script if you have not edited a map script yet.
  2. Add the helper include shown below alongside the script’s other includes.
  3. Read the stock example before copying its calls: named entities, voice subjects, materials and callbacks must belong to the map or resources you are using.

Follow the stock example

#include "helpers/helper_modules.hps"

PauseMenu_Enabled

Sets if the pause menu is allowed to be used

Parameter Meaning
abActive If true, the pause menu can be opened

In maps/main_menu/main_menu.hps, SOMA calls PauseMenu_Enabled as follows.

PauseMenu_Enabled(false);
Parameter Value in this stock call
abActive false

This is an excerpt from that stock script; its referenced names and variables belong to that script.

PauseMenu_Show

Show the pause manu

Parameter Meaning
abActive If true, the pause menu can be opened

In maps/_e3/_e3_01_02/_e3_01_02.hps, SOMA calls PauseMenu_Show as follows.

PauseMenu_Show(true);
Parameter Value in this stock call
abActive true

This is an excerpt from that stock script; its referenced names and variables belong to that script.

MainMenu_SetBGPhase

Change main menu BG state

In maps/chapter05/05_02_ARK_inside/05_02_ARK_inside.hps, SOMA calls MainMenu_SetBGPhase as follows.

MainMenu_SetBGPhase(eMainMenuPhase_AfterEnd);
Parameter Value in this stock call
aPhase eMainMenuPhase_AfterEnd

This is an excerpt from that stock script; its referenced names and variables belong to that script.

Check your change

Save the script and restart the map in development mode with F5. If the script fails, open F1 and use Show Error List or Show HPL Log. See the development loop for the launch and debugging steps.

See also