{"name":"BIS_fnc_eventTimeline","title":"BIS fnc eventTimeline","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_eventTimeline","revid":352082,"updated":"2024-02-01T23:24:45Z","groups":["Timeline","Systems"],"status":"ok","games":{"arma3":"1.78"},"since":"arma3 1.78","arma3_since":"1.78","locality":{"effect":"local"},"exec":"spawn","description":"Universal system for playing sequential events defined by time.\n\n> [!NOTE]\n> *codeInterrupt* and *codeEnd* are called while the code in the timeline is spawned.","syntaxes":[{"syntax":"[timeline, index, music, codeInterrupt, codeEnd] call BIS_fnc_eventTimeline","params":[{"name":"timeline","type":"Array","description":"timeline in format [[1.0, {code}], [2.0, {code}], [2.3, {code}], [4.7, {code}]]","type_expr":"Array"},{"name":"index","type":"Number","optional":true,"default":"0","description":"index of the event to play","type_expr":"Number","text":"index: Number - (Optional, default 0) index of the event to play"},{"name":"music","type":"String","optional":true,"default":"\"\"","description":"music to be played which will provide the sync time for the timeline","type_expr":"String","text":"music: String - (Optional, default \"\") music to be played which will provide the sync time for the timeline"},{"name":"codeInterrupt","type":"Code","optional":true,"default":"`params [\"_pointer\", \"_baseTime\", \"_evenTime\"]; [\"Timeline interrupted while playing event nr.: %1 (%2)\", _pointer, _baseTime + _eventTime] call BIS_fnc_logFormat;`","description":"Code to be executed if the timeline is interrupted with\n`missionNamespace setVariable [\"BIS_fnc_eventTimeline_playing\", false]`","type_expr":"Code","text":"codeInterrupt: Code - (Optional, default\n`params [\"_pointer\", \"_baseTime\", \"_evenTime\"]; [\"Timeline interrupted while playing event nr.: %1 (%2)\", _pointer, _baseTime + _eventTime] call BIS_fnc_logFormat;`)\nCode to be executed if the timeline is interrupted with\n`missionNamespace setVariable [\"BIS_fnc_eventTimeline_playing\", false]`"},{"name":"codeEnd","type":"Array or Code","optional":true,"default":"nil","description":"Code or Array of codes to be executed once the timeline is finished. The codes are called one after the other.","type_expr":"Array | Code","text":"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."}],"returns":{"type":"Nothing","type_expr":"Nothing"}}],"examples":[{"text":"```sqf\nprivate _timeline =\n[\n    [0.0, { hint \"Start of the Timeline\" }],\n    [1.0, { hint \"Event 1\" }],\n    [3.0, { hint \"End of the timeline\" }]\n];\n\n[_timeline, 0, \"\", { hint \"Interrupted\" }, { hint \"Timeline done\" }] spawn BIS_fnc_eventTimeline;\n```","code":["private _timeline =\n[\n\t[0.0, { hint \"Start of the Timeline\" }],\n\t[1.0, { hint \"Event 1\" }],\n\t[3.0, { hint \"End of the timeline\" }]\n];\n\n[_timeline, 0, \"\", { hint \"Interrupted\" }, { hint \"Timeline done\" }] spawn BIS_fnc_eventTimeline;"]}],"see_also":["BIS_fnc_animatedBriefing"]}