Storing Map Name as Variable?

I was wanting to store a map's name as a variable via the script call $game_map.name, but I keep getting this error:
Code:
undefined method `name` for # < Game_Map: 0xf849018>
How do I fix this?
That isn't a script call is why you're getting an error. You can get the display name with $gameMap.displayName()

I don't think there's a function to return the name (I can't check right now).

This should do it:

Code:
var mapId = $gameMap.mapId();
var name = $dataMapInfos[mapId].name;

Hopefully someone else can interject if there's a better way to get that. I can't remember right now🙂
@Palin I am not using a display name on my maps as my actor HUD is blocking where it would be displayed. I just want the map's database name to show.
This should do it:

Code:
var mapId = $gameMap.mapId();
var name = $dataMapInfos[mapId].name;
Hopefully someone else can interject if there's a better way to get that. I can't remember right now🙂

The problem is not doing in a better way, that is how MV hadnles things but this is a thread for VX Ace (unless this has been posted in the wrong place). XD

The correct call for VX Ace is
Code:
$game_map.display_name
No, this is the right place, as my 29th Birthday Event project is VX Ace.
That worked:
Spoiler: What I needed it for
upload_2019-3-29_13-40-35.png

EDIT: Nevermind- I figured out how to disable display names.

Thanks again, Heirukichi.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/storing-map-name-as-variable.107384/