PDA

View Full Version : Accessing config vars from a different class



kisk
11-22-2007, 05:14 PM
I have a few classes in my mutator and I need to access the config vars from one class from another class in my mutator. How is this done. I have tried:

making class vars -- didn't work..

creating constants which = my config vars so I could use the .constant. -- can't assign vars to a const..

static functions -- didn't work

Can someone please give me a working example of accessing var values from another class? I just need to get the values!

Thanks :)

zanmato
11-22-2007, 05:31 PM
If it's clientside you could make a class that has your config stuff and access it like Class'Confsettings'.default.variablename; if it's serverside you could spawn a replicationinfo class and assign variables to it, then access it later by iterating DynamicActors

kisk
11-22-2007, 05:45 PM
If it's clientside you could make a class that has your config stuff and access it like Class'Confsettings'.default.variablename; if it's serverside you could spawn a replicationinfo class and assign variables to it, then access it later by iterating DynamicActors

its clientside -- this problem with that is you cannot set default variables for config vars. This is however changed in the first patch which is out now, but you still cannot set default variables at runtime so I have no clue how else to read a variable from another class.

zanmato
11-22-2007, 07:13 PM
I don't understand what you mean, you can read config vars just fine with that method :-]

LagMasterSam
11-22-2007, 08:31 PM
Do you mean accessing default values assigned in defaultproperties?

something = class'ClassName'.default.VarName;

Shambler
11-23-2007, 11:42 AM
Here is a utility package which I have coded to get around this annoying restriction:
http://homepage.eircom.net/~JBarrett847/UnrealScriptTools-v0.1.zip

Enjoy :)