Page 1 of 1
$targetname command in radiant
Posted: Thu Jul 19, 2007 1:31 am
by erick
Today I was looking at a gas chamber map and the person used $targetname/some value i forget
and then on the same entity they had
targetname/same value as the $targetname
What is the "$targetname" for because I use just plain old "targetname"?
$
Posted: Thu Jul 19, 2007 3:23 am
by tltrude
Far as I know, the "$targetname" value will stay the same if the entity is cloned. If you use just "targetname" the value will change to "t1", "t2", "t3", etc... when cloned.
Posted: Thu Jul 19, 2007 8:43 am
by bdbodger
Some scripts work better if in radiant you use $targetname and the # symbol for a number eg. key: #bla value: 1 this is called type casting where the $ is for strings and the # is for numbers . You can't really do that with scripting though but in script you would put "" around strings . Also as tom said the $ charactor is recognized by radiant as having special meaning .
Posted: Thu Jul 19, 2007 10:52 am
by jv_map
Always use 'targetname'. Otherwise targetname arrays won't work correctly in the script (that is if you have more than one entity with the same targetname).
Posted: Thu Jul 19, 2007 11:03 am
by bdbodger
jv_map wrote:Always use 'targetname'. Otherwise targetname arrays won't work correctly in the script (that is if you have more than one entity with the same targetname).
Are you sure it is not the other way around JV $targetname instead of targetname ? Not sure if it makes that much difference really but I think it has in some scripts .
Posted: Thu Jul 19, 2007 3:48 pm
by jv_map
It is the first mentioned way around

another question
Posted: Thu Jul 19, 2007 4:35 pm
by erick
Okay with that cleared up what does this mean?

(Found in the same script as before)
Code: Select all
level.sealed = 0
level.bdseal = 1
level.dimlights = 0
Where do people come up with these strange level variables because I have no clue what they mean. There isn't the slightest hint in the .map file or the script.
I am just wondering how people come up with their own level variables?

I need some major help with level variables.
Re: another question
Posted: Thu Jul 19, 2007 5:41 pm
by wacko
erick wrote:Where do people come up with these strange level variables because I have no clue what they mean. There isn't the slightest hint in the .map file or the script.
I am just wondering how people come up with their own level variables?

I need some major help with level variables.
That's all in (and out of) their mind.
Most variables they and you will use aren't system variables but just invented to store and use information for later use.
"level" means that this variable will be available and valid for all threads in ur script, whereas "local" would be only for the thread it's in. Another local.somevariable in another thread would be a seperate variable.
Posted: Thu Jul 19, 2007 6:53 pm
by Condor
I use "$targetname" for example for triggers at locked doors, which are used very often, but for script_objects etc I would use "targetname", because clones get a new, automatically generated unique name.
Posted: Thu Jul 19, 2007 8:34 pm
by wacko
Condor wrote:...clones get a new, automatically generated unique name.
They don't if you clone entities with Ctrl+Space instead of Space only