Getting a conditional for a temp var in a spawned event

Hey, everyone!

I was wondering if it's possible to set a conditional based on temporary variables added in a script. Cuz I tried something like this:

Code:
var ev = $gameMap._interpreter._eventId
var rx = $gameVariables.value(27) - $gameMap.event(this._eventId).x;
var ry = $gameVariables.value(28) - $gameMap.event(this._eventId).y;
if ([-1, 0, 1].contains(rx) && [-1, 0, 1].contains(ry)) {
$gameSelfSwitches.setValue([$gameMap.(this._mapId), ev, 'A'], true)
};

I keep getting an 'unexpected number' error. I assume it's the (rx) (ry) that can't be in there, I tried many different options, but I'm not familiar with js enough to fix this one.

This is being set as a 'var x' this cuz the event is spawnable and I need it to set an independant variable for each instance of the event.
It's not the identifiers that are the problem, it's the [-1, 0 1]. You seem to be missing a comma between 0 and 1, so it's treating "0 1" as a single array element, and that's not valid in Javascript.
It's not the identifiers that are the problem, it's the [-1, 0 1]. You seem to be missing a comma between 0 and 1, so it's treating "0 1" as a single array element, and that's not valid in Javascript.

Yeah, I noticed that too, thanks. Alas, that did not work out as well, I wish it was just that. I keep getting errors with "}" then "[" then "(" no matter how I adjust the syntax it doesn't seem to work properly.
Yeah, I noticed that too, thanks. Alas, that did not work out as well, I wish it was just that. I keep getting errors with "}" then "[" then "(" no matter how I adjust the syntax it doesn't seem to work properly.
$gameMap.(this._mapId) is wrong as well.

Original thread: https://forums.rpgmakerweb.com/threads/getting-a-conditional-for-a-temp-var-in-a-spawned-event.178011/