Function Variables?

Posts 1–6 of 6 · Page 1 of 1
Function Variables?
I've been seeing lines like this around:
Code:
[[game[team+"_model"]["ASSAULT"]]]();
Are theses invoked functors? I wish I knew how to to use them. I'm doing heavy modifications to quarantine chaos zombie mod and I need rearrange shop items.
U know theres a section for this kinda stuff, its the gsc modding help/discussion something like that.
Oh snap can someone love this topic please? Thank you.
Well if you do a search, you will find those are just variables that link to a thread.

Example (from Black Ops):
Code:
[[level.callbackStartGameType]]();
level.callbackStartGameType = maps\mp\gametypes\_globallogic::Callback_StartGameType;
Example for your case:
Code:
game[team + "_model"]["SNIPER"] = mptype\mptype_tf141_desert_sniper::main;
game[team + "_model"]["LMG"] = mptype\mptype_tf141_desert_lmg::main;
game[team + "_model"]["ASSAULT"] = mptype\mptype_tf141_desert_assault::main;
game[team + "_model"]["SHOTGUN"] = mptype\mptype_tf141_desert_shotgun::main;
game[team + "_model"]["SMG"] = mptype\mptype_tf141_desert_smg::main;
game[team + "_model"]["RIOT"] = mptype\mptype_tf141_desert_riot::main;
As I said above, those are just variables that link to a function.
Do you instantiate the function as a thread before assigning it? Why can't I do this?
Code:
foo(){}
bar()
{
baz = foo;
[[baz]]();
}
Or do you need to associate an object to the assignment before the invocation? Or does it need to be declared as a thread all together?
I have no idea but you may have to delcare the thread globally and not locally.
Code:
baz = maps\mp\gametypes\_rank::foo;
[[baz]]();
EDIT - Just found out, if you want to load a function from the same file, you have to do this:
Code:
baz = ::foo;
[[baz]]();
Otherwise if you want to link to a function from another file:
Code:
baz = maps\mp\gametypes\_rank::foo;
[[baz]]();
To pass arguments through to the desired function you put them inside the brackets before the semi-colon.
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us