MZ Is it possible to store the ID of the tileset currently used in a variable?

What the title says, really. Thanks in advance for any suggestions.
So, do you mean a tileset or a single tile from the tileset?

So, for a tileset, I don't think you can get data on which tileset you're using, but you can assign it one.

So if you're using Tilset 1, and you want to store it, set up a variable named "Tileset ID" set it to 1.
etc

What you plan on doing with it?
Hmmm I'm not sure I was very clear.
I'd like to know the tileset ID (from the Tileset Tab) of the map that the player is currently visiting.
That's because I have a map with a tileset change and to match with the background I'd like to be able to know which tileset is currently used.
I'd like to know the tileset ID (from the Tileset Tab) of the map that the player is currently visiting.
try $gameMap.tilesetId()
Thank you very much.

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-store-the-id-of-the-tileset-currently-used-in-a-variable.182349/