isNull: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 38: Line 38:
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->


<dd class="notedate">Posted on September 04, 2014
<dt class="note">'''[[User:Pierre MGI|Pierre MGI]]'''
<dd class="note">
<br>locationNull could be confusing when testing destinationTask :
if a task is created, taskDestination returns an array working as position : _mytask_distance = (taskDestination (currentTask player)) distance player;
<br>When task completed Hint format ["%1", taskDestination (currentTask player)] returns <null> while !isnull taskdestination.. <br>leads to an error.
<br>correct test : _destination_task = taskDestination (currentTask player); if (!isNil "_destination_tsk") then {...
<br>
<br>}}
<dd class="notedate">Posted on September 04, 2014
<dt class="note">'''[[User:Pierre MGI|Pierre MGI]]'''
<dd class="note">
<br>Isnull (currentTask player) works but returns <null> taskDestination when triggered by succedded for example,
<br>isnull taskdestination... leads to an error,
<br>isnil "your_var for taskDestination" works for task completed
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>
Line 51: Line 67:
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
{{subst:Add new note/construct|
<!--
* Replace from here (including the arrow just above)
* Please add your note here, replacing these comments
* Please '''PREVIEW YOUR ADDITION BEFORE SAVING'''
* Thank you
* Equal symbols "=" should be added as "{{subst:=}}" (excluding quotes)
* Pipes "|" should be added as "{{subst:!}}" (excluding quotes)
* New lines should be forced by the use of "<br>" tags
* Examples should be placed between tags <code>_like {{subst:=}} [[_this]];</code>
* Replace to here (including the arrow just below)
locationNull could be confusing when testing destinationTask :
if a task is created, taskDestination returns an array working as position : _mytask_distance = (taskDestination (currentTask player)) distance player;
When task completed Hint format ["%1", taskDestination (currentTask player)] returns <null> while !isnull taskdestination.. leads to an error.
correct test : _destination_task = taskDestination (currentTask player); if (!isNil "_destination_tsk") then {...
}}
{{subst:Add new note/construct|
<!--
* Replace from here (including the arrow just above)
* Please add your note here, replacing these comments
* Please '''PREVIEW YOUR ADDITION BEFORE SAVING'''
* Thank you
* Equal symbols "=" should be added as "{{subst:=}}" (excluding quotes)
* Pipes "|" should be added as "{{subst:!}}" (excluding quotes)
* New lines should be forced by the use of "<br>" tags
* Examples should be placed between tags <code>_like {{subst:=}} [[_this]];</code>
* Replace to here (including the arrow just below)
Isnull (currentTask player) works but returns <null> taskDestination when triggered by succedded for example,
isnull taskdestination... leads to an error,
isnil "your_var for taskDestination" works for task completed
}}

Revision as of 00:15, 5 September 2014

Hover & click on the images for description

Description

Description:
Checks whether the tested item is Null.
Which null type the item has to be equal to depends on the type of object tested:
Note: A test via == does not work, because, for example, objNull is not equal to anything, not even to itself.
Groups:
Uncategorised

Syntax

Syntax:
isNull obj
Parameters:
obj: Object, Control, Display, Group (or Location, Task since ARMA 2)
Return Value:
Boolean

Examples

Example 1:
if (isNull obj) then {hint "doesn't exist";};

Additional Information

See also:
controlNulldisplayNullgrpNulllocationNullobjNulltaskNullteamMemberNull

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Posted on September 04, 2014
Pierre MGI

locationNull could be confusing when testing destinationTask : if a task is created, taskDestination returns an array working as position : _mytask_distance = (taskDestination (currentTask player)) distance player;
When task completed Hint format ["%1", taskDestination (currentTask player)] returns <null> while !isnull taskdestination..
leads to an error.
correct test : _destination_task = taskDestination (currentTask player); if (!isNil "_destination_tsk") then {...

}}
Posted on September 04, 2014
Pierre MGI

Isnull (currentTask player) works but returns <null> taskDestination when triggered by succedded for example,
isnull taskdestination... leads to an error,
isnil "your_var for taskDestination" works for task completed

Bottom Section