Athan's Q3F Beta2 HUD Editting HOWTO

Introduction

The intent of this document is to give anyone with reasonable scripting skills enough knowledge to be able to get the Q3F Beta2 HUD to do anything they desire within the limits of the code.

Note that this document is only a HOWTO, and as such lists what settings are available, and with which values, it is NOT a full tutorial.

Many thanks go to the q3f dev team for coming up with such a customisable hud, especially djbob for letting me pester him lots about how things work, correcting me when I made false statements in these docs and enlightening me on how a few things actually work.

Definitions

You'll see 'MENU_TRUE' and 'MENU_FALSE' used a lot, especially following 'visible'. The 'MENU_' part is a red herring in a way, as these are literally just values for 'TRUE' and 'FALSE'.

Guidelines

First a few guidelines.

  1. Rather than comment out an item it's often a lot easier to just change its 'visible MENU_TRUE' to 'visible MENU_FALSE'. This makes it a lot quicker to toggle something on or off. Also if you remove anything but the 'text' on an item you'll find it won't show up on /edithud, so keep borders etc around, just MENU_FALSE'd so you can turn them on if you WANT to use /edithud to move them.
  2. You do NOT need a 'name' line in itemDef's, only on menuDef's. Use a comment on itemDef's instead.
  3. On the HUD all itemDef's should have the 'decoration' keyword to indicate they're not selectable. In many cases this means you will not then need a 'type' keyword.
  4. To comment something out just put "//" (without the quotes) at the beginning of the line (actually just before the bit you need to comment).
  5. If you need to combine flags on something, an anchorx for instance, you'll need to use $evalint, i.e. anchorx $evalint(ANCHOR_AUTOSIZE_WIDTH + ANCHOR_CENTER)
  6. All co-ordinates are given on a 640 x 480 grid, then scaled as necessary for your actual in-use screen resolution. 0,0 is top left, 639,0 top right, 0,639 bottom left and 639,479 bottom right.

Current HUD Items

I'll list the 'name' part of the menuDef's what they actually cause to be displayed on-screen. The itemDef's within each of these sections should be obvious enough as to what they control:

Structure of an Item

Any item starts with a menuDef, you then have a pair of braces {} around the content. For readability I suggest you stick to the format in the supplied menu files.

Within a menuDef you will have a few options, including its name and then a number of itemDefs which define what actually appears in the item. For readability I suggest you always keep the name entry first.

Per-menuDef & itemDef Options

Using The Contents of a Variable

You can have the text of an item be set by the contants of a q3 client variable:

Hiding/Showing An Item On The Fly

If there is some area of the HUD that you want to toggle on/off with your game config, rather than by editting the hud file or using multiple versions you can do this!

Simply make an alias that does 'hudscript hide <name of menuDef>' to turn that menuDef off temporarily, and another with 'hudscript show <name of menuDef>' to turn it back on again.

Using Custom Graphics

In theory this should be possible just by renaming an appropriate-format TGA file to <whatever>.cfg and then referencing it. As of build23 this wasn't working. As of RC1 I've been told this now won't be possible due to how the pure system works.

How To Actually Define Your Own HUD

A few simple steps will get you up and running. First go into your q3f (beta2) directory. Now extract the ui/ directory from <q3f_core_200.pk3> (q3f_core_200_rc2.pk3 in RC2). Rename this to custom_ui/. You actually only need the following:

	custom_ui/hud/hud.menu
	custom_ui/hud.cfg (renamed from hud.txt)
	
although it's handy to have these as well:
	custom_ui/ingame.txt
	custom_ui/menudef.h
	custom_ui/menus.txt
	
for reference.

Edit the hud.cfg (renamed from hud.txt) file so that the line:

	loadMenu { "ui/hud/hud.menu" }
	

becomes

	loadMenu { "custom_ui/hud/hud.menu" }
	

You can leave the other lines pointing to "ui/..." so that they still use the default ones and you don't have to worry about extracting new versions if they're changed in new releases.

Now to edit the hud you just make changes to the custom_ui/hud/hud.menu file. To make the game use your changes you'll need to set/change the following variables in your q3config.cfg for q3f:

	seta cg_hudFiles "custom_ui/hud.cfg"
	seta cg_userHud "-1"
	

The latter is necessary so that the positions you define in hud.menu are actually used. Otherwise the file ui/userhud<x>.cfg is used, for <x> being the value of the cg_userHud variable. Note that id you use the /edithud command this variable WILL be changed again and you'll have to re-set it to -1 if you want the position values in hud.menu to take effect again.

If you make changes to your hud and want to test the changes without restarting q3(f) simply use the /loadhud command in the console.