BIS fnc eventTimeline: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (infobox to template)
m (Text replacement - "{{Feature|Informative|" to "{{Feature|informative|")
 
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function


| arma3 |Game name=
|game1= arma3
|version1= 1.78


|1.78|Game version=
|eff= local


<!---|arg= local |Multiplayer Arguments=--->
|gr1= Timeline


<!---|eff= local |Multiplayer Effects=--->
|gr2= Systems


| <pre>/*
|descr= Universal system for playing sequential events defined by time. {{Feature|informative|''codeInterrupt'' and ''codeEnd'' are [[call]]ed while the code in the timeline is [[spawn]]ed.}}
Author: ZoZo, modified by Riccardo Argiolas


Description:
|s1= [timeline, index, music, codeInterrupt, codeEnd] call [[BIS_fnc_eventTimeline]]
    Universal system for playing sequential events defined by time. Timeline (ARRAY) consists from events (ARRAY).
timeline = [event1, event2, ..., eventX];
event1 = [ time,1 code1 ];


Example: timeline1 = [ [1.0, {do something here} ], [1.5, {do something here} ], [3.2, {do something here} ] ];
|p1= timeline: [[Array]] - timeline in format <nowiki>[[1.0, {code}], [2.0, {code}], [2.3, {code}], [4.7, {code}]]</nowiki>
1st code is executed at 1.0sec after the start of the function, 2nd code is executed at 1.5sec after the start of the function and 3rd code is executed at 3.2sec after the start of the function


Parameters:
|p2= index: [[Number]] - (Optional, default 0) index of the event to play
Select 0 - 2D ARRAY : timeline in format [ [1.0, {code} ], [2.0, {code} ], [2.3, {code} ], [4.7, {code} ] ]
Select 1 - NUMBER: index of the event to play
Select 2 - STRING: music to be played which will provide the sync time for the timeline
Select 3 - (OPTIONAL) - CODE: code to be executed if the timeline is interrupted (missionNamespace setVariable ["BIS_fnc_eventTimeline_playing", FALSE])
Select 4 - (OPTIONAL) - CODE or ARRAY: code or array of codes to be executed once the timeline is finshed. The codes are CALLed one after the other.


Returns:
|p3= music: [[String]] - (Optional, default "") music to be played which will provide the sync time for the timeline


Examples:
|p4= codeInterrupt: [[Code]] - (Optional, default
*/</pre>{{placeholder}}<!-- Remove this after fill-in --> |Description=
<sqf inline>params ["_pointer", "_baseTime", "_evenTime"];
["Timeline interrupted while playing event nr.: %1 (%2)", _pointer, _baseTime + _eventTime] call BIS_fnc_logFormat;</sqf>)<br>Code to be executed if the timeline is interrupted with
<sqf inline>missionNamespace setVariable ["BIS_fnc_eventTimeline_playing", false]</sqf>


|[] call [[BIS_fnc_eventTimeline]]|Syntax=
|p5= codeEnd: [[Array]] or [[Code]] - (Optional, default [[nil]]) [[Code]] or [[Array]] of codes to be executed once the timeline is finished. The codes are [[call]]ed one after the other.


|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
|r1= [[Nothing]]


|Datatype - description|Return value=
|x1= <sqf>
private _timeline =
[
[0.0, { hint "Start of the Timeline" }],
[1.0, { hint "Event 1" }],
[3.0, { hint "End of the timeline" }]
];


|x1= <code></code>|Example 1=
[_timeline, 0, "", { hint "Interrupted" }, { hint "Timeline done" }] spawn BIS_fnc_eventTimeline;
</sqf>


|exec= call |Execution=
|exec= spawn


| |See also=
|seealso= [[BIS_fnc_animatedBriefing]]
}}
}}
[[Category:Function Group: Systems|{{uc:eventTimeline}}]]
[[Category:Functions|{{uc:eventTimeline}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:eventTimeline}}]]

Latest revision as of 00:24, 2 February 2024

Hover & click on the images for description

Description

Description:
Universal system for playing sequential events defined by time.
codeInterrupt and codeEnd are called while the code in the timeline is spawned.
Execution:
spawn
Groups:
TimelineSystems

Syntax

Syntax:
[timeline, index, music, codeInterrupt, codeEnd] call BIS_fnc_eventTimeline
Parameters:
timeline: Array - timeline in format [[1.0, {code}], [2.0, {code}], [2.3, {code}], [4.7, {code}]]
index: Number - (Optional, default 0) index of the event to play
music: String - (Optional, default "") music to be played which will provide the sync time for the timeline
codeInterrupt: Code - (Optional, default params ["_pointer", "_baseTime", "_evenTime"]; ["Timeline interrupted while playing event nr.: %1 (%2)", _pointer, _baseTime + _eventTime] call BIS_fnc_logFormat;)
Code to be executed if the timeline is interrupted with missionNamespace setVariable ["BIS_fnc_eventTimeline_playing", false]
codeEnd: Array or Code - (Optional, default nil) Code or Array of codes to be executed once the timeline is finished. The codes are called one after the other.
Return Value:
Nothing

Examples

Example 1:
private _timeline = [ [0.0, { hint "Start of the Timeline" }], [1.0, { hint "Event 1" }], [3.0, { hint "End of the timeline" }] ]; [_timeline, 0, "", { hint "Interrupted" }, { hint "Timeline done" }] spawn BIS_fnc_eventTimeline;

Additional Information

See also:
BIS_fnc_animatedBriefing

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