Lua:Menus

From Fortress Forever Wiki
Jump to: navigation, search


Mapping for FF
The Basics

Setting up Hammer
Getting Started With Lua
Releasing a map

FF-specific Entities

Lua location system

Map Templates
FF Lua Documentation

Entity Typing
Entity Collections

Commands
Callbacks

Screen Menus

Numerical menus can be shown to players through Lua commands. The player presses a number key to make a selection.

Commands

  • ShowMenuToPlayer( player, menu_name )
  • ShowMenuToTeam( team_id, menu_name )
  • ShowMenu( menu_name )
  • CreateMenu( menu_name )
  • CreateMenu( menu_name, title )
  • CreateMenu( menu_name, display_time )
  • CreateMenu( menu_name, title, display_time )
  • DestroyMenu( menu_name )
  • SetMenuTitle( menu_name, title )
  • AddMenuOption( menu_name, slot, option_text )
  • RemoveMenuOption( menu_name, slot )

Parameters

  • menu_name(string) A name with which to control the menu
  • player(CFFPlayer) The player to show the menu to
  • team_id(CFFTeam) the team to show the menu to
  • title(string) a header to display above the menu options
  • display_time(integer) Maximum number of seconds to display the menu.
  • slot(integer) The number to associate with a menu option (0-9 only).
  • option_text(string) The text to display for each menu option.

Callbacks

Use these callbacks to detect when a player either picks a menu option, or lets the menu expire

  • player_onmenuselect( player, menu_name, selection )
  • menu_onexpire( menu_name, num_players_shown_to )
  • selection(integer) is the option that was selected
  • num_players_shown_to (integer?) Seems pretty self-explanatory but I'm not sure what the utility of this is.