For performance reasons, you should avoid swapping tiles by ID. It goes through every tile on the map to see if it needs to be changed, and if you have a large map, it will take some time to perform. This is meant for large-scale tile swaps where it is unfeasible to specify using regions or positions.
It is recommended that you stick with region tile swapping and position tile swapping.
This script uses the concept of a "tile ID", which is a special string that represents a particular tile on your tileset.
The format of this tile ID is a letter, followed by a number. The letters available are based on the tileset names
A, B, C, D, E
The number represents the ID of the tile. So for example, "A3" would be the the third tile in tileset A, whereas "B12" would be the 12th tile of tileset B.
An example usage would be
tile_swap("A9", "A1", 0)
Which will swap all "A9" tiles on layer 0 with "A1" tiles. As usual, because I did not pass in a map ID, it is assumed to be the current map. Please check the new script call format for details.
It is very easy to look up the appropriate ID: just look at your tileset and number the top-left tile as 1. Then, numbering left-to-right, top-to-bottom, you would get something like this
For tileset A, it is a little different. This is assuming you have all 5 parts in tileset A. You will need to skip over any missing pieces appropriately if you do not have all 5 parts.
To avoid all this unnecessary math, simply fill up the empty slots with dummy tilesets to make things easier.