Vscript reading keyvalues
kv <- self.GetModelKeyValues()
printl(kv)
printl(kv.GetKeyString("targetname"))
I've applied this to a simple button which assumingly has a targetname (at least I assigned one!). Anyhow, this code properly returns the address of the kv handle but after that just an empty line. None of the other KeyValue commands produces any significant output but null either.
Where is my mistake? What am I overlooking? Anybody please...
Make a trigger, have it RunScriptCode on the !activator to stick its GetName() in a ::variable.
Maybe I'm mistaken but I thought that the KeyValues of an Entity hold all the information that you can edit in Hammer plus further key data that every entity holds. At least that's how I understand the articles on VDC.
Targetname is an ENTITY KeyValue. It's like you're using the XML reader correctly, but you're opening the wrong file. 
I've never used model KVs much, so someone correct me if this is all wrong.