Ingame Mapname Changer

This script will let you change the Mapname directly on-the-fly.
If you use it, please add "Evil95" to the credits. Thank you.


Spoiler: Version 1.2
Ruby:
#==============================================================================
# Ingame MapName Changer
# -----------------------------------------------------------------------------
# Version 1.2 (30.05.2021)
# Autor: Evil95
#==============================================================================
# IMPORTANT: 
# It's compatible with Yanflys Ace Save Engine.
# -----------------------------------------------------------------------------
#
# HOW TO:
# Right before a Teleport-Call insert a script with the following text:
# $game_variables[IMNC::VID] = "New Mapname"
# 
# In the event contents list it should look like this:
#
# Script: $game_variables[IMNC::VID] = "New Mapname"
# Control Switches: [0001:Mapname_Switch] = ON
# Transfer Player:[001:MAP001] (001,001)
# Control Switches: [0001:Mapname_Switch] = OFF
#
#==============================================================================
module IMNC
  # Switch ID to turn the new Mapname on and off
  SID = 170
  # Variable ID to store the new name
  VID = 93
end

class Window_MapName < Window_Base
  def refresh
    contents.clear
    unless $game_map.display_name.empty?
      draw_background(contents.rect)
      if $game_switches[IMNC::SID] == false
        draw_text(contents.rect, $game_map.display_name, 1)
      else
        draw_text(contents.rect, $game_variables[IMNC::VID], 1)
      end
    end
  end
end

class Game_Map
  def display_name
    if $game_switches[IMNC::SID] == false
      @map.display_name
    else
      @map.display_name = $game_variables[IMNC::VID]
    end
  end
end

Outdated Demo Attached.

EDIT: It's now compatible with Yanfly's Save Engine!
Just a tip, it's not a great idea to change a constant. I would recommend using a game variable to store the name of the map instead; this means that it will remain that way if the player saves the game and reloads it (for example), and it will be compatible with any other scripts that use the map name.
Script update: It now uses a game variable to store the mapname.
Thx @A-Moonless-Night

Original thread: https://forums.rpgmakerweb.com/threads/ingame-mapname-changer.123394/