$definevariable: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Added a few notes)
(point limitations)
Line 4: Line 4:
{{note|Variables do not work within macros either. You can pass the data on to the macro by using it as a token when running it.}}
{{note|Variables do not work within macros either. You can pass the data on to the macro by using it as a token when running it.}}
{{note|If you define the same variable twice, the compiler will use the first one it finds and drop the second one.}}
{{note|If you define the same variable twice, the compiler will use the first one it finds and drop the second one.}}
{{bug|Similar tokens prefixes causes to the compiler parser: merge, swap or even ignore it variable values. This doesn't happen with {{sfm|4}} and {{gmod|4}}}}
{{bug|tokens cannot be pushed further than 3 [[$include]] levels}}


This command is a 'lite' version of [[$definemacro]].
This command is like a 'lite' version of [[$definemacro]].


== Example ==
== Example ==

Revision as of 23:16, 17 March 2023

The $definevariable QC command creates a Wikipedia icon variable. The variable's name, if surrounded by $s, will be substituted by its value whenever encountered.

Note.pngNote:Variables do not work within "quote blocks"!
Note.pngNote:Variables do not work within macros either. You can pass the data on to the macro by using it as a token when running it.
Note.pngNote:If you define the same variable twice, the compiler will use the first one it finds and drop the second one.
Icon-Bug.pngBug:Similar tokens prefixes causes to the compiler parser: merge, swap or even ignore it variable values. This doesn't happen with Source Filmmaker Source Filmmaker and Garry's Mod Garry's Mod  [todo tested in ?]
Icon-Bug.pngBug:tokens cannot be pushed further than 3 $include levels  [todo tested in ?]

This command is like a 'lite' version of $definemacro.

Example

$definevariable baseFile "fighter1"

$sequence attack $baseFile$_Attack
$sequence run $baseFile$_Run
$sequence idle $baseFile$_Idle