Get Location Info: Event ID - Can it store more than one ID in a variable?

I have a switch event that I want to activate whenever another event is standing on it (= on the same tile)

I tried to use Get Location Info: Event ID to store the event ID on that tile and then conditional branch to check that this ID is not 0, and then check that the ID is not the switch event's ID

This doesn't seem to work, so I'm assuming this command can only store one event ID in that variable (the switch's ID). Any other way I could do this?
It gets the lowest applicable event ID (or, like you imply, 0 if no events are there).

The switch event just needs to have a higher ID than the others. You can make copies of the switch event until you get one with a high enough ID, then use that copy for the actual switch event (delete the others).
Thank you!

Is there any way to ignore the switch's ID via scripting? as in, to tell the game to "skip" that ID number while storing the value?
You can write your own search to include such a condition, e.g. Control Variables -> Script:

var x = 3, y = 4, ignoreId = 5; var r = 0; for (var ev of $gameMap.eventsXy(x, y)) { var id = ev.eventId(); if (id !== ignoreId) { r = id; break; }}; r
However, I would recommend just managing your event IDs instead. 😅
That's awesome! you're a lifesaver 😀

I realized in retrospect that checking the ID for 0 was redundant, because it can never be 0 (the switch will always stay on its tile). So I'm only doing one check to see if the ID is identical to "this event" (=the switch) or if it's something else.
Would that simplify the code?
You would need more information to simplify the script call. Most of its work is done by eventsXy, filtering out events that aren't on that tile. This is why I suggested using the event command as-is, because that's actually more efficient: it just takes the ID of the first event from eventsXy, and does it without any runtime evaluation. (It also encourages good organisation.)

If there are 2 (or more) events there then generally you'd still need to check each one to find the non-switch event's ID. If the switch is always going to be the lower ID, then you could do something very similar to the event command:

var ev = $gameMap.eventsXy(3, 4)[1]; ev ? ev.eventId() : 0
I.e. get the second event (index 1) on tile X = 3, Y = 4; if there is such an event, return its ID, otherwise return 0.

Original thread: https://forums.rpgmakerweb.com/threads/get-location-info-event-id-can-it-store-more-than-one-id-in-a-variable.152199/