Jump to content
Tom212

Can you parse the 'this' magic variable as a parameter, if so how? [Solved]

Recommended Posts

Hey all,

 

I've written some scripts that accept objects as parameters but if I try to execute them inside an object's init while parsing 'this' I get undeclared variable errors.

 

Is there anyway around this?

 

Thanks in advance!

 

 

Edited by Tom212
Solved.

Share this post


Link to post
Share on other sites

I'm running this in the init line of an object. Attempting to hand over 'this' as a parameter to be used inside of hackingDevice.sqf. The scripts themselves work fine, I know this because I've been using them up until now using declared variables instead of magic variables and they function as expected, I haven't shared those to avoid confusion. My question is specifically regarding the use of the 'this' magic variable as a parameter.

this addAction ["Hack Dish", {[this, 0.4, "scripts\Hacking\Outcomes\dishHacked.sqf"] execVM "scripts\Hacking\hackingDevice.sqf";}, nil, 1.5, false, true, "", "true", 5];

 

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/addAction

 

this addAction 
[
    "Hack Dish", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"]; 
        [_target, 0.4, "scripts\Hacking\Outcomes\dishHacked.sqf"] execVM "scripts\Hacking\hackingDevice.sqf";
    }, 
    nil, 
    1.5, 
    false, 
    true, 
    "", 
    "true", 
    5
];

 

  • Like 1

Share this post


Link to post
Share on other sites
26 minutes ago, Harzach said:

https://community.bistudio.com/wiki/addAction

 


this addAction 
[
    "Hack Dish", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"]; 
        [_target, 0.4, "scripts\Hacking\Outcomes\dishHacked.sqf"] execVM "scripts\Hacking\hackingDevice.sqf";
    }, 
    nil, 
    1.5, 
    false, 
    true, 
    "", 
    "true", 
    5
];

 

 

Thanks for the responses, ah okay cool I see now, thanks for the help.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×