In Part VII we will examine the non-ingame skirmish menu to see any special features it may contain.
The skirmish Menu
This is the menu used when we want to start a single player team game. This type of game uses the information from the teaminfo.txt file to create two teams of bots (plus the player) that compete against each other. In the onOpen script of this menu we must setup the information about single player games so we can choose our game type and teams.
The first thing we want to do is load up the maps we have avalible in single player mode. For that we use the uiScript loadGameInfo command. This loads and parses the gameinfo.txt file which contains, amongst other things, the list of single player maps. While this file is loaded and parsed by default at startup time, the list of maps will be overwritten if we go to the createserver menu and it runs the uiScript loadArenas command. Therefore, we have to reload each time want to play a single player game, just to be sure.
The next thing we have to do is update all the internal information that is based on the map list. This is done by the uiScript "updateSpMenu" "skirmish" command. One of the oddities of the updateSpMenu command is that it is meant to be used, by default, from a menu named skrimish. If you want to use it from a menu with another name then you must specify the menu name after the command. In this case, the skrimish name has been added just to demonstrate the correct format. Only the version of the dll or qvm file avalible on this site allows the specifying of the menu name.
Next we get the number of members on each team for the default selected map. This is accomplished using the uiScript getTeamMembers command. If this wasn't done at menu open we would display an incorrect number of team members until we selected another map.
And lastly, we must mask off those game types that the Freezer Tag mod doesn't support using the uiScript maskGameType 5 6 7 command. This will keep game types 5, 6 and 7 from appearing in our list of game types. Since we shouldn't leave these game types masked off after the menu is closed, in the onClose script we execute the uiScript unmaskGameType command to clear out the mask.
To display a picture of the maps we use the mappreview item, which uses the ownerdraw UI_MAPCINEMATIC command to draw a cinematic or levelshot of the map we have selected from our list box. The mapback item draws a frame overtop of the map picture and also provides a background for the list box. The maplist item is a list box that uses the feeder FEEDER_MAPS command to display a text listing of the maps we loaded back in the onOpen script. We use the columns command to format the text listing of the map names, moving it 5 pixels over from the right side of the list box and limiting the name to a maximum of 40 characters. Since each map may have a different number of team members allowed in it, we use the List box action script to get the number of team members after we change maps. This is done using the uiScript getTeamMembers command.
The varback item is used to display a background for the information we provide when creating the game. This information is entered or set using the following items.
There are two items named gametype that allow us to select the type of game we wish to start. One just displays the "GameType:" text, while the other uses the ownerdraw UI_GAMETYPE command to allow us to select the correct game type. The mask we created with the uiScript maskGameType command back in the onOpen script affects what game types we can select from.
The two items named clan are used to select the name of the team we wish to be on. The first item just displays the "Clan:" text, while the other uses the ownerdraw UI_CLANNAME command to allow us to select among the teams we defined in the teaminfo.txt file. The clanlogo item uses the ownerdraw UI_PLAYERLOGO command to display the graphic associated with the team we have selected.
The two items named opponent are used to select the name of the team we wish to oppose. The first item just displays the "Opponent:" text, while the other uses the ownerdraw UI_OPPONENT_NAME command to allow us to select among the teams we defined in the teaminfo.txt file. The opponentlogo item uses the ownerdraw UI_OPPONENTLOGO command to display the graphic associated with the team we have selected.
The two items named skill are used to set the skill level of the game. This first just displays the "Skill:" text while the other uses the ownerdraw UI_SKILL command to allow us to select the skill level we want. The bots will use this skill level to adjust their AI skills.
The members item is a Numeric Edit field item that is used to display the contents of the ui_TeamMembers cvar. This cvar contains the number of team members allow for the selected map that we fetched using the uiScript getTeamMembers command. Since this value is unalterable we use the decoration command to stop this item from ever getting the focus.
The createbutton item is a Button item used to start the single player game. It's action script first close the menu and then executes the uiScript skirmishStart command. This starts the single player game using the information we provided using the above items and the information about the map loaded from the maps section of the gameinfo.txt file.
The backbutton item is a Button item who's action script closes this menu and opens the play menu, returning us to the previous menu.
Part VIII : Join and Associated Menus
[Part I] [Part II] [Part III] [Part IV] [Part V] [Part VI] [Part VII] [Part VIII] [Part IX] [Part X]