Your error is down to the difference between a tile prototype and a tile instance.
When you create a tile down in the tile list in the editor, that's the prototype of the tile. It's an abstract existence, ready to be used in the game but not actually in the game.
When you actually place (or swap) a tile into a room, that creates an instance of the tile. Each instance exists in a room at specific coordinates and you can have multiple instances of the same tile (prototype). One tile exists in the tile list, but it can be instantiated or placed multiple times into rooms. Each is a separate instance of the tile.
When you call
tell with a tile id or tile name, that targets the prototype of the tile.
If you instead call
tell with coordinates e.g.
tell 12,7 to that targets a specific instance of a tile - whichever is at those coordinates in the current room.
A lot of things can only be done to instances of tiles. Like
swap in your case, it only makes sense this should happen to an actual instance of a tile placed in a room, not the abstract prototype that only lives in your tile list.
emit does is call an event on every tile instance in the current room by looping through all of the rooms coordinates. An event called on a tile with
emit is practically equivalent to using
tell with coordinates.
tell with coordinates obviously only makes sense if you know what coordinates the tile instance you want to call an event on is placed at. If instead you want to call an event on all instances of a tile in a room, like in the posts above, you will want to
emit an event.
If you think that sounds like
tell is generally much more useful using coordinates rather than tile id or name, then I agree! Most of the time I use
tell it is with coordinates. There are use cases for using
tell with a tile name to call an event on the tile prototype (and some would be equivalent with id too, although I think name is definitely more readable in your code!), for example I have used it to avoid duplicating the same code across multiple tiles.
(Apologies if I laboured any points there, I figure it's better to overexplain than underexplain!)