$definemacro

From Valve Developer Community
Revision as of 20:11, 7 November 2007 by Beeswax (talk | contribs)
Jump to navigation Jump to search
$definemacro (macroname) [named parameters ...]
  • Defines a named macro that can be use as a short hand way to specify other QC commands. The macro creates a block a named block of text, that when referred to will virtually insert that text into the QC file, along with replacing the named parameters with the specified values.

Example:

     $definemacro makeidlenoise idleNoiseName fileName \\
     $sequence $idleNoiseName$ {\\
          $fileName$ \\
          subtract $idleNoiseName$ 0 \\
          iklock lfoot 1 0 iklock rfoot 1 0 \\
          delta \\
          hidden \\
          realtime \\
     }
     $makeidlenoise idleNoise03 "Idle03"
     $makeidlenoise idleNoise04 "Idle04_v32"

alternative version ...

$definemacro (macroname) [arg_name1] [arg_name2] […] \\
  • Defines a string substation macro.
  • The macro definition begins on the next line, and all subsequent lines that end with \\ (two backslashes).
  • Arguments are referenced by surrounding them with $’s (i.e. $arg_name1$ ), and can be embedded inside of other words.
  • To use the macro, type $macroname and the next N tokens will be taken as arguments.
  • For example:

$definemacro testmacro seqname filename endframe \\ $sequence $seqname$01 $filename$ { \\ frames 0 $endframe$ \\ subtract $seqname$ 0 delta \\ weightlist justbody \\ } Then, to use the macro, do: $testmacro small_flinch "npc flinch 01" 20