GUI Scripting: Parsing of Set 'Cmd': Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Tels (talk | contribs)
add
 
Tels (talk | contribs)
update
Line 7: Line 7:
are handled in <tt>idGameLocal::HandleMainMenuCommands()</tt> in ''game/game_loca.cpp''.
are handled in <tt>idGameLocal::HandleMainMenuCommands()</tt> in ''game/game_loca.cpp''.


For each of the parts "command", "argument1", "argument2" and the final ";" (even if this is ommitted!), the routine is called again. It therefore keeps a stack of these parts, and when it sees the final ";", handles the command and clears the stack before returning.
For each of the parts "command", "argument1", "argument2" and the final ";", the routine is called again.  


Even if you just use
It therefore keeps a stack of these parts, and when it has seen enough arguments, handles the command and clears the stack before returning. The routine will also complain if you give not enough arguments to a command.


set command
One special case is just using "set" "command", this will call <tt>HandleMainMenuCommands()</tt> twice, once with "command" and once with ";" as the ''menuCommand'' parameter. Any stray ";" as command is silently skipped.


the routine will be called twice, once with "command" and once with ";" as the ''menuCommand'' parameter.
=== Examples ===
 
set "cmd" "play sound/meta/menu/mnu_hover";
set "cmd" "log 'Some text here'";
set "cmd" "mainmenu_heartbeat";


== See also ==
== See also ==

Revision as of 14:56, 2 September 2011

GUI commands

Commands in the main menu like:

set "command argument1 argument2;"

are handled in idGameLocal::HandleMainMenuCommands() in game/game_loca.cpp.

For each of the parts "command", "argument1", "argument2" and the final ";", the routine is called again.

It therefore keeps a stack of these parts, and when it has seen enough arguments, handles the command and clears the stack before returning. The routine will also complain if you give not enough arguments to a command.

One special case is just using "set" "command", this will call HandleMainMenuCommands() twice, once with "command" and once with ";" as the menuCommand parameter. Any stray ";" as command is silently skipped.

Examples

set "cmd" "play sound/meta/menu/mnu_hover";
set "cmd" "log 'Some text here'";
set "cmd" "mainmenu_heartbeat";

See also