Get the first/mid/last index variable/switch/event ID

array.push(self.ID)

?

you'd have to give each event an ID, or grab it from the event somehow.
@Trihan I try to make a variable(12) to push an array,
but it always trigger "try again", if I remove [ and ], than
it's always true, even if the array is empty.
even with ["1","2","3"] seems to trigger always as succeeded.

something doesn't work or it doesn't take the array check?
is something wrong with this?

I made 4 events, 3 has the same (.push(1), push(2) and .push(3) ),
4th is to check but I dont know why it doesn't trigger. triiger.png
variables.setvalue(12,[]) -> []
variables(12).push(3) -> [3]
variables(12) == [1,2,3] -> [3] == [1,2,3] ? -> false.

variables(12).push(3) always defaults to variables.setvalue(12, []), so, it'll never be [1,2,3]
@gstv87 I have 3 events that pushes number, 1,2,3,

as the output on event 3 (1,2,3) shows 1,2,3

so how can you check if it's equal to 1,2,3 in this example?
as it always returns false, if it's false, I reset it to an empty array.
as if it's true, it stays true unless you add another number to make it false.

this is only to test it before I implent with the switches on them.
this is ideal when turning on a switch -> push ID, Number or string
into it for checking what order is taken.

EDIT:
I kinda solve it half, but need a safety to be sure to not exeed it.

solution for now (use a shorter version as I use conditionBranch++ for it
as that works better.

JavaScript:
 v(12)[0]) == 1 && v(12)[1]) == 2 && v(12)[2]) == 3

as this works, it also works with 1,2,3,1,2,1,1,1,3,3,2,1 etc, it all returns true.
to make it fail, or reset it, if value EXCEED 3 numbers. just as a failsafe
when something went wrong.

is there any solution to that part? (I use switches to prevent that), and
can reset when they fail at any time, but as extra failsafe, it would be nice.
@gstv87 I have 3 events that pushes number, 1,2,3,

as the output on event 3 (1,2,3) shows 1,2,3

so how can you check if it's equal to 1,2,3 in this example?
as it always returns false, if it's false, I reset it to an empty array.
as if it's true, it stays true unless you add another number to make it false.

this is only to test it before I implent with the switches on them.
this is ideal when turning on a switch -> push ID, Number or string
into it for checking what order is taken.

EDIT:
I kinda solve it half, but need a safety to be sure to not exeed it.

solution for now (use a shorter version as I use conditionBranch++ for it
as that works better.

JavaScript:
 v(12)[0]) == 1 && v(12)[1]) == 2 && v(12)[2]) == 3

as this works, it also works with 1,2,3,1,2,1,1,1,3,3,2,1 etc, it all returns true.
to make it fail, or reset it, if value EXCEED 3 numbers. just as a failsafe
when something went wrong.

is there any solution to that part? (I use switches to prevent that), and
can reset when they fail at any time, but as extra failsafe, it would be nice.
You should be able to do v(12) === [1, 2, 3] as well.

The way I'd do that would just be to check whether v(12).length === 3 at the end of the event.
@Trihan the v(12) == [1,2,3] or strictly [1,2,3] returns false,
and I dont know why either, something doesn't read array [numbers]
for some reason.

I recheck that, and the length on the end as failsafe if that works,
because exeeding it would return false.

let me test the length and the array again.

EDIT:
the v(12).length === 3 stops if over and fails, which is nice.

however, the v(12) === [1,2,3] keeps failing, but while seperatly,
it works as intended.

as it is probably best for that part, I might be using that instead.
might be slightly more work on it, but it does what it should do.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/get-the-first-mid-last-index-variable-switch-event-id.148121/