MultiPlayer Tutorial Part VIII

In Part VIII we will examine the non-ingame join menu and its associated popup menus to see any special features they may contain.

The join Menu

This is the menu we use when we wish to join another server hosting a Freeze Tag game. It is opened from the multi menu using the joinbutton item. Since we are attempting to join a game that is not one of the standard games supported by the program we must set things up so we only look for servers hosting Freeze Tag games. See the Server Filter for more details. This is done in the onOpen script.

To make the server filter select only Freeze Tag servers we must set the ui_serverFilterType cvar to -1 using the setcvarfloat ui_serverFilterType -1 command. This forces the filter to look to the ui_CustomServer cvar for the mod type. We use the setcvar ui_CustomServer "freeze" command to make the filter accept only games of type freeze, which is used by the Freeze Tag mod.

Lastly, we use the uiScript UpdateFilter command to update the server filter to refect the changes we have made to it. This will update the servers displayed in our server list but it will only do it from the already stored server list. It won't fetch a new list of servers using this command.

This menu is different that all other menus when it comes to handling the ESC key. Every other menu uses the ESC key to close the menu and open the previous one, exactly like clicking on the BACK button. In this menu the ESC key is used to stop refreshing the server list so the onEsc script contains the uiScript StopRefresh command.

The menu is broken up into several sections, each with their own purpose, and we'll look at them seperately. The first section deals with the Server Filter and contains those items that allow us to setup the filter.

Server Filter

The header item displays the background that the other filter items will be placed on. The gamesource item uses the ownerdraw UI_NETSOURCE command to allow us to choose where the server list is obtained, locally, internet or favorites list.

The emptyesbutton item and the emptynobutton item are used together to set whether or not to show servers that are empty (have no players). The ui_browserShowEmpty cvar controls this feature and we use it to determine which item is displayed. In the emptyesbutton item we test the cvar and use the showCvar command to display this item if the cvar is 1 and the hideCvar command to hide it if the cvar is 0. In the emptynobutton item we test the cvar and use the showCvar command to display this item if the cvar is 0 and the hideCvar command to hide it if the cvar is 1. In this way the item that is displayed reflects the state of the ui_browserShowEmpty cvar. The action script of each item, run when the item is clicked on, simply changes the state of the ui_browserShowEmpty cvar to the opposite value and then refreshes the server filter with the uiScript RefreshFilter command to reflect the change just made.

The fullyesbutton item and the fullnobutton item are used together to set whether or not to show servers that are efull (have no slots avalible). The ui_browserShowFull cvar controls this feature and we use it to determine which item is displayed. In the fullyesbutton item we test the cvar and use the showCvar command to display this item if the cvar is 1 and the hideCvar command to hide it if the cvar is 0. In the fullnobutton item we test the cvar and use the showCvar command to display this item if the cvar is 0 and the hideCvar command to hide it if the cvar is 1. In this way the item that is displayed reflects the state of the ui_browserShowFull cvar. The action script of each item, run when the item is clicked on, simply changes the state of the ui_browserShowFull cvar to the opposite value and then refreshes the server filter with the uiScript RefreshFilter command to reflect the change just made.

The refreshbutton item is a button item used to do a complete refresh of the server list. It's action script runs the uiScript RefreshServers command, which reloads the server list from the source specified by the gamesource item and creates the server list based on the filter defined in this section.

Map Cinematic

Another section of the menu is used to display the levelshot graphic or cinematic for the map on the server we have selected in the server list. The two items in this section are named mappreview. The first item uses the ownerdraw UI_NETMAPCINEMATIC command to display the graphic while the second draws a graphic frame over top of the levelshot.

Server List

The largest section of the menu is used to display the list of servers that are avalible. The server item displays the background graphic that all other items in this section are placed on. The centerpiece of this section is the serverlist item, a List box item using the feeder FEEDER_SERVERS command to display the list of servers meeting our filter requirements. It is a text list box and it uses the columns command to format the information returned by the feeder.

Unlike most feeders, the feeder FEEDER_SERVERS command returns six pieces of information about each server and we must use the columns command to format this when it is displayed. Without this command we wouldn't be able to see all the information. Here's how the information is formatted :

Name of Information Pixel Offset from Left
Max # of Characters Displayed
Host Name
0
30
Map Name
240
20
# of Clients
350
10
Game Type
410
7
Ping
500
4
Punkbuster Required
550
3

Getting these values requires some trial and error in order to make everything fit on the line of text.

The refreshinfo item uses the ownerdraw UI_SERVERREFRESHDATE command to display information about the status of the server refresh. It is placed at the bottom of the server list background graphic. When the list is actively being refreshed it tells you how many total servers are in the list being filtered and when it is not refreshing it tells you the time of the last refresh.

The infobutton item is a button item used to open a popup menu named serverinfo that displays information about the server we have selected in the server list.

One of the features of the server list, as created by the feeder FEEDER_SERVERS command, is that the display can sorted by column. This means that if you want the list to be sorted by, say game type, you can do it. The sorting is done by button items which we place at the top of the server list background graphic. Each column has two items associated with the sorting, an item displaying a background graphic and the button item. We'll examine the items used to sort the Host Name column.

The nametabback item displays a Tab style graphic behind the nametab item, which is the button item. The size of the graphic is altered so it fits the length of the button's text. The nametab item uses a window style of FILLED so we can color it using the backcolor command. You'll see that by default this color has an alpha of 0 so it doesn't do any coloring of the window. The action script of this item does the actual list sorting and highlighting of the sort items. The sorting is done by the uiScript ServerSort command. You must provide it with a column number so it knows which column to sort the list by so in this item we execute the command as uiScript ServerSort 0. Other column require a different number. Then, to show us which column the list is sorted by, we change the backcolor of all the sort button items. We set the alpha of this item to something larger than 0 so the color shows and set the alpha of all the other button items to 0 so nothing shows on them. This highlights the button above the column by which the list is sorted. Each column is sorted in exactly the same way using the two items associated with that column and acting in the same manner.

The Punkbuster column does not have these two items associated with it so we can not sort the list by this column. It is possible to do this but I decided not to include that feature. Instead, this column has a graphic displayed at the top using the pbback item.

Favorites List

The scripting system allows you to place certain selected servers into a Favorites list and display only those in the server list. To manage this list we must be able to add and delete servers from the Favorites list. This is done through another section of the menu. This section consists of buttons that open up popup menus to allow us to manage the list. The background for this section is supplied by the favorites item, while the button items are fnewbutton, faddbutton and fdelbutton. These open popup menus to allow us to make a new favorite, add a favorite from the server list and delete a favorite from the list. These menus, newfavorite, addfavorite and delfavorite, will be looked at later.

Other Buttons

There a few other items in the menu that perform other tasks and are lumped together in this section. These items are all button items.

The backbutton item is used to close out this menu and return to the previous menu. It's action script executes the uiScript closeJoin command to properly stop all server related actions before it closes the menu and reopens the multi menu.

The joinbutton item is used to join the server we have selected in the server list. It's action script closes all menus that may be open and then executes the uiScript JoinServer command. This takes care of all the steps needed to join a server.

The findbutton button item is placed on a graphic background displayed by the findback item. This item opens the findplayer popup menu that allows us to find a specific player on one of the servers.

The last button is the passbutton item, which is placed on top of the graphic displayed by the passback item. This button opens the password menu to allow us to enter a password, if one is required when joining the server.

 

The serverinfo Menu

This menu is a popup menu used to display information about the server we have selected in the server list in the join menu. In order to display the information, we must get the information from the server first. This is done in the onOpen script using the uiScript ServerStatus command. This primes the FEEDER_SERVERSTATUS feeder so we can use it to show the information in a list box.

The background graphic for this menu is displayed by the background item and the list box containing the server information is shown by the info item. This is a text list box using the feeder FEEDER_SERVERSTATUS command and it is used for display puposes only, so we include the notselectable command to stop us from being able to select an element of the list.

This feeder returns four columns of information and it must be formated in the list box using the columns command. There are some things that must be taken into consideration when doing the formatting. This feeder actually returns two different groups of information. The first group uses the first and fourth columns to display the information and the second group uses all four columns. Therefore, you have to make the formatting fit each group. The columns values used in this item seem to work reasonably well.

The backbutton item is used to close this menu and reopen the join menu. Because we have to reopen the join menu the server we have selected in the server list will be changed to the first one in the list. This can not be avoided, as it is a consequence of using popup menus.

 

The newfavorite Menu

This menu is used to allow you to add a server to your Favorites list by entering its name and IP address. The text items are used to put a title on the menu. The name item is an Editfield item attached to the ui_favoriteName cvar that is used to enter the name of the server. It is limited, by the maxchars 20 command, to name of 20 characters in length. The ip item is an Editfield item attached to the ui_favoriteAddress cvar that is used to enter the IP address of the server.

The nobutton item is used to cancel creating a new favorite and it's action script closes this menu and reopens the join menu.

The yesbutton item is used to add the newly created favorite server to the Favorites list. This is done in it's action script by the uiScript CreateFavorite command. This command takes the ui_favoriteName cvar and the ui_favoriteAddress cvar and creates a new entry in the Favorites list. The script then closes this menu and opens the join menu.

 

The addfavorite Menu

This menu is used to add a server we have selected in the server list in the join menu to the Favorites list. Since we need to know the name of the server we are adding we must load that in the onOpen script. This is done using the uiScript getHostName command, which copies the server's name into the ui_HostName cvar. The text items are used to display a title on the menu, while the host item displays the name of the server. This item is an Editfield item attached to the ui_HostName cvar, set to display only by the decoration command. It is set to display a maximum of 30 characters by the maxPaintChars 30 command.

The yesbutton item is used to add the server to the Favorites list. This is done in it's action script by the uiScript addfavorite command. This takes the server selected in the server list and adds it to the Favorite list. It then closes the menu and reopens the join menu.

The nobutton item is used to cancel adding a favorite and it's action script closes this menu and reopens the join menu.

 

The delfavorite Menu

This menu is used to delete a server from the Favorites list. Since we need to know the name of the server we are deleting we must load that in the onOpen script. This is done using the uiScript getHostName command, which copies the server's name into the ui_HostName cvar. The text items are used to display a title on the menu, while the host item displays the name of the server. This item is an Editfield item attached to the ui_HostName cvar, set to display only by the decoration command. It is set to display a maximum of 30 characters by the maxPaintChars 30 command.

The nobutton item is used to cancel adding a favorite and it's action script closes this menu and reopens the join menu.

The yesbutton item is used to delete the server to the Favorites list. This is done in it's action script by the uiScript deletefavorite command. This takes the server selected in the server list and deletes it from the Favorite list, assuming the server was actually in the list. It then uses the uiScript UpdateFilter command to update the server list to reflect this deletion. Then it closes the menu and reopens the join menu.

 

The findplayer Menu

This menu is used when we wish to find a specific player on a server and have the option of joining that server. The background item displays the background graphic for the menu and the text item displays the title. The namefield item is an Editfield item attached to the ui_findplayer cvar. This cvar is used by other commands and is assumed to contain the name of the player you wish to find. A maximum of 20 characters can be entered for the name, due to the maxChars 20 command. When we change the player name (and press ENTER) we would like the search for the player to take place automatically. To do this we use the action script of the item to execute the ui_script FindPlayer command. This will search the server list for a player of the desired name and then prime the FEEDER_FINDPLAYER feeder, which can be used in a List box to display the list of servers with that player on them.

There are two List boxes in this menu. The servernamelist item is a text List box that uses the feeder FEEDER_FINDPLAYER command to display a list of servers that have a player with the name held in the ui_findplayer cvar. When you select a server from this list it affects the other List box.

The serverinfolist item is a text List box using the feeder FEEDER_SERVERSTATUS command to display information about the server selected in the servernamelist item. It is used for display puposes only, so we include the notselectable command to stop us from being able to select an element of the list. This feeder returns four columns of information and it must be formated in the list box using the columns command. There are some things that must be taken into consideration when doing the formatting. This feeder actually returns two different groups of information. The first group uses the first and fourth columns to display the information and the second group uses all four columns. Therefore, you have to make the formatting fit each group. The columns values used in this item seem to work reasonably well.

The searchbutton item is a button item that is used to search the server list for the player who's name we entered into the namefield item. Like that item, it's action script executes the ui_script FindPlayer command to prime the FEEDER_FINDPLAYER feeder with a list of servers with that player on them.

The joinbutton item is a button item used to join the server we have selected in the server list provided by the servernamelist item. It's action script executes the ui_script FoundPlayerJoinServer command to cause us to join the selected server.

The backbutton item is a button item used to close this menu and reopen the join menu.

 

The password Menu

This menu is used when we need to enter a password before joining a server. The background item displays the background graphic for the menu and the text item displays the title. The password item is an Editfield item attached to the password cvar. It is limited to the entry of 15 characters by the maxchars 15 command. The password cvar is used when we join a server to provide a password, if any is required.

The backbutton item is a button item used to close this menu and reopen the join menu.

 

Part IX : Ingame, Instart and Inaddbot Menus

 

[Part I] [Part II] [Part III] [Part IV] [Part V] [Part VI] [Part VII] [Part VIII] [Part IX] [Part X]

 

Return to Home Page