Description Handler
The Description Handler displays localized description messages. Description_Add supplies a language category and entry, a display-time multiplier and a switch for queuing when another message is showing. The returned message ID can be compared with Description_GetCurrentId.
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"
Description_Add
In maps/_e3/_e3_01_01/_e3_01_01.hps, SOMA calls Description_Add as follows.
Description_Add("02_05_theta_inside", "ScanRoom_Legacy_Loading", 20, false);
| Parameter | Value in this stock call |
|---|---|
asTextCat |
"02_05_theta_inside"
|
asTextEntry |
"ScanRoom_Legacy_Loading"
|
afTimeMul |
20
|
abPutInQueueIfShowing |
false
|
This is an excerpt from that stock script; its referenced names and variables belong to that script.
Description_GetCurrentId
In script/areas/Area_Description.hps, SOMA calls Description_GetCurrentId as follows.
Description_GetCurrentId();
This is an excerpt from that stock script; its referenced names and variables belong to that script.
Description_IsActive
In script/areas/Area_Description.hps, SOMA calls Description_IsActive as follows.
Description_IsActive();
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.
Read the example
The text category and entry are looked up through the language system; an empty category uses the entry as literal text. The display duration is cLux_GetStringDuration(sText) * afTimeMul, so afTimeMul is a multiplier, rather than a number of seconds. When a description is active, a true queue flag queues the new text; otherwise it starts immediately. Add returns the current message ID, including when the new text has only been queued.