GML Skipping to the next scene in the timeline

Gleb

Member
Hi all.

I'm working on a game that uses timelines for cutscenes, as well as dialogue. My main objective with this thread is to get the Timeline_position function working (how i think it should work) or find a viable alternative.

So, I have the timelines set to function as dialogue. This works by creating a new textbox at the given number of steps after updating a ds_map ID, and deleting the old one.

So at 0 you'd have:

Code:
instance_create_layer(x,y,"text",obj_text);
and at 100 or so you'd have (The code is identical, just not the number of steps):

Code:
global.text ++;
And this would continue until the dialogue is finished and the scene ends.

BUT.

In obj_text's create event, it creates an object; obj_textskipper. This was my method to skip the text.

Obj_textskipper's leftmouse release event:

Code:
timeline_position ++;
instance_destroy(self);
instance_destroy(obj_text);
I thought this would skip directly to the next event in the timeline, but it doesn't. This game will have many timelines like this, so making a new code for each timeline might not be the best. Am I using timeline_position correctly?

Thanks
 

Gleb

Member
Is there an alternative way to do this?

I've asked this question several times and scoured the manual, please any help is really appreciated
 

Gleb

Member
Thank you so much! Things are working now.

That being said,
Code:
Timeline_position ++;
doesn't seem to skip to the next step in the timeline.

However, putting the exact step in like
Code:
Timeline_position = 150;
does work.

Is there a way to skip to the next position in the timeline automatically rather than having a new line for each varying number of steps?
 

TailBit

Member
I looked up the timeline functions, there is no way to get the position of the next timeline moment, however..

timeline_speed might be close to what you want, if the speed will pass over several timeline moments, then they all will be triggered (presumeably in the timeline order)

Otherwise you might have to go for some alternatives
 

TheouAegis

Member
timeline_position++ does work, but if your timeline is at 100, timeline_position++ puts it at 101, not 150. Then on the NEXT step ot will run moment 101 if it has any code. If timeline_speed is greater than 0, it will increment the position. Note also if moment 100 calls timeline_position++, it will actually be 102 on the next step.
 

Gleb

Member
Can i test using > and <??

Because then i can say something like

Code:
if (timeline_position >= 101 && <= 149)
{
timeline_position = 150;
}
I'll try it now wish me luck
 

TailBit

Member
Wait, if you are putting them on set positions, like 100, 200, 300, and so on, then you would know where to jump to, so going to the next one would be:
Code:
timeline_position = ((timeline_position div 100) + 1) * 100;
 
Top