davidoss 550 Posted October 1, 2016 I have a function that returns <NULL-target> if the player was targeting nothing while calling it I am trying to catch that and exit when <NULL-target> has been returned. if (isnull _toevac ) exitWith {}; //error if (isnil _toevac ) exitWith {}; //error if (_toevac == objNull ) exitWith {}; // error type target str _toevac // <NULL-target> how to bite this? Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted October 1, 2016 What's _toevac? Cursortarget? If it's cursortarget then a simple isNull cursorTarget should do it. No idea why or what's throwing error on your side. when _toevac is actually returning objNull then _toevac == objNull will return false. Use isEqualTo instead. isNil wants string or code btw. Hard to say without more context. Cheers Share this post Link to post Share on other sites
davidoss 550 Posted October 1, 2016 It is CfgCommunicationMenu class returning an _data array https://community.bistudio.com/wiki/Target says This is a reserved Type for future implementations. In Armed Assault it is not implemented yet Maybe i need to put this together in some different way Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted October 2, 2016 Weird, in the CfgCommunicationMenu wiki it says target is the cursortarget of the calling player. Cheers Share this post Link to post Share on other sites
killzone_kid 1326 Posted October 2, 2016 Weird, in the CfgCommunicationMenu wiki it says target is the cursortarget of the calling player. Cheers Seems like a bug 1 Share this post Link to post Share on other sites
theend3r 83 Posted October 2, 2016 I have a function that returns <NULL-target> if the player was targeting nothing while calling it I am trying to catch that and exit when <NULL-target> has been returned. if (isnull _toevac ) exitWith {}; //error if (isnil _toevac ) exitWith {}; //error if (_toevac == objNull ) exitWith {}; // error type target str _toevac // <NULL-target> how to bite this? isNil accepts only strings, so it'd be if (isnil "_toevac") exitWith {}; Share this post Link to post Share on other sites
killzone_kid 1326 Posted October 3, 2016 This bug should be fixed since 1.65.138622 The type returned should now be Object and not Target. Check tomorrow DEV please. 1 Share this post Link to post Share on other sites
barbolani 198 Posted October 5, 2016 Additionally to what KK's says, if the return was nil you would have error, not only because of the brackets, but also because you are checking null before nil. Correct code should be: if (isnil "_toevac" ) exitWith {}; if (isnull _toevac ) exitWith {}; Also this: if (_toevac == objNull ) exitWith {}; will return allways false, as objNull never equals to anything, to check if something is null, it's isNull command. Share this post Link to post Share on other sites
Tajin 348 Posted October 5, 2016 Also this: if (_toevac == objNull ) exitWith {}; will return allways false, as objNull never equals to anything, to check if something is null, it's isNull command. True, but this would work: if (_toevac isEqualTo objNull) exitWith {}; Share this post Link to post Share on other sites
davidoss 550 Posted October 5, 2016 There is going about something different that just syntax. Type target but the type target are non existing yet in arma if (isNull _toevac ) exitWith {hint "exited"> 1:46:40 Error position: <isNull _toevac ) exitWith {hint "exited"> 1:46:40 Error isnull: Type Target, expected Object,Group,Script,Config entry,Display (dialog),Control,Network Object,Task,Location https://community.bi...om/wiki/Target says This is a reserved Type for future implementations. In Armed Assault it is not implemented yet Share this post Link to post Share on other sites
Tajin 348 Posted October 5, 2016 Don't underestimate syntax. If you know what value it has exactly, then you could use isEqualTo to check it even when isNull doesn't work. (maybe TargetNull already exists?) If that is too tricky, then you could always try comparing it as string. Share this post Link to post Share on other sites
killzone_kid 1326 Posted October 5, 2016 maybe TargetNull already exists? It exists just not in SQF Share this post Link to post Share on other sites
davidoss 550 Posted October 5, 2016 Value can be object or <NULL-target>. With object there are no problem but if this return <NULL-target> i cant or do not knew how to detect that. Share this post Link to post Share on other sites
Bnae 1431 Posted October 5, 2016 This might be just me not realizing what you're after, but i can detect "Nothing" without errors _target = cursorTarget ; if (isNull _target ) exitWith {hint "Nothing"}; Share this post Link to post Share on other sites
davidoss 550 Posted October 5, 2016 yeah when that would be objnull not <NULL-target> Error isnull: Type Target, expected Object,Group,Script,Config entry,Display (dialog),Control,Network Object,Task,Location Share this post Link to post Share on other sites
Bnae 1431 Posted October 5, 2016 Objects -> objNull Controls -> controlNull Displays -> displayNull Groups -> grpNull Locations -> locationNull (since ARMA 2) Tasks -> taskNull (since ARMA 2) Scripts -> scriptNull (since Arma 3 1.29.127075) Configs -> configNull (since Arma 3 1.53.133130) Note: A test via == does not work, because, for example, objNull is not equal to anything, not even to itself. Use isEqualTo. I would advise to do whatever you're doing differently if you cannot find a correct solution from what you have. Good luck Share this post Link to post Share on other sites
killzone_kid 1326 Posted October 5, 2016 It seems no one really is bothered reading through the thread but everyone quick to give advice. Ok, I will give you digest version:PROBLEM SOLVED, "expression" now gets Object type as _target. It is currently fixed on DEV, so If you are on STABLE will have to wait. Share this post Link to post Share on other sites