Single Player Tutorial Part VII

In Part VII we will examine the ingame insave and inload menus to see any special features they may contain.

As in all the previously examined menus, the first part of the file contains the itemDefs for the background, the main buttons and their associated glow and mouseover text. It is only after the section looking like the following that menu specific items are defined.

/*********************************************************************/
//
// Start of menu Specific Items
//
/*********************************************************************/

The inload Menu

The onOpen script in the Overall Menu Information section contains one very important command. This is the uiScript LoadSave command, which is used to load the saved games into the FEEDER_SAVE feeder so we can view them in a list box. Without this command no saved games would be shown in the list box.

The savelist item is a list box item that we use to display the saved games via the FEEDER_SAVE feeder. This feeder was primed back in the onOpen script in the Overall Menu Information section. It is a text list box with a background and a border and it contains the doubleClick script command. This command is run when you double click on any of the saved games listed in the box.

      uiScript LoadGame ;
exec "spmap aircrash" ;

The uiScript LoadGame command transfers the selected list box entry into the ui_LoadGame cvar so we can use it when The Dark Conjunction mod checks to see if a saved game should be loaded. Then we use the exec command to execute spmap aircrash as a console command. When the spmap command goes to run the aircrash level it checks the ui_LoadGame cvar and, since it contains a saved game name, the saved game is loaded.

The lbeginbutton item is a button used to load and run a saved game. It's action script is identical to the doubleClick script in the savelist item, since they do the same thing.


The insave Menu

Like the inload menu, the onOpen script in the Overall Menu Information section contains one very important command. This is the uiScript LoadSave command, which is used to load the saved games into the FEEDER_SAVE feeder so we can view them in a list box. Without this command no saved games would be shown in the list box. Also in this section is the setcvar ui_SaveGame "Autosave" command. This sets the default name for our saved game to Autosave. Not strictly necessary but a nice touch.

The onClose script in the Overall Menu Information section also contains an important command. This is the clearcvar ui_SaveGame command. In this menu we only want to save the game if we click on the SAVE button but, if we entered a name into the name edit field, the game would also be saved if we closed this menu and opened another one, then resumed the game from that menu. The onEsc script also clears the cvar before unpausing the game to avoid doing an unwanted save.

The RESUME button's action script also has one slight modification. In this menu we only want to save the game if we click on the SAVE button but, if we entered a name into the name edit field, the game would also be saved when we clicked on RESUME. To stop this from happening we add the clearcvar ui_SaveGame command to the RESUME button's action script.

The savegame item is an edit field item attached to the ui_SaveGame cvar. This cvar is used by The Dark Conjunction mod to see if a game should be saved. If this cvar contains a name then the current level is saved under that name once you return to game play.

The savelist item is a list box item that we use to display the saved games via the FEEDER_SAVE feeder. This feeder was primed back in the onOpen script in the Overall Menu Information section. It is a text list box with a background and a border and it contains the doubleClick script command. This command is executed when you double click on any of the saved games listed in the box and runs the uiScript SaveGame command. This transfers the selected list box entry into the ui_SaveGame cvar, which is attached to our edit field item.

The SAVE button is defined by the lsavebutton item. This is a standard button with a glow item. It's action script hides the button glow and closes all menus and unpauses the game with the uiScript "closeingame" command. The game will be saved using the name we placed in the ui_SaveGame cvar once the game play resumes.

 

 

[Part 1] [Part II] [Part III] [Part IV] [Part V] [Part VI] [Part VII]

 

Return to Home Page