BIS fnc loop: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl> " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...) |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
| arma3 | | arma3 | ||
|1.16 | |1.16 | ||
|gr1 = Program Flow | |gr1 = Program Flow | ||
| Loop stacked code/function with timing and conditional control. Code and conditions are executed in [[Scheduler#Unscheduled_Environment|non-scheduled environment]]. | | Loop stacked code/function with timing and conditional control. Code and conditions are executed in [[Scheduler#Unscheduled_Environment|non-scheduled environment]]. | ||
| [action, parameters] call [[BIS_fnc_loop]] | | [action, parameters] call [[BIS_fnc_loop]] | ||
|p1= action: [[String]] - can be one of: | |p1= action: [[String]] - can be one of: | ||
Line 17: | Line 17: | ||
* "itemRemove" - Remove item from loop with id "uniqueId" | * "itemRemove" - Remove item from loop with id "uniqueId" | ||
* ''"onEachFrame" - internally used by "initialize"'' | * ''"onEachFrame" - internally used by "initialize"'' | ||
* ''"itemExecute" - internally used by "onEachFrame"'' | * ''"itemExecute" - internally used by "onEachFrame"'' | ||
|p2= parameters: [[Array]] - used with "itemAdd" and "itemRemove" ''action'' ("itemRemove" only takes id): | |p2= parameters: [[Array]] - used with "itemAdd" and "itemRemove" ''action'' ("itemRemove" only takes id): | ||
Line 26: | Line 26: | ||
* conditionStart: [[Code]] - (Optional, default {{Inline code|{ [[true]] <nowiki>}</nowiki>}}) will ''wait'' until the condition is met to start the code | * conditionStart: [[Code]] - (Optional, default {{Inline code|{ [[true]] <nowiki>}</nowiki>}}) will ''wait'' until the condition is met to start the code | ||
* conditionEnd: [[Code]] - (Optional, default {{Inline code|{ [[false]] <nowiki>}</nowiki>}}) stops the loop as soon as the ending condition is met (after the end of ''code'') | * conditionEnd: [[Code]] - (Optional, default {{Inline code|{ [[false]] <nowiki>}</nowiki>}}) stops the loop as soon as the ending condition is met (after the end of ''code'') | ||
* executeOnce: [[Boolean]] - (Optional, default [[false]]) | * executeOnce: [[Boolean]] - (Optional, default [[false]]) | ||
| [[Nothing]] | | [[Nothing]] | ||
|x1= <code>{{codecomment|// hints time every five seconds}} | |x1= <code>{{codecomment|// hints time every five seconds}} | ||
["itemAdd", ["uniqueId", { hint str time; }, 5]] [[call]] [[BIS_fnc_loop]];</code> | ["itemAdd", ["uniqueId", { hint str time; }, 5]] [[call]] [[BIS_fnc_loop]];</code> | ||
|x2= <code>{{codecomment|// removes stacked loop with id of uniqueId}} | |x2= <code>{{codecomment|// removes stacked loop with id of uniqueId}} | ||
["itemRemove", ["uniqueId"]] [[call]] [[BIS_fnc_loop]];</code> | ["itemRemove", ["uniqueId"]] [[call]] [[BIS_fnc_loop]];</code> | ||
|x3= <code>{{codecomment|// hints time every frame after BIS_variable is assigned}} | |x3= <code>{{codecomment|// hints time every frame after BIS_variable is assigned}} | ||
["itemAdd", ["uniqueId", { [[hint]] [[str]] [[time]]; }, [[nil]], [[nil]], { ![[isNil]] { BIS_variable } }]] [[call]] [[BIS_fnc_loop]];</code> | ["itemAdd", ["uniqueId", { [[hint]] [[str]] [[time]]; }, [[nil]], [[nil]], { ![[isNil]] { BIS_variable } }]] [[call]] [[BIS_fnc_loop]];</code> | ||
|x4= <code>{{codecomment|// hints time every five seconds after BIS_variable is assigned}} | |x4= <code>{{codecomment|// hints time every five seconds after BIS_variable is assigned}} | ||
["itemAdd", ["uniqueId", { [[hint]] [[str]] [[time]]; }, 5, "seconds", { ![[isNil]] { BIS_variable } }]] [[call]] [[BIS_fnc_loop]];</code> | ["itemAdd", ["uniqueId", { [[hint]] [[str]] [[time]]; }, 5, "seconds", { ![[isNil]] { BIS_variable } }]] [[call]] [[BIS_fnc_loop]];</code> | ||
|x5= <code>{{codecomment|// hints time every frame}} | |x5= <code>{{codecomment|// hints time every frame}} | ||
["itemAdd", ["uniqueId", { [[hint]] [[str]] [[time]]; }]] [[call]] [[BIS_fnc_loop]];</code> | ["itemAdd", ["uniqueId", { [[hint]] [[str]] [[time]]; }]] [[call]] [[BIS_fnc_loop]];</code> | ||
|x6= <code>{{codecomment|// remove item from loop with id "uniqueId"}} | |x6= <code>{{codecomment|// remove item from loop with id "uniqueId"}} | ||
["itemRemove", ["uniqueId"]] [[call]] [[BIS_fnc_loop]];</code> | ["itemRemove", ["uniqueId"]] [[call]] [[BIS_fnc_loop]];</code> | ||
| [[for]], [[forEach]], [[while]] | | [[for]], [[forEach]], [[while]] | ||
}} | }} | ||
Revision as of 23:08, 17 January 2021
Description
- Description:
- Loop stacked code/function with timing and conditional control. Code and conditions are executed in non-scheduled environment.
- Execution:
- call
- Groups:
- Program Flow
Syntax
- Syntax:
- [action, parameters] call BIS_fnc_loop
- Parameters:
- action: String - can be one of:
- "initialize" - Initializes game loop (not required as internal AUTO_INITIALIZE variable is set to true)
- "terminate" - Terminates game loop (required as internal AUTO_TERMINATE variable is not set to true)
- "itemAdd" - Adds an item to loop
- "itemRemove" - Remove item from loop with id "uniqueId"
- "onEachFrame" - internally used by "initialize"
- "itemExecute" - internally used by "onEachFrame"
- parameters: Array - used with "itemAdd" and "itemRemove" action ("itemRemove" only takes id):
- id: String - loop unique id
- code: Code or String - code to be executed
- timer: Number - (Optional, default 0) delay between executions
- timerType: String - (Optional, default "seconds") can be "seconds" or "frames"
- conditionStart: Code - (Optional, default
{ true }
) will wait until the condition is met to start the code - conditionEnd: Code - (Optional, default
{ false }
) stops the loop as soon as the ending condition is met (after the end of code) - executeOnce: Boolean - (Optional, default false)
- Return Value:
- Nothing
Examples
- Example 1:
// hints time every five seconds ["itemAdd", ["uniqueId", { hint str time; }, 5]] call BIS_fnc_loop;
- Example 2:
// removes stacked loop with id of uniqueId ["itemRemove", ["uniqueId"]] call BIS_fnc_loop;
- Example 3:
// hints time every frame after BIS_variable is assigned ["itemAdd", ["uniqueId", { hint str time; }, nil, nil, { !isNil { BIS_variable } }]] call BIS_fnc_loop;
- Example 4:
// hints time every five seconds after BIS_variable is assigned ["itemAdd", ["uniqueId", { hint str time; }, 5, "seconds", { !isNil { BIS_variable } }]] call BIS_fnc_loop;
- Example 5:
// hints time every frame ["itemAdd", ["uniqueId", { hint str time; }]] call BIS_fnc_loop;
- Example 6:
// remove item from loop with id "uniqueId" ["itemRemove", ["uniqueId"]] call BIS_fnc_loop;
Additional Information
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