Inventory Handler
The Inventory Handler presents the player’s tool inventory. Inventory_SetEnabled enables or disables the show-inventory key; the source explicitly describes Inventory_AutoEnable as showing the inventory.
Contents
Before you start
- Open the map script inside your own mod. Keep its generated includes,
cScrMap : iScrMapclass and callback structure. See Add your first script if you have not edited a map script yet. - Add the helper include shown below alongside the script’s other includes.
- 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"
Inventory_SetEnabled
Disables/enables the 'show inventory' key.
In maps/chapter05/05_01_phi_inside/05_01_phi_inside.hps, SOMA calls Inventory_SetEnabled as follows.
Inventory_SetEnabled(false);
| Parameter | Value in this stock call |
|---|---|
abEnabled |
false
|
This is an excerpt from that stock script; its referenced names and variables belong to that script.
Inventory_AutoEnable
This really means 'show the inventory!' but too late to rename now. :-D
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.
Read the example
The stock module’s OnAction checks for eAction_OpenInventory with abPressed == true and calls AutoEnable(3). This shows the inventory for three seconds; it does not add a tool to the inventory. The module’s update counts down that duration and fades the display away.