kat Posted August 14, 2014 Report Share Posted August 14, 2014 I understand that '_this' can work for this as a local variable : Reveal hidden contents _myVariable = { _mVa = _this select 0; _mVb = _this select 1; _mVc = _this select 2; _total = _mVa + _mVb - _mVc; }; [1,2,3] call _hinting; hint format ["Example Total: %1",_total]; Then i see things like this: Quote _body = (_this select 3) select 0; Can someone give some detailed advanced examples where "_this" is used? Also is _this strictly local? Thank youuuu! Link to comment Share on other sites More sharing options...
0 raymix Posted August 14, 2014 Report Share Posted August 14, 2014 _this same as _x are so called "magic variables", they can not be used by normal means like a local var. xBowBii gives a good example on how _this variable can be used to access called arguments from external scripts in your function. Here's a little extra on how to create new variables using same functions (can be complex nested arrays, too). _weLikeDat = ["Damn", "Nice", "Booty"] call fnc_checkDatBooty; //create new variable created from args returned from function fnc_checkDatBooty = { //this is the function we just called, probably defined in some other files somewhere else. _booty = _this select 2; // select only variable we want _booty //return booty }; //_weLikeDat variable will now become a string with "booty" in it. xBowBii 1 Link to comment Share on other sites More sharing options...
Question
kat
I understand that '_this' can work for this as a local variable :
Then i see things like this:
Can someone give some detailed advanced examples where "_this" is used?
Also is _this strictly local?
Thank youuuu!
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now