timeline_size

Returns the number of active moments from a given timeline.

Syntax:

timeline_size(ind);


Argument Description
ind The index of the timeline get the information from.


Returns: N/A


Description

With this function you can get the total number of active moments for a timeline (an "active" moment is one which has code or DnD™ 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.


Example:

if timeline_size(global.tl) == 0
   {
   timeline_moment_add_script(global.tl, room_speed + irandom(room_speed), scr_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 to be used at a random moment within the timeline indexed in the global variable "tl".


Back: Timelines
Next: timeline_max_moment
© Copyright YoYo Games Ltd. 2018 All Rights Reserved