scriptNull: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Some wiki formatting)
 
(64 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma 3 |= Game name
|game1= arma3
|version1= 1.32


|1.32|= Game version
|gr1= Variables
____________________________________________________________________________________________


| A non-existing [[Script]] or script that has finished ([[scriptDone]]). To compare non-existent scripts use [[isNull]] or [[isEqualTo]]:
|descr= A non-existing or [[scriptDone|completed]] [[Script Handle]]. To compare non-existent scripts use [[isNull]] or [[isEqualTo]]:
* <tt>[[scriptNull]] <nowiki>==</nowiki> [[scriptNull]]; // ERROR! <nowiki>==</nowiki> cannot be used with script object</tt>
<sqf>
* <tt>[[isNull]] [[scriptNull]]; // true</tt>
scriptNull == scriptNull; // ERROR! == cannot be used with script object
* <tt>[[scriptNull]] [[isEqualTo]] [[scriptNull]]; // true</tt> |= Description
isNull scriptNull; // true
____________________________________________________________________________________________
scriptNull isEqualTo scriptNull; // true
</sqf>


| '''scriptNull''' |= Syntax
|s1= [[scriptNull]]


| [[Script]] - NULL script |= Return value
|r1= [[Script Handle]] - NULL script
____________________________________________________________________________________________


 
|x1= Wait until previous script is finished before starting a new one:
|x1= <code>_script = [[scriptNull]];
<sqf>
[[for]] "_i" [[from]] 1 [[to]] 10 [[do]] {
0 spawn
[[waitUntil]] {[[isNull]] _script};
{
_script = 0 [[spawn]] {
_script = scriptNull;
[[hint]] "script started";
for "_i" from 1 to 10 do
[[sleep]] 1;
{
[[hint]] "script finished";
waitUntil { isNull _script };
_script = _i spawn
{
hint format ["script %1 started", _this];
sleep 1;
hint format ["script %1 finished", _this];
sleep 0.2;
};
};
};
};</code> |= Example 1
};
</sqf>


 
|x2= <sqf>
|x2= <code>[[if]] ([[scriptDone]] (_obj [[getVariable]] ["objScript", [[scriptNull]]])) [[then]] {
if (scriptDone (_obj getVariable ["TAG_objScript", scriptNull])) then
_obj [[setVariable]] ["objScript", _obj [[spawn]] {
{
[[waitUntil]] {[[damage]] _this > 0.9};
_scriptHandle = _obj spawn { waitUntil { damage _this > 0.9 }; hint "Critical Damage!"; };
[[hint]] "Critical Damage!";
_obj setVariable ["TAG_objScript", _scriptHandle];
}];
};
};</code> |= Example 1
</sqf>


| x3 = <code>[[str]] [[scriptNull]]; // <NULL-script></code> |=
|x3= <sqf>str scriptNull; // <NULL-script></sqf>
____________________________________________________________________________________________
 
|[[controlNull]], [[displayNull]], [[grpNull]], [[locationNull]], [[objNull]], [[taskNull]], [[teamMemberNull]], [[configNull]], [[typeName]], [[isNull]], [[scriptDone]], [[spawn]], [[execVM]]  |= See also


|seealso= [[controlNull]] [[displayNull]] [[grpNull]] [[locationNull]] [[objNull]] [[taskNull]] [[teamMemberNull]] [[configNull]] [[typeName]] [[isNull]] [[scriptDone]] [[spawn]] [[execVM]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on May 2, 2017 - 13:06 (UTC)</dd>
<dt class="note">[[User:IT07|IT07]]</dt>
<dd class="note">
Example 1 is absolute horse shit and needs to be taken out. Those kind of examples is one of the reasons why it is so frustrating, confusing and difficult for starters to get into coding for ArmA 3.
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 19:03, 21 April 2024

Hover & click on the images for description

Description

Description:
A non-existing or completed Script Handle. To compare non-existent scripts use isNull or isEqualTo:
scriptNull == scriptNull; // ERROR! == cannot be used with script object isNull scriptNull; // true scriptNull isEqualTo scriptNull; // true
Groups:
Variables

Syntax

Syntax:
scriptNull
Return Value:
Script Handle - NULL script

Examples

Example 1:
Wait until previous script is finished before starting a new one:
0 spawn { _script = scriptNull; for "_i" from 1 to 10 do { waitUntil { isNull _script }; _script = _i spawn { hint format ["script %1 started", _this]; sleep 1; hint format ["script %1 finished", _this]; sleep 0.2; }; }; };
Example 2:
if (scriptDone (_obj getVariable ["TAG_objScript", scriptNull])) then { _scriptHandle = _obj spawn { waitUntil { damage _this > 0.9 }; hint "Critical Damage!"; }; _obj setVariable ["TAG_objScript", _scriptHandle]; };
Example 3:
str scriptNull; // <NULL-script>

Additional Information

See also:
controlNull displayNull grpNull locationNull objNull taskNull teamMemberNull configNull typeName isNull scriptDone spawn execVM

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