With this function you can get the total number of active moments for a timeline (an "active" moment is one which has code or GML Visual added to it). This can be handy when creating dynamic timelines using the timeline_moment_add_script and timeline_moment_clear functions, as you can check to see if a given timeline has the correct number of active moments or none at all.
timeline_size(ind);
Argument | Type | Description |
---|---|---|
ind | Timeline Asset | The index of the timeline get the information from. |
N/A
if timeline_size(global.tl) == 0
{
var _gamespeed = game_get_speed(gamespeed_fps);
timeline_moment_add_script(global.tl, _gamespeed + irandom(_gamespeed), spawn_enemy);
}
The above code check the given timeline size, and if it returns 0 (ie: the timeline has no active moments) it will add a script function to be used at a random moment within the timeline indexed in the global variable tl.