In Part IV we will examine the non-ingame controls menu and its associated overlay menus to see any special features they may contain. The controls menu uses overlay menus that are opened and closed to display the different sections of the menu. The controls menu is the master menu that is always on screen and, therefore, it is set to be a fullscreen menu. Each time you select a different section of the menu (using buttons) it closes out the current overlay menu and opens another one. This allows multiple menus to share the same screen area without conflict.
When using overlay menus one important thing must be remembered - it is not possible to open an overlay menu from the onOpen script of the master menu. Since you you want an overlay menu displayed when the master menu first opens another method must be used. If you remember back to our look at the main menu, you'll see that when we clicked on the CONTROLS button the action script opened the controls menu and then opened the look menu, which is the overlay menu we wish displayed when controls first opens.
Because we are using overlay menus rather than popup menus the items in both the master and overlay menus can recieve the focus. This allows us to use the buttons in the master menu to change which overlay menu is currently open.
The controls Menu
The first interesting section is the onOpen command in the Overall Menu Information section. Since this menu deals with binding keys to game actions we must load those binds into the program before we do anything else. This is done with the uiScript "loadControls" command. Without this command our binds would not be loaded from the q3config.cfg file.
The onClose command in the Overall Menu Information section also plays a major role in this menu. This command is executed when the menu closes and it runs the uiScript "saveControls" command. This saves the binds to the q3config.cfg file. Without this, any changes to the binds would not be saved and would be lost when the program ends.
The rest of the menu consists of five buttons used to load the different overlay menus plus a BACK button that allows use to return to the previous menu. Each of the five buttons, LOOK, MOVE, SHOOT, WEAPONS and MISC, action script does much the same thing - it closes the other four overlay menus and opens the overlay menu associated with it. Since none of the button items know which overlay menu is currently open, they close all menus that could possibly be open and then open the one they want. The BACK button's action script does a close all to close all the menus and then opens the main menu to return us to the previous menu.
The look Menu
This menu is an overlay menu, meant to be opened on top of a master menu. Because there is another menu displayed underneath this menu it does not have to be a fullscreen menu. The look menu is the default overlay menu opened when the controls menu is opened in the main menu.
Like all of the overlay menus associated with the controls menu, this menu contains a section of three items for displaying the model and certain bind messages. The modelselection item is used to display the current player model so we can see the actions we are binding to. Since we are working with the player model in this menu we have added the #include "ui/animdef.h" line at the top of the file.
Another part of this section is the keyBindStatus item. This is an ownerdraw item that tells us the status of our binding. See here for details. It places its text near the bottom of the menu and is set to be invisible when the menu opens. It will only be made visible when we are actually doing something with a bind.
Also in this section is the yesno_message item. Since some of the things we are dealing with in this menu are yes or no (ie. Always Run? requires a yes or no answer) we have to have a message telling the user that clicking on the item will change the yes or no value. This item places that message in the same area as the text from the keyBindStatus item and is normally invisible. It will be made visible only when the mouse is over a Yes/No item.
The other items in this menu are used to bind keys to actions pertaining to looking. The actions in this group are :
- Look Up - item lookup
- Look Down - item lookdown
- Mouse Look - item mlook
- CenterView - item center
- ZoomView - item zoom
- Free Look - item free
All of these items are of type ITEM_TYPE_BIND and contain text that is aligned to the right. This ensures that the key descriptions are all nicely lined up. The mouseEnter and mouseExit scripts are where things happen in these items.
When the mouse moves over each item there are several things that must be done. First, since this is a key bind item, we want to show the status of the binding. To do this we use the show keyBindStatus command to make the keyBindStatus item visible. This displays the bind status text at the bottom of the menu. And lastly, for certain items, we modify the player model (which is displayed on the screen) so we can see what the action does. For the lookup item this entails changing the ui_PlayerViewAnglePitch cvar and then updating the player model with uiScript UpdateModel. Without the update command the change to the cvar will not be shown.
When the mouse leaves the item we have to set things back to the way they were. This means we hide the keyBindStatus item and, if we made changes to the player model, then those cvars must be set back to their default values and the uiScript UpdateModel command run to make the changes show. See here for more information on the cvars that can be modified and their default values.

The move Menu
This menu is an overlay menu, meant to be opened on top of a master menu. Because there is another menu displayed underneath this menu it does not have to be a fullscreen menu. The move menu is opened by the action script of the MOVE button in the controls menu.
Like all of the overlay menus associated with the controls menu, this menu contains a section of three items for displaying the model and certain bind messages. The modelselection item is used to display the current player model so we can see the actions we are binding to. Since we are working with the player model in this menu we have added the #include "ui/animdef.h" line at the top of the file.
Another part of this section is the keyBindStatus item. This is an ownerdraw item that tells us the status of our binding. See here for details. It places its text near the bottom of the menu and is set to be invisible when the menu opens. It will only be made visible when we are actually doing something with a bind.
Also in this section is the yesno_message item. Since some of the things we are dealing with in this menu are yes or no (ie. Always Run? requires a yes or no answer) we have to have a message telling the user that clicking on the item will change the yes or no value. This item places that message in the same area as the text from the keyBindStatus item and is normally invisible. It will be made visible only when the mouse is over a Yes/No item.
The other items in this menu are used to bind keys to actions pertaining to moving. The actions in this group are :
- Run/Walk - item runwalk
- Always Run - item alwaysrun
- Forward - item forward
- Backpedal - item backward
- Move Left - item moveleft
- Move Right - item moveright
- Jump - item jump
- Crouch - item crouch
- Turn Left - item turnleft
- Turn Right - item turnright
- Strafe - item strafe
All but one of these items is of type ITEM_TYPE_BIND and contain text that is aligned to the right. This ensures that the key descriptions are all nicely lined up. The item alwaysrun is of type ITEM_TYPE_YESNO. Again, the mouseEnter and mouseExit scripts are where things happen in these items.
When the mouse moves over each item there are several things that must be done. First, since this is a key bind item, we want to show the status of the binding. To do this we use the show keyBindStatus command to make the keyBindStatus item visible. This displays the bind status text at the bottom of the menu. For the alwaysrun item, instead of making the keyBindStatus item visible, we make the yesno_message item visible, since this is a Yes/No item. And lastly, for certain items, we modify the player model (which is displayed on the screen) so we can see what the action does. For the alwaysrun item this entails changing the ui_LowerAnim cvar to LEGS_RUN and then updating the player model with uiScript UpdateModel. Without the update command the change to the cvar will not be shown.
When the mouse leaves the item we have to set things back to the way they were. This means we hide the keyBindStatus item (or yesno_message item for alwaysrun) and, if we made changes to the player model, then those cvars must be set back to their default values and the uiScript UpdateModel command run to make the changes show. See here for more information on the cvars that can be modified and their default values.

The shoot Menu
This menu is an overlay menu, meant to be opened on top of a master menu. Because there is another menu displayed underneath this menu it does not have to be a fullscreen menu. The shoot menu is opened by the action script of the SHOOT button in the controls menu.
Like all of the overlay menus associated with the controls menu, this menu contains a section of three items for displaying the model and certain bind messages. The modelselection item is used to display the current player model so we can see the actions we are binding to. Since we are working with the player model in this menu we have added the #include "ui/animdef.h" line at the top of the file.
Another part of this section is the keyBindStatus item. This is an ownerdraw item that tells us the status of our binding. See here for details. It places its text near the bottom of the menu and is set to be invisible when the menu opens. It will only be made visible when we are actually doing something with a bind.
Also in this section is the yesno_message item. Since some of the things we are dealing with in this menu are yes or no (ie. Always Run? requires a yes or no answer) we have to have a message telling the user that clicking on the item will change the yes or no value. This item places that message in the same area as the text from the keyBindStatus item and is normally invisible. It will be made visible only when the mouse is over a Yes/No item.
The other items in this menu are used to bind keys to actions pertaining to shooting. The actions in this group are :
- Attack - item attack
- Prev Weapon - item prev
- Next Weapon - item next
- Autoswitch - item auto
All but one of these items is of type ITEM_TYPE_BIND and contain text that is aligned to the right. This ensures that the key descriptions are all nicely lined up. The item auto is of type ITEM_TYPE_YESNO. Again, the mouseEnter and mouseExit scripts are where things happen in these items.
When the mouse moves over each item there are several things that must be done. First, since this is a key bind item, we want to show the status of the binding. To do this we use the show keyBindStatus command to make the keyBindStatus item visible. This displays the bind status text at the bottom of the screen. For the auto item, instead of making the keyBindStatus item visible, we make the yesno_message item visible, since this is a Yes/No item. And lastly, for certain items, we modify the player model (which is displayed on the screen) so we can see what the action does. For the attack item this entails changing the ui_UpperAnim cvar to TORSO_ATTACK and then updating the player model with uiScript UpdateModel. Without the update command the change to the cvar will not be shown.
When the mouse leaves the item we have to set things back to the way they were. This means we hide the keyBindStatus item (or yesno_message item for auto) and, if we made changes to the player model then those cvars must be set back to their default values and the uiScript UpdateModel command run to make the changes show. See here for more information on the cvars that can be modified and their default values.

The weapon Menu
This menu is an overlay menu, meant to be opened on top of a master menu. Because there is another menu displayed underneath this menu it does not have to be a fullscreen menu. The weapon menu is opened by the action script of the WEAPONS button in the controls menu.
Like all of the overlay menus associated with the controls menu, this menu contains a section of three items for displaying the model and certain bind messages. The modelselection item is used to display the current player model so we can see the actions we are binding to. Since we are working with the player model in this menu we have added the #include "ui/animdef.h" line at the top of the file.
Another part of this section is the keyBindStatus item. This is an ownerdraw item that tells us the status of our binding. See here for details. It places its text near the bottom of the menu and is set to be invisible when the menu opens. It will only be made visible when we are actually doing something with a bind.
Also in this section is the yesno_message item. Since some of the things we are dealing with in this menu are yes or no (ie. Always Run? requires a yes or no answer) we have to have a message telling the user that clicking on the item will change the yes or no value. This item places that message in the same area as the text from the keyBindStatus item and is normally invisible. It will be made visible only when the mouse is over a Yes/No item.
The other items in this menu are used to bind keys to actions pertaining to selecting weapons. The actions in this group are :
- Gauntlet - item weapon1
- MachineGun - item weapon2
- Shotgun - item weapon3
- GrenadeLauncher - item weapon4
- RocketLauncher - item weapon5
- LightningGun - item weapon6
- Railgun - item weapon7
- Plasmagun - item weapon8
- BFG - item weapon9
All of these items are of type ITEM_TYPE_BIND and contain text that is aligned to the right. This ensures that the key descriptions are all nicely lined up. Again, the mouseEnter and mouseExit scripts are where things happen in these items.
When the mouse moves over each item there are several things that must be done. First, since this is a key bind item, we want to show the status of the binding. To do this we use the show keyBindStatus command to make the keyBindStatus item visible. This displays the bind status text at the bottom of the screen. And lastly, for all items, we modify the player model (which is displayed on the screen) so we can see what the action does. For the weapon1 item this entails changing the ui_Weapon cvar to WP_GAUNTLET and then updating the player model with uiScript UpdateModel. Without the update command the change to the cvar will not be shown.
When the mouse leaves the item we have to set things back to the way they were. This means we hide the keyBindStatus item and, if we made changes to the player model then those cvars must be set back to their default values and the uiScript UpdateModel command run to make the changes show. See here for more information on the cvars that can be modified and their default values.

The misc Menu
This menu is an overlay menu, meant to be opened on top of a master menu. Because there is another menu displayed underneath this menu it does not have to be a fullscreen menu. The misc menu is opened by the action script of the MISC button in the controls menu.
Like all of the overlay menus associated with the controls menu, this menu contains a section of three items for displaying the model and certain bind messages. The modelselection item is used to display the current player model so we can see the actions we are binding to. Since we are working with the player model in this menu we have added the #include "ui/animdef.h" line at the top of the file.
Another part of this section is the keyBindStatus item. This is an ownerdraw item that tells us the status of our binding. See here for details. It places its text near the bottom of the menu and is set to be invisible when the menu opens. It will only be made visible when we are actually doing something with a bind.
Also in this section is the yesno_message item. Since some of the things we are dealing with in this menu are yes or no (ie. Always Run? requires a yes or no answer) we have to have a message telling the user that clicking on the item will change the yes or no value. This item places that message in the same area as the text from the keyBindStatus item and is normally invisible. It will be made visible only when the mouse is over a Yes/No item.
The other items in this menu are used to bind keys to actions pertaining to actions that don't fit any other group. The actions in this group are :
- Use Item - item useitem
- Show Scores - item showscores
- Gestures - item gestures
- Chat - item chat
- Team Chat - item teamchat
- Target Chat - item targetchat
- Attack Chat - item attackchat
All of these items are of type ITEM_TYPE_BIND and contain text that is aligned to the right. This ensures that the key descriptions are all nicely lined up. Again, the mouseEnter and mouseExit scripts are where things happen in these items.
When the mouse moves over each item there are several things that must be done. First, since this is a key bind item, we want to show the status of the binding. To do this we use the show keyBindStatus command to make the keyBindStatus item visible. This displays the bind status text at the bottom of the screen. And lastly, we may modify the player model (which is displayed on the screen) so we can see what the action does. For the gesture item this entails changing the ui_UpperAnim cvar to TORSO_GESTURE and then updating the player model with uiScript UpdateModel. Without the update command the change to the cvar will not be shown.
When the mouse leaves the item we have to set things back to the way they were. This means we hide the keyBindStatus item and, if we made changes to the player model then those cvars must be set back to their default values and the uiScript UpdateModel command run to make the changes show. See here for more information on the cvars that can be modified and their default values.

Part V : Setup and Associated Menus
[Part I] [Part II] [Part III] [Part IV] [Part V] [Part VI] [Part VII] [Part VIII] [Part IX] [Part X]