BIS fnc spawn: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (template:command argument fix)
m (Add seealso links)
 
(36 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 0.56


|0.56|= Game version
|gr1= Program Flow
____________________________________________________________________________________________


| Execute given code with or without parameter. |DESCRIPTION=
|descr= Execute given code with or without parameter.
____________________________________________________________________________________________
{{Feature|arma3|Since {{GVI|arma3|1.50}}, use [[remoteExec]]/[[remoteExecCall]] instead.}}


| [params, code] spawn '''BIS_fnc_spawn'''; |SYNTAX=
|s1= [params, code] spawn [[BIS_fnc_spawn]]


|p1= '''params''': [[Anything]] - function arguments |PARAMETER1=
|p1= params: [[Anything]] - function arguments
|p2= '''code''': [[Code]] - function code |PARAMETER2=


| [[Nothing]] |RETURNVALUE=
|p2= code: [[Code]] - function code


|exec= spawn |= Execution By (defaults to [[call]] if omitted)
|r1= [[Nothing]]
____________________________________________________________________________________________


|s2= code [[spawn]] '''BIS_fnc_spawn'''; |=
|exec= spawn


|p21= '''code''': [[Code]] |PARAMETER2= 1
|s2= code spawn [[BIS_fnc_spawn]]


|r2= [[Nothing]] |=
|p21= code: [[Code]]
____________________________________________________________________________________________
 
|x1= Show a message for the current player.
<code><nowiki>[</nowiki>["Hello"],  {[[hint]] ([[_this]] [[select]] 0);}] [[spawn]] [[BIS_fnc_spawn]];</code> |EXAMPLE1=
____________________________________________________________________________________________
 
|x2= Show a message to all connected players.
<code><nowiki>[[</nowiki>["Hello"], {[[hint]] ([[_this]] [[select]] 0);}], "[[BIS_fnc_spawn]]", [[true]], [[false]], [[false]]] [[call]] [[BIS_fnc_MP]];</code> |EXAMPLE2=
____________________________________________________________________________________________


|x3= Alternative syntax
|r2= [[Nothing]]
<code>{[[hint]] "Hello";} [[spawn]] [[BIS_fnc_spawn]];</code> |EXAMPLE3=
____________________________________________________________________________


| [[BIS_fnc_execFSM]], [[BIS_fnc_execRemote]], [[BIS_fnc_execVM]], [[BIS_fnc_call]] |SEEALSO=
|x1= Show a message for the current player:
<sqf>[["Hello"], { hint (_this select 0) }] spawn BIS_fnc_spawn;</sqf>


}}
|x2= Show a message to all connected players:
<sqf>
[[["Hello"], { hint (_this select 0) }], "BIS_fnc_spawn", true, false, false] call BIS_fnc_MP; // obsolete, use remoteExec
 
["Hello", { hint (_this select 0) }] remoteExec ["BIS_fnc_spawn"]; // since the introduction of remoteExec
["Hello", { hint (_this select 0) }] remoteExec ["spawn"]; // BIS_fnc_spawn is obsolete
["Hello"] remoteExec ["hint"]; // best solution here
</sqf>


<!-- BEGIN Note Section -->
|x3= <sqf>{ hint "Hello" } spawn BIS_fnc_spawn;</sqf>
<dl class="command_description">
<!-- For example:
<dd class="notedate">Posted on Month Day, Year - Time (UTC)</dd>
<dt class="note">'''[[User:User Name|]]'''</dt>
<dd class="note">This is an example note. It is true and verifiable, and contains a little code snippet.
<code>[[if]] ([[_this]] == anExample) [[then]] { [[hint]] "Leave it here for others to read"; };</code>
Isn't that awesome?!</dd> -->
</dl>
<!-- END Note Section -->


<h3 style="display:none">Bottom Section</h3>
|seealso= [[remoteExec]] [[remoteExecCall]] [[BIS_fnc_execFSM]] [[BIS_fnc_execRemote]] [[BIS_fnc_execVM]] [[BIS_fnc_call]]
<!-- Appropriate categories go here e.g. [[Category:Arma 3: Functions|{{uc:{{PAGENAME}}}}]] -->
}}
[[Category:Function Group: MP|{{uc:spawn}}]]
[[Category:Functions|{{uc:spawn}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:spawn}}]]

Latest revision as of 10:48, 13 July 2022

Hover & click on the images for description

Description

Description:
Execute given code with or without parameter.
Arma 3
Since Arma 3 logo black.png1.50, use remoteExec/remoteExecCall instead.
Execution:
spawn
Groups:
Program Flow

Syntax

Syntax:
[params, code] spawn BIS_fnc_spawn
Parameters:
params: Anything - function arguments
code: Code - function code
Return Value:
Nothing

Alternative Syntax

Syntax:
code spawn BIS_fnc_spawn
Parameters:
code: Code
Return Value:
Nothing

Examples

Example 1:
Show a message for the current player:
[["Hello"], { hint (_this select 0) }] spawn BIS_fnc_spawn;
Example 2:
Show a message to all connected players:
[[["Hello"], { hint (_this select 0) }], "BIS_fnc_spawn", true, false, false] call BIS_fnc_MP; // obsolete, use remoteExec ["Hello", { hint (_this select 0) }] remoteExec ["BIS_fnc_spawn"]; // since the introduction of remoteExec ["Hello", { hint (_this select 0) }] remoteExec ["spawn"]; // BIS_fnc_spawn is obsolete ["Hello"] remoteExec ["hint"]; // best solution here
Example 3:
{ hint "Hello" } spawn BIS_fnc_spawn;

Additional Information

See also:
remoteExec remoteExecCall BIS_fnc_execFSM BIS_fnc_execRemote BIS_fnc_execVM BIS_fnc_call

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