My menu system ftw!
// This is our header. Version 2.
pb2menu 2
// This widgets will always draw.
// They are 'global'.
// Our 'back' button.
WIDGET back BEGIN valign bottom ybot -8 xabs 8 type text command "menu pop" text "Back" END
// Our title picture.
WIDGET title_pic BEGIN type pic pic "m_setup1s" xcent 0 halign center yabs 16 END
// This is the header. The Look, Weapon, Move, and Misc widgets.
// When clicked they refresh the menu passing an argument, the argument will override the default event.
WIDGET title_look BEGIN xcent -128 yabs 64 halign center text "[Look]" command "menu refresh LOOK" END
WIDGET title_weapon BEGIN xcent -43 yabs 64 halign center text "[Weapon]" command "menu refresh WEAPON" END
WIDGET title_move BEGIN xcent 42 yabs 64 halign center text "[Move]" command "menu refresh MOVE" END
WIDGET title_misc BEGIN xcent 127 yabs 64 halign center text "[Misc]" command "menu refresh MISC" END
// Everything after this is 'dynamic'
// Widgets will draw on events.
// This event will load on default.
ON LOAD
CALL LOOK // Calls the LOOK event.
OFF
// The Look widget got clicked.
ON LOOK
// Change the look of the title_look widget, so its highlighted.
// The title_look widget is defined above, in the 'global' widgets.
WIDGET title_look BEGIN xcent -128 yabs 64 text "ˆE[Look]" END
// Draw Look stuff.
WIDGET look_minput BEGIN type checkbox y 88 xcent -8 halign right cvar in_mouse text "Use Mouse Input" END
WIDGET look_mfree BEGIN yrel 10 halign right type checkbox cvar freelook text "Mouse Freelook" END
WIDGET look_invert BEGIN yrel 10 halign right type checkbox cvar m_invert text "Invert Mouse" END
WIDGET look_msmooth BEGIN yrel 10 halign right type checkbox cvar m_filter text "Mouse Smoothing" END
WIDGET look_sensitivity BEGIN yrel 10 type slider halign right cvar sensitivity text "Sensitivity" min .5 max 20 END
WIDGET look_binds BEGIN xcent 0 yrel 16 halign center nobackground type select width 38 height 10
begin binds
"+lookup" " Look Up: "
"+lookdown" " Look Down: "
"+left" " Turn Left: "
"+right" " Turn Right: "
"centerview" " Center View: "
"+mlook" " Mouse Look: "
"+klook" " Keyboard Look: "
end
END
WIDGET look_joystick BEGIN y 88 xcent 8 type checkbox cvar in_joystick text "Use Joystick" END
WIDGET look_strafe BEGIN yrel 10 type checkbox cvar lookstrafe text "Look Strafe" END
WIDGET look_advjoy BEGIN yrel 16 text " Advanced Joystick " command "menu setup_joystick" END
OFF
// The Weapon widget got clicked.
ON WEAPON
// Change the look of the title_weapon widget, so its highlighted.
// The title_weapon widget is defined above, in the 'global' widgets.
WIDGET title_weapon BEGIN xcent -43 yabs 64 text "ˆE[Weapon]" END
// Draw Weapon stuff.
WIDGET weapon_binds BEGIN xcent 0 y 100 halign center nobackground type select width 38 height 10
begin binds
"+attack" " Fire Gun: "
"+tossgren" " Prime/Throw Grenade: "
"tossgren timed" " Throw Timed Grenade: "
"tossgren impact" "Throw Impact Grenade: "
"tossgren" " Throw Grenade: " "dropgren" " Drop Grenade: "
"empty_co2" " Reload CO2: "
"dropgun" " Drop Gun: "
"dropammo large" " Drop Large Ammo: "
"dropammo small" " Drop Small Ammo: "
"drophopper" " Drop Hopper: "
"dropbarrel" " Drop Barrel: "
"dropco2" " Drop CO2: "
"cvar_inc hand 1 0 2" " Switch Hand: "
end
END
OFF
// The Move widget got clicked.
ON MOVE
// Change the look of the title_move widget, so its highlighted.
// The title_move widget is defined above, in the 'global' widgets.
WIDGET title_move BEGIN xcent 42 yabs 64 text "ˆE[Move]" END
// Draw Move stuff.
WIDGET move_run BEGIN xcent 0 y 88 halign right type checkbox text "Always Run" cvar cl_run END
WIDGET move_mfspeed BEGIN yrel 14 x 64 type field width 4 text "Mouse Forward Speed" cvar m_forward END
WIDGET move_msspeed BEGIN yrel 14 x 64 type field width 4 text "Mouse Side Speed" cvar m_side END
WIDGET move_binds BEGIN xcent 0 yrel 16 halign center nobackground type select width 38 height 10
begin binds
"+forward" " Walk Forward: "
"+back" " Walk Backward: "
"+moveleft" " Step Left: "
"+moveright" " Step Right: "
"+moveup" " Up / Jump: "
"+movedown" " Down / Crouch: "
"+speed" " Walk / Run: "
"+strafe" " Strafe: "
end
END
OFF
// The Misc widget got clicked.
ON MISC
// Change the look of the title_misc widget, so its highlighted.
// The title_misc widget is defined above, in the 'global' widgets.
WIDGET title_misc BEGIN xcent 127 yabs 64 text "ˆE[Misc]" END
// Draw Misc stuff.
WIDGET misc_noalt BEGIN yrel 32 xcent 0 halign right cvar win_noalttab type checkbox text "Disable Alt-Tab" END
WIDGET misc_binds BEGIN xcent 0 yrel 16 halign center nobackground type select width 38 height 10
begin binds
"messagemode" " Chat: "
"messagemode2" " Chat (Team): "
"+scores" " Scoreboard: "
"dropflag" " Drop Flag: "
"camera" " Chase Camera: "
"invnext" "Next Camera Target: "
"invprev" "Prev Camera Target: "
"noclip" " Noclip Observer: "
"screenshot" " Take Screenshot: "
end
END
OFF
Also, variables in menus are pretty easy to add, although the way I did it was a quick hack.