GameMaker Timeline_Position doesn't appear to work all the time

Aaron Craig

Member
Greetings,

I'm trying to change the position of a running timeline in my game back to the one it's currently one:

(moment_1)
if(this)
proceed
else
timeline_position = 1;

But it just doesn't do anything. I've verified that section of code runs, and if I change it to another timeline_position, sometimes it'll work. I altered it to jump to moment 50 and it did. But I've also got another instance where I'm trying to jump just 2 moments ahead, and it won't do that. But at another time I'm only jumping one moment ahead, and that works.
I'm not sure if it's me, or GameMaker. Anyone else have this issue? Am I attempting to use this variable wrong? Any help would be appreciated.
 

TheouAegis

Member
timeline_speed is added to timeline_position at the start of the timeline event, so before any code inside a moment is run, timeline_index has already been incremented. In other words, when Moment 0 is run, the timeline_position is no longer 0.

So to say "timeline_position+=2" is the same as saying "timeline_position+=3" relative to the current moment.

In your code, saying "timeline_position=1" should work every time because you're setting the timeline_position to a hard value. So "if(this) { proceed } else timeline_position=1" essentially locks the timeline moment. Although personally I prefer just using timeline_position-=1 for those situations.
 

Aaron Craig

Member
I agree that it should work, but I'm running the timeline, and it will not work, no matter how I tell it to do so. If I'm in moment 1, and I want to repeat it, saying timeline_position = 1 doesn't send it back to the beginning of the moment.
 

TheouAegis

Member
If all else fails, post your timeline code.

Also post the code you use to run the timeline (where you set timeline_running and timeline_speed, etc.).
 

Aaron Craig

Member
So, here's what I'm figuring out. At least in GMS2, the timeline_position is updated at the end of the moment, and it will always change to the next moment. When I have timeline_position = (current moment), it does nothing and the timeline will continue to run as is. If I set it to go back or forward at all, it will do so. This is very inconvenient to say the least, and seems as though the should be a way to replay a moment, but I cannot seem to find one right now. I can post some code, if you'd like.
 
Top