Legacy GM Timeline Not Working [RESOLVED]

B

Ben Zigdon

Guest
I have this code to create a timeline and add these 4 scripts to moments 10, 20, 30, 40.

Code:
global.tl = timeline_add();

timeline_moment_add_script(global.tl,10,scr_leftsensor());

timeline_moment_add_script(global.tl,20,scr_upsensor());

timeline_moment_add_script(global.tl,30,scr_downsensor());

timeline_moment_add_script(global.tl,40,scr_rightsensor());

timeline_index = global.tl;
timeline_position = 0;
timeline_running = true;
Each script is just an instance create script. The problem is, the code basically disregards my timeline, and as soon as I run it it just immediately creates the 4 objects all at once. Even if I set timeline_running to false.

How do I fix this? Thanks
 

TheouAegis

Member
As Indy said, you want to pass the script IDs to the function, not actually run the scripts. When the scripts are referenced with parentheses, you run them. When you simply use the script without parentheses, you are referring to its ID.
 
B

Ben Zigdon

Guest
That stopped everything from running all at the beginning like you said, but now it just doesn't show up ever. Even when I set position to 0 and have the timeline start running.
 

TheouAegis

Member
Post your new code so we are sure you did it right. :p

It's possible you need to define the timeline in reverse. So instead of moment 10 being first, moment 40 should be first. (Or just assign moment 40 first and then assign moment 10 through 30 in whatever order you want.)
 
Last edited:
B

Ben Zigdon

Guest
I tried that and it still didn't work. I think I'm just going to use the gamemaker built in timelines. Thank you both for helping though. Also, do you think having a timeline with around 360 events (one every 15 steps) and 5400 steps will cause issues? Each one corresponds to a song so they'll all be about 3 minutes (if not more).
 

Fabseven

Member
As everyone said donot use () when you use timeline_moment_add_script
so :
timeline_moment_add_script(global.tl,40,scr_rightsensor()); => timeline_moment_add_script(global.tl,40,scr_rightsensor);

Another thing :
There is a bug in timeline, you have to add your first event in the end of the timeline or it wont work.

Let's say you got a ds_list when first item is the first event and last item the last event
you will probably loop from 0 to size wile adding timeline_moment , DONT DO THAT , loop from size to 0 and it will work.
 
B

Ben Zigdon

Guest
Yeah I fixed the first parenthesis issue. I think it was that bug that was giving me problems. Thank you
 
Top