This article's documentation is for the "GoldSrc" engine. Click here for more information.

$cd (GoldSrc): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(still is used in goldsrc)
(Removing deprecated Category)
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{goldsrc topicon}}
{{gldsrc topicon}}
{{goldsrc|only}} Used to set the current working directory for the QC script.
{{tabsBar|main=gs|base=$cd}}
 
{{this is a|QC command|engine=goldSrc|name=$cd}} Used to set the current working directory for the QC script.
{{modernImportant|Does not exist in {{src|4.1}}; starting directory is inferred to be QC file location, with [[$pushd]] and [[$popd]] being used to change the directory instead.}}


==Description==
==Description==
  $cd "path/to/files/"
  $cd "path/to/files/"
The default working directory will be the folder of the .qc file.


==Parameters==
==Parameters==
* The path should be a full or relative path on the file system.
* The path should be a full or relative path on the file system. For the path where the QC script is, use {{code|"."}}


==Example==
==Example==
'''$cd "."'''
{{codeblock|lang=qc|src=shell.qc|//brass shell model for GoldSrc
[[$modelname]] "weapons/shell.mdl"
'''$cd "."''' // use same directory as QC file
[[$cdtextures]] "models/weapons/"
[[$modelname]] "shell.mdl"
[[$body]] "Shell" "shell.smd"
[[$cdtexture]] "." // look for textures in same folder as QC file
[[$sequence]] "idle" "shell.smd"
[[$body]] "Shell" "shell"
 
[[$sequence]] "idle" "shell"
 
}}
 
[[Category:QC Commands]]

Latest revision as of 21:14, 16 July 2025

$cd is a QC command available in all GoldSrc GoldSrc games. Used to set the current working directory for the QC script.

Description

$cd "path/to/files/"

Parameters

  • The path should be a full or relative path on the file system. For the path where the QC script is, use "."

Example

shell.qc
qc
//brass shell model for GoldSrc

$cd "." // use same directory as QC file $modelname "shell.mdl" $cdtexture "." // look for textures in same folder as QC file $body "Shell" "shell"

$sequence "idle" "shell"