Trying to mimic something from an MV tutorial in Ace

For anyone that does scripting could I maybe get a clue as to what I'm doing wrong with this call? 😩

Attempt 1: $game_player.x(18) && $game_player.y(16) && $game_player.direction(8) && $game_map.map_id(6)

Attempt 2: $game_player.x = 18 && $game_player.y = 16 && $game_player.direction = 8 && $game_map.map_id = 6

Attempt 3: $game_player.x == 18 && $game_player.y ==16 && $game_player.direction == 8 && $game_map.map_id == 6
Not sure if the double ='s would do anything but I figured it was worth a shot. 😅

I'm trying to recreate it in ruby from java that SRDude used in an mv tutorial.


When I try using the script call for it in the conditional branch of the common event I keep getting an error, so I wrote something wrong but I don't have enough experience to know what exactly. 😢
Attempt 3 should work, but I'm not sure if you'll fit it all in the Script box of a conditional branch.

What is the error it gives you?

You don't need to use a script call for this at all. You can do it with Control Variables & conditional branches:

Code:
Control Variables [Player X] = Game Data > Other > Character (Player's) Map X
Control Variables [Player Y] = Game Data > Other > Character (Player's) Map Y
Control Variables [Map ID] = Game Date > Other > Map ID
Conditional Branch: Variable [Player X] = 18
  Conditional Branch: Variable [Player Y] = 16
    Conditional Branch: Player is facing UP (this is on the third or fourth tab of the conditional branch dialogue)
      Conditional Branch: Variable [Map ID] = 6
        ... do stuff here
      End
    End
  End
End

I haven't watched the video, but even if it's a bit more complicated than that, you can probably still do it with event commands.
I know I can do it with events and variables, it was more my attempt to be lazy in the least laziest way possible it turns out. 😔

And I must have written attempt 3 differently in Ace oringinally than how it is here since it actually works and I'm not getting the error (must'e had ( )'s around them 😩). Fun fact it thankfully DID all fit in the script call line. 😅
if it didn't, you could shorten it to this:

p = $game_player; p.x == 18 && p.y == 16 && p.direction == 2 && $game_map.map_id == 6


Attempt 1 is just all wrong syntax. Even MV wouldn't have done it that way.
= is an assignment - in attempt 2 you were trying to set the player's location and direction and map id to those values, and that won't work. It might have returned something, but it'd just be a true or false to indicate that the assignment was successful - I suspect it'd be false.
== is a comparison in Ruby (in javascript/MV it might be == but I'd actually use ===) which is why this one works.
Thank you that's much better. 😢

And ye, I'm still trying to figure some scripting things out which means putting things wrong a lot. I'll be making my own lil notes on ruby later for myself with your statement in there. 👋
Can I also add that you can use $game_player.pos?(x, y). Trims the script call down a bunch.
Oh wow, thank you Moonless! 😍

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-mimic-something-from-an-mv-tutorial-in-ace.90586/