timeline_moment_add_script

Adds a script to the time line at the given step.

Syntax:

timeline_moment_add_script(ind, step, script);


Argument Description
ind The index of the time line to add a moment to.
step The moment (step) to add to.
script The index of the script to add into the moment.


Returns: N/A


Description

With this function you can dynamically add scripts to Timelines (the scripts must already exist in the game resources) at any given "moment" within that time line, where a "moment" is the equivalent of one game tick (or step). In this way you can create a new time line using the timeline_add function and add different behaviours at any point, or simply modify a previously created time line resource with new behaviours. Note that the script cannot require any additional arguments when using this function.


Example:

global.tl = timeline_add();
var i = room_speed * 60;
repeat(3)
   {
   timeline_moment_add_script(global.tl, i, choose(scr_AlienAttack_1, scr_AlienAttack_2, scr_AlienAttack_3);
   i += room_speed * 60;
   }

The above code will create a new time line and store its index in the variable "global.tl". It will then add three scripts to the time line, chosen at random, at one minute intervals.


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