Display map name only one time in Map Display Pro

I'm using the Map Display Pro script by Majirefy. It displays the map names beautifully every time the player enters a map and works like a charm. Could this be expanded by a little feature:

I want to be able to control with a switch if a map name will be displayed or not if a player enters a map. Like, if a switch is ON, then when the player everytime enters a map, the map name will get displayed, but if that same switch is OFF, the map name gets displayed only the first time the player enters a map, and then never again (only if that switch is ON again the map name gets displayed).

I want to implement this feature into the options, and for that, I need a switch.

Script:
Code:
# encoding: utf-8
#==============================================================================
# ** Window_MapNamePlus
#------------------------------------------------------------------------------
#  This window displays the map name.
#------------------------------------------------------------------------------
#    This class replaces the default Window_MapName class, adding more
#   modification and custom.
#------------------------------------------------------------------------------
#  Author: Majirefy
#------------------------------------------------------------------------------
#  Guide:
#    To use this script, create a new section below Materials in Script Editor
#   and paste the script there. Then turn to Scene_Map section, find string
#   "Window_MapName.new", replace it by "Winodw_MapNamePlus.new".
#    Map name should be set in pattern like "拉普兰德@Lapland", using symbol "@"
#   to split Chinese character and English text. You can also use "@" to split
#   everything in map name.
#------------------------------------------------------------------------------
#  Version: 1.0 - 20120502
#   First Release
#==============================================================================
class Window_MapNamePlus < Window_Base
  #--------------------------------------------------------------------------
  # * Settings
  #--------------------------------------------------------------------------
  FONT_NAME_CH = ["PMingLiU", "FangSong"]       # Chinese Font Name
  FONT_SIZE_CH = 42                             # Chinese Font Size
  FONT_NAME_EN = ["Monotype Corsiva"]           # English Font Name
  FONT_SIZE_EN = 28                             # English Font Size
  FONT_BOLD    = false                          # True if Font in Bold
  FONT_COLOR   = Color.new(255, 255, 255, 255)  # Color of Font
  FONT_OUT     = true                           # True if Font Has Outline
  OUT_COLOR    = Color.new(0, 0, 0, 200)        # Color of Outline Color of Font
  FONT_SHADOW  = false                          # True if Text Drops Shadow
  MODIFIER     = "~"                            # Modifier Added beside Map Name
  PADDING      = 8                              # Padding between Window's Frame and Contents
  LINE_HEIGHT  = 6                              # Height of Split Line
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :map_name_ch                      # Chinese Map Name
  attr_reader :map_name_en                      # English Map Name
  attr_reader :line_x                           # Split Line X Coordinate
  attr_reader :line_y                           # Split Line Y Coordinate
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    #----------------------------------------------------------------------
    # * Set the window in the middle of screen.
    #----------------------------------------------------------------------
    super(((Graphics.width - window_width) / 2),
      ((Graphics.height - (FONT_SIZE_CH + FONT_SIZE_EN + PADDING * 4 + LINE_HEIGHT)) / 2),
      window_width, FONT_SIZE_CH + FONT_SIZE_EN + PADDING * 4 + LINE_HEIGHT)
    #----------------------------------------------------------------------
    # * Custom font and style.
    #----------------------------------------------------------------------
    contents.font.bold      = FONT_BOLD
    contents.font.color     = FONT_COLOR
    contents.font.outline   = FONT_OUT
    contents.font.out_color = OUT_COLOR
    contents.font.shadow    = FONT_SHADOW
    #----------------------------------------------------------------------
    # * Set Window Opacity
    #----------------------------------------------------------------------
    self.opacity = 0
    self.contents_opacity = 0
    @show_count = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return Graphics.width
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if @show_count > 0 && $game_map.name_display
      update_fadein
      @show_count -= 1
    else
      update_fadeout
    end
  end
  #--------------------------------------------------------------------------
  # * Update Fadein
  #--------------------------------------------------------------------------
  def update_fadein
    self.contents_opacity += 16
  end
  #--------------------------------------------------------------------------
  # * Update Fadeout
  #--------------------------------------------------------------------------
  def update_fadeout
    self.contents_opacity -= 16
  end
  #--------------------------------------------------------------------------
  # * Open Window
  #--------------------------------------------------------------------------
  def open
    refresh
    @show_count = 150
    self.contents_opacity = 0
    self
  end
  #--------------------------------------------------------------------------
  # * Close Window
  #--------------------------------------------------------------------------
  def close
    @show_count = 0
    self
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    set_map_name
    unless $game_map.display_name.empty?
      draw_map_name
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Line
  #--------------------------------------------------------------------------
  def draw_line(rect)
    temp_rect = rect.clone
    temp_rect.height = LINE_HEIGHT
    temp_rect.width /= 4
    contents.gradient_fill_rect(temp_rect, color2, color1)
    temp_rect.x += temp_rect.width
    temp_rect.width *= 2
    contents.fill_rect(temp_rect, color1)
    temp_rect.x += temp_rect.width
    temp_rect.width /= 2
    contents.gradient_fill_rect(temp_rect, color1, color2)
  end
  #--------------------------------------------------------------------------
  # * Set Map Name
  #--------------------------------------------------------------------------
  def set_map_name
    temp_map_name = $game_map.display_name.split("@")
    @map_name_ch  = temp_map_name[0].to_s
    @map_name_en  = MODIFIER + " " + temp_map_name[1].to_s + " " + MODIFIER
  end
  #--------------------------------------------------------------------------
  # * Draw Map Name
  #--------------------------------------------------------------------------
  def draw_map_name
    set_line_position
    set_line_width
    temp_line_rect = Rect.new(@line_x, @line_y, set_line_width, LINE_HEIGHT)
    draw_line(temp_line_rect)
    temp_name_rect_ch = Rect.new(0, 0, contents.width, FONT_SIZE_CH)
    contents.font.name = FONT_NAME_CH
    contents.font.size = FONT_SIZE_CH
    draw_text(temp_name_rect_ch, @map_name_ch, 1)
    temp_name_rect_en = Rect.new(0, FONT_SIZE_CH, contents.width, FONT_SIZE_EN)
    contents.font.size = FONT_SIZE_EN
    contents.font.name = FONT_NAME_EN
    draw_text(temp_name_rect_en, @map_name_en, 1)
  end
  #--------------------------------------------------------------------------
  # * Set Line Width
  #--------------------------------------------------------------------------
  def set_line_width
    text_width_ch = text_size(@map_name_ch).width * 1.5
    text_width_en = text_size(@map_name_en).width * 1.5
    (text_width_ch >= text_width_en) ?
      (text_width_ch) : (text_width_en)
  end
  #--------------------------------------------------------------------------
  # * Set Line Position
  #--------------------------------------------------------------------------
  def set_line_position
    @line_x = (contents.width - set_line_width) / 2
    @line_y = (contents.height - LINE_HEIGHT) / 2
  end
  #--------------------------------------------------------------------------
  # * Get Color 1
  #--------------------------------------------------------------------------
  def color1
    Color.new(255, 255, 255, 255)
  end
  #--------------------------------------------------------------------------
  # * Get Color 2
  #--------------------------------------------------------------------------
  def color2
    Color.new(255, 255, 255, 0)
  end
end
Can't you just use the event command map display name OFF? Or does that not work with the script?
It works with the script, however, It will completely turn off the displaying of the map names. I want it so the map name is displayed the first time the player enters a map, then never again on that map, unless the switch is flipped.
I didn't see it in this script, but in MOG Touhou map name script you can use $game_temp.mapname = true
to have the script run and of course turn it to false to turn the script off.

What I did was something similar to what you asked. I only want the name to show up once when it's a new area. so I have the script off and when entering the area for the first time I turn the script on in the transfer event, then use self-switch to use a second page where the script call to turn it on is not present.
So page 1 of the event and page 2 are the same, except page 1 has the script call to turn on, transfer player, turn off.

Can't you just use the event command map display name OFF? Or does that not work with the script?
I totally did not know that was there as a function. I thought it said "change map name".
Yeah, I too wanted to make it event based, I just couldnt figure out how. Basically I wanted it to be the same as you described Roninator2.
Anyone?
Ok I put some effort into it. do this

I changed the class to "class Window_MapName < Window_Base" So I removed the Plus. Then the script worked for me.

After line 38 put in MAPDIS = 2 # switch used to turn map name on or off.

Code:
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    set_map_name
    if $game_switches[MAPDIS] == true
      unless $game_map.display_name.empty?
        draw_map_name
      end
    end
  end
Thank you Roninator2, it works, now I can turn the map name display on or off 🙂

Now is there a way to display the map name only the first time the player enters a map? Like a third option?
That would require a lot of rewriting of the script and someone with ruby knowledge would have to do it.

On the other hand, all you need to do is keep track of when a player enters a map for the first time then change the event that was used to transfer the player to one that does not enable the script.
map1.PNG
map2.PNG

If you have more events that allow the player to transfer to the same map then you would have to use a script call to change the self-switch on all those events to on.
$game_self_switches[[MapID, EventID, 'switch setting A, B, C, D']] = true
$game_self_switches[[9, 61, 'A']] = true
Sure, but if I use the method you show on those pictures, and enter a different map for the first time, then the switch is turned off, and stays off for the rest of the game. I need to somehow tell the game to remember which map has the player entered, so when before he or she enters a map, it will flip the switch to on if never entered it or off when it was visited before.
So I missed one thing in explaining. But what I showed and explained is what you can do.
map1.PNG

Another method would be using a lot of switches. when going to a map check if a switch is on then display name or not.

What your asking for is to have an array that gets reduced when used.
I can't code that.
Yeah, basically, it would have to be a variable array, like "showmap=[1,1,1,1,1,1,1]", for each map a 1. Then, if the player enters a map, it checks the map ID, then that array(like if the player enters a map with ID 6, then it checks the 6th number in the array). If that number is a 1, then the player hasn't yet visited the map, so it turns the 1 to 0 and shows the map name, otherwise, it doesn't show anything. But I can't code it either.

Original thread: https://forums.rpgmakerweb.com/threads/display-map-name-only-one-time-in-map-display-pro.90891/