Script Actions

The menu scripting system contains commands for both menuDef and itemDef that execute a series of script commands when they are run.These include commands such as onOpen for the menuDef and mouseEnter for the itemDef. The format for these commands is like this :

    <command>
    {
      <script command> ;
      ....
      <script command> ;
    }

Basically, a set of curly brackets containing a series of script commands, seperated by semicolons. The <script commands> are executed in the order they are defined. Let's look at the <script commands> to see what they consist of .

  • fadein <name>
    • fade in any menu or item whose name or group name matches <name>. This command uses the fadeClamp, fadeAmount and fadeCycle values that were defined globally or in the menuDef.
  • fadeout <name>
    • fade out any menu or item whose name or group name matches <name>. This command uses the fadeClamp, fadeAmount and fadeCycle values that were defined globally or in the menuDef.
  • show <name>
    • set the visibility of any menus or items whose name or group name matches <name> to MENU_TRUE. This makes those menus or items visible and active.
  • hide<name>
    • set the visibility of any menus or items whose name or group name matches <name> to MENU_FALSE. This makes those menus or items invisible and not active.
  • open <name>
    • open the menu whose name matches <name>. If no name match is found then nothing happens.
  • conditionalopen <cvar> <name1> <name2>
    • test the cvar name <cvar> and if its value is 0 open the menu whose name matches <name2>. Otherwise open the menu whose name matches <name1>. If no name match is found then nothing happens.
  • close <name>
    • close the menu whose name matches <name>. If no name match is found then nothing happens.
  • setbackground <name>
    • change the background graphic of the menu or item to <name>, where <name> is either the path and name of a graphic file or a shader name.
  • setteamcolor red green blue alpha
    • change the color used by the window style WINDOW_STYLE_TEAMCOLOR to this color.
  • setitemcolor <name> <color name> red green blue alpha
    • change the specified color on any items whose name or group name matches <name> to this color. The values for <color name> are :
      • backcolor
      • forecolor
      • bordercolor
  • setfocus <name>
    • set the focus to the first item found whose name or group name matches <name>.
  • setplayermodel <name>
    • set the cvar "team_model" to <name>. This sets the model name of the Team Arena player model.
  • setplayerhead <name>
    • set the cvar "team_headmodel" to <name>. This sets the head name of the Team Arena player model.
  • transition <name> <rectFrom> <rectTo> <time> <amount>
    • a simple animation effect that changes the size of any items whose name or group name matches <name>. The other parameters are :
      • <rectFrom> - the starting window area of the item in the normal rectangle form of :
        • x y width height
      • <rectTo> - the ending size of the window area of the item in normal rectangle form
      • <time> - the number of milliseconds between size changes
      • <amount> - the amount of change in size each time
    • This effect continues until all sides of the item window area reach the correct size.
  • setcvar <name> <value>
    • sets the cvar named <name> to the string <value>. This command will not accept negative numbers for <value>.
  • setcvarfloat <name> <value>
    • the same as setcvar but it accepts negative numbers for <value>.
  • clearcvar <name>
    • sets the cvar named <name> to "".
  • exec <string>
    • execute <string> as a console command.
  • play <name>
    • play the sound file indicated by <name>. Plays only once.
  • playlooped <name>
    • play the sound file indicated by <name> in an infinite loop as the background sound. Only one background sound can be played by a menu or item, although each menu or item active can have it's own background sound. To stop the sound, set <name> to the empty string (playlooped ""). Only the menu or item that started the sound can stop it.
  • orbit <name> <x> <y> <cx> <cy> <time>
    • a orbiting effect applied to all items whose name or group name matches <name>. The item orbits it's center around a point calculated from <x>, <y>, <cx> and <cy>. The <time> value is the number of milliseconds between movement changes. I'm unsure of how the orbit is calculated.
  • uiScript <string>
    • execute specific actions based on <string>. These actions are hard coded into the program but are triggered from the menus. In a way, they are like hooks for actions into the program from the menus. A number of uiScript actions are coded into the program and more can be added by mod programmers. See uiScript Commands for information on those supplied by the Team Arena code.

 

Return to Home Page