The Sequence Instance Struct

A sequence, when placed in a room, is placed as an element on the layer, and this element contains a sequence instance. This sequence instance will have the following properties in its struct:

Sequence Instance Struct
VariableTypeDescription
sequenceSequence Object StructThis is the ID of the sequence object struct that the sequence instance has been created from (see herefor more details). You can get or set this struct, and so change the base sequence that the instance is referencing.
headPositionRealThis is the current playhead position (in frames) for the sequence instance. You can get or set this value, but note that setting it to a value greater or less than the currently defined play region will have different effects depending on the type of playback set for the sequence. See layer_sequence_headpos() for more information.
headDirectionSequence Direction ConstantThis is the current playback direction for the sequence instance. You can get or set this value using the constants given in the next table (Note that you can use the layer functions layer_sequence_get_headdir() and layer_sequence_headdir() to get or set this value without having to access the struct directly).
speedScaleRealThis property can be used to get or set the playback speed scale. The speed scale is a multiplier, where 1 is the default playback speed and values less than 1 will slow the playback and values larger than 1 will speed it up, eg: a value of 0.5 would be half playback speed, while a value of 2 would be double playback speed. Note that you can use the layer functions layer_sequence_get_speedscale() and layer_sequence_speedscale() to get or set this value without having to access the struct directly.
pausedBooleanYou can check this property to see if a sequence has been paused or not, and it will be true if it has, or false otherwise. This is a read-only property, but you can use the layer function layer_sequence_pause() to pause playback, and layer_sequence_play() to resume it again if required. You can also check this property using the layer function layer_sequence_is_paused() rather than check the property in the struct directly.
finishedBooleanYou can check this property to see if a sequence has finished playing or not, returning true if it is finished playing, and false otherwise. This is a read-only property, and will only ever return true for tracks that are not set to loop or ping-pong. You can also check this property using the layer function layer_sequence_is_finished() rather than check the property in the struct directly.
elementIDSequence Element IDThis property holds the ID of the sequence element. This ID is a simple identifying value that is associated with a layer in the room editor, and it can then be used with the appropriate layer functions to find the layer the sequence has been assigned to or to change certain sequence properties without having to deal with the struct.
activeTracksArray of Sequence Active Track StructsThis property will hold an array of "evaluation" structs containing information on the current state of each asset track in the sequence (graphics, sequence, audio etc...). These are the top-level tracks, and the array returned is read-only. For the contents of the asset track struct returned in each array entry, please see the section below.

 

Sequence Direction Constant
ConstantDescriptionValue
seqdir_rightThe sequence will play frames in an incremental order from left to right1
seqdir_leftThe sequence will play frames in a decremental order from right to left-1

 

activeTracks Struct

IMPORTANT Although this property already exists in the sequence instance struct in the Sequence Create event, it is only filled with tracks after the first Sequence Begin Step event. So the first time you will find values in this struct is during the first iteration of the Sequence Step Event.

The following list contains the properties that may be available to you when accessing an active track struct (as included in the activeTracks array of a Sequence Instance struct, explained above). Each asset track struct can have any of the following properties, depending on the type of asset the track uses (note that you can modify all these properties, except where specified as read-only), and all values returned are for the current playhead position:

Sequence Active Track Struct
VariableTypeDescription
matrixMatrix ArrayThis is the transformation matrix used to draw the track (sprite, instance and sequence tracks).
posxRealThe position of the asset in the sequence along the X axis for the track at the current playhead position (all assets).
posyRealThe position of the asset in the sequence along the Y axis for the track at the current playhead position (all assets).
scalexRealThe scale of the asset in the sequence along the X axis for the track at the current playhead position (sprite, instance and sequence tracks).
scaleyRealThe scale of the asset in the sequence along the Y axis for the track at the current playhead position (sprite, instance and sequence tracks).
xoriginRealThe X origin of the asset for the track (all assets).
yoriginRealThe Y origin of the asset for the track (all assets).
widthRealThe width (in pixels) of the asset for the track (sprite, instance and sequence tracks).
heightRealThe height (in pixels) of the asset for the track (sprite, instance and sequence tracks).
imageindexRealThe image index for the asset on the track in the sequence at the current playhead position (sprite and instance tracks).
imagespeedRealThe image speed for the asset on the track in the sequence at the current playhead position (sprite and instance tracks).
colourMultiplyColourThe colour multiply value for the asset on the track in the sequence at the current playhead position (sprite, instance and sequence tracks). This value will be an array of four ARGB values with the format [A, R, G, B]. Note that the values for each component are expressed as between 0 and 1, where 0 corresponds to the HEX value #00 and 1 corresponds to the HEX value #FF (0 - 255 as shown in the colour picker for colour multiply tracks in the Sequences Editor).
soundIndexSound Instance IDThe ID of the sound instance that's playing on this track's emitter (audio tracks).
emitterIndexAudio Emitter IDThe index of the audio emitter belonging to this track (audio tracks).
gainRealThe gain (volume) of the track at the current playhead position (audio tracks).
pitchRealThe pitch of the track at the current playhead position (audio tracks).
particleSystemIndexParticle System InstanceThe ID of the particle system of this track (particle system tracks).
frameSizeXRealThe horizontal size of the text frame (text tracks).
frameSizeYRealThe vertical size of the text frame (text tracks).
characterSpacingRealThe character spacing value (text tracks).
lineSpacingRealThe line spacing value (text tracks).
paragraphSpacingRealThe paragraph spacing value (text tracks).
trackSequence Track StructThe Track Struct that this track is based on (all assets, a read-only value).
parentSequence Instance StructThe parent sequence instance ID for the track (all assets, a read-only value).
activeTracksArray of Sequence Track StructsThis is an array of evaluation structs for each parameter track that the asset track contains (all assets, a read-only value). The contents of each struct in the array are listed in the parameter Track Struct section.