Skip to content
WhyIsEvery4thYearAlwaysBad edited this page Aug 3, 2021 · 43 revisions

NOTEs:

  • Syntax can change at any time since the standard syntax is still uncertain.
  • How the captions display will vary based on your HUD display.
  • TIP: Titles should be written as though you are writing captions.

Comments

/* ... */ makes a block comment. // makes an inline comment.

Examples:

/*
This cmenu is unfinished. Don't compile yet.
*/
// TODO: Remove unicode support.

Raw String(v0.3.5+)

A raw string is a string that is directly inserted into the cmenu's cfg file. Backticks (`) can be escaped by prepending them with a backslash.

Syntax: `<stuff>`

Example: `alias "alter" "echo \\\\Test!//"`//<-------- The "\\\\" will convert to a "\\" in the cfg file.

In the CFG file: alias "alter" "echo \\Test!//"

Double Quotes can also be escaped in regular strings.

Bind

A bind is a command or string of commands that executes when a key is pressed. (More Info)
In the CMG Language, a bind is a command string that is displayed as its title, and bound to a number key.

Syntax: BIND <title : string> <command string : string> |

Example: BIND "{Meme Bind}" "say Random Crit jokes are overrated." |

Display in command menu:

"1. {Meme Bind}" in source captions.
*1 key is pressed*
Output:

"Random Crit jokes are overrated" in chat.

The number key bound is determined by the bind's placement in a command menu. For example in the command menu:

"warnings" {
	BIND "Sniper!" "say_team Sniper Ahead!" |
	BIND "Sticky Trap!" "say_team Sticky Trap Ahead!" |
	BIND "Flank!" "say_team Sniper Incoming Flank!" |
}

The bind titled "Sniper!" will be bound to the 1 key, since it appears first.
The bind titled "Sticky Trap!" will be bound to 2.
The bind titled "Flank!" will be bound to 3.

You can use modifiers with (or certain keywords prefixed to) a bind, toggle bind, or command menu to change their functionality.

  • NOFORMAT will display the title without using the format KV.

  • NOEXIT will prevent binds/toggle binds/cmenus from exiting after being ran, but it will cause an error on command menus because they do not exit menus by default.

  • KEY KVs can be used to force binds to bind themselves to a specific key, rather than normally using the number keys. These binds will not move to the next number key to be used in a bind; instead the reserved number key will stay the same.

e.g

NOFORMAT "<I>Credits<I>" {
        NOFORMAT TOGGLE BIND "<—————————— Do you know the way to town sir?<cr>" "" "Do you know the way to town sir? ——————————><cr>" "" |
        NOFORMAT NOEXIT BIND "——————————> Created By ME! <——————————<cr>" "" |
        NOFORMAT TOGGLE BIND "<—————————— Yeah it's back the way you came.<cr>" "" "Yeah it's back the way you came. ——————————><cr>" "" |
		format = "Press '$(key)' $(str)"
		KEY = "ENTER" BIND "to leave.<cr>" "" |
}

Result in game:

<—————————— Do you know the way to town sir?
——————————> Created By ME! <——————————
<—————————— Yeah it's back the way you came.
Press 'ENTER' to leave.

Toggle Bind

Syntax: TOGGLE BIND <title : string> <command string : string> <title : string> <command string : string> ... |

A toggle bind is a bind with multiple states of command strings that are ran by activating the bind a certain amount of times. Each time a toggle bind is ran it changes its current command string to the next state until it modulates back to its first state. The first 2 strings are always the first state.

Example:

TOGGLE BIND "Debug Full" "debug=on" "Debug Minimal" "debug=minimal" "Debug Off" "debug=off"  |

Result in-game:
1. Debug Full *hits 1*
*executes "debug=on"*
1. Debug Minimal *hits 1*
*executes "debug=minimal"*
1. Debug Off *hits 1*
*executes "debug=off"*
*cycles back to Debug Full*

Command Menu

Syntax: <title : string> { ... }

A command menu (or cmenu/CMenu for short) is a collection of binds and toggle binds. You can insert a command menu into parent command menus, or run "exec $cmenu_<unformatted title>"

NOTE: In the files, a command menu uses an unformatted title which:

  • Has caption tags, punctuation, and non-ascii characters removed.
  • Is all lower case.
  • All spaces ( ) are replaced with underscores (_).

For instance, the command menu titled "Callouts" will use "callouts" internally in the command menu vpk. If you were to open this command menu, you'd need to call exec $cmenu_callouts.

Example:

"<B>Comp Callouts<B>" {
	BIND "ENEMY PUSHING" "say_team **ENEMY PUSHING**" |
	BIND "ENEMY SPY" "say_team *ENEMY SPY ROUND HERE*" |
}

*executes $cmenu_comp_callouts*
Result in game:
1. ENEMY PUSHING <newline>2. ENEMY SPY

To exit a cmenu select a bind or run cmenu.exitmenu. The NOFORMAT modifier can be used with cmenus, but not the NOEXIT modifier since it is redundant and will cause a generator error.

Key Value

Key-Values (KVs) are the program's main way of configuration. KVs cannot have modifiers. They can be assigned values via the syntax below.

Syntax: <key : identifier> = <value : string> Example: resetkeys = "bind 1 quickbuild_1; bind 2 quickbuild_2; bind 3 quickbuild_3; bind 4 quickbuild_4" This will set store the string after the = in resetkeys.

(NOTE for below: Default values are in parenthesis.)


resetkeys ( = "bind 1 slot1; bind 2 slot2; bind 3 slot3; bind 4 slot4; bind 5 slot5; bind 6 slot6; bind 7 slot7; bind 8 slot8; bind 9 slot9; bind 0 slot10)"

KV value is a command-string that runs whenever the cmenu.exitmenu alias is ran (typically when a bind / toggle bind is ran in a cmenu).


predisplay_time ( = "0.25")

Sets cc_predisplay_time to predisplay_time KV value after exiting a cmenu. This KV is primarily useful when dealing with other captions.


linger_time ( = "0")

Sets cc_linger_time to linger_time KV value after exiting menu. This KV is primarily useful when dealing with other captions.


format ( = "$(key). $(title)<cr>")(v0.2.5+)

Sets formatting for titles of binds and command menus.

  • All $(nkey)(v0.2.1 - v0.3.2) / $(key)(v0.3.3+) metastrings will be replaced with the bind/toggle bind/cmenus' keybind name.

  • All $(str)(v0.2.1 - v0.3.2) / $(title)(v0.3.3+) metastrings will be replaced with the bind/toggle bind/cmenus' actual title.

Sidenote: If the format KV is surrounded in <B> or <I> tags, you will have to append a space to the end of the string for the <cr> tag to work.


display ( = "caption")(v0.3.2+)

Tells the subsqeuent cmenus what type of method to use to display binds. Can be changed at any time. Three values are used:

* "caption" - Use close captioning to display binds.
* "console" - Use the `developer 1` console to display binds.
* "none" - No display method shall be used.

KEY ( = "")(v0.3.3+)

Forces the next bind/toggle bind/cmenu encountered to use the "KEY" KV value as the key to bind itself to, rather than using the number keys; the "KEY" KV is reset to "" afterwards.


#cvm.boldbydefault ( = "false")(v0.0.1 - v0.2.0)

Will bold all command menus with <B> if KV is set to "true". As a result <B> in titles will unbolden the selected characters. Note that the number key prepended will not be effected by this trick.


#cvm.italicizedbydefault ( = "false")(v0.0.1 - v0.2.0)

Will italicize all entries with <I> if KV is set to "true". As a result <I> in titles will unitalicize the selected characters. Note that the number key prepended will not be effected by this trick.


#cvm.defaultcolor ( = "")(v0.0.1 - v0.2.0)

Color tag that is inserted into every caption. Note that the number key prepended will not be effected by any <clr> tags.


consolemode ( = "false")(v0.2.5 - v0.3.1)

Uses the console to display binds instead of captions if KV is set to true.