[VXAce]Problem script to display map name

Hi again,

I need your help also for another problem with scripts.

To avoid creating too many maps, I use one map by place. For example, I create one map for my town and each habitation/shop/building...

To display correctly the name of the map, I use the script made by Shaz :

Spoiler
# To change the display name, you do a Script command like this :# set_map_name("My Map Name")
# which changes the name of the current map, or
# set_map_name("My Map Name", 10)
# which changes the name of a different map (10 being the map id, no leading
# zeros)

class Game_System
#--------------------------------------------------------------------------
# * Set Map Display Name
#--------------------------------------------------------------------------
def set_map_name(display_name, map_id = $game_map.map_id)
@map_names ||= {}
@map_names[map_id] = display_name
end
#--------------------------------------------------------------------------
# * Get Map Display Name
#--------------------------------------------------------------------------
def get_map_name(map_id = $game_map.map_id)
@map_names ||= {}
return @map_names[map_id] if @map_names.has_key?(map_id)
return $game_map.display_name if map_id == $game_map.map_id
return ''
end
end

class Window_MapName < Window_Base
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
unless $game_system.get_map_name.empty?
draw_background(contents.rect)
draw_text(contents.rect, $game_system.get_map_name, 1)
end
end
end

class Game_Interpreter
#--------------------------------------------------------------------------
# * Set Map Display Name
#--------------------------------------------------------------------------
def set_map_name(display_name, map_id = $game_map.map_id)
$game_system.set_map_name(display_name, map_id)
end
end
But I have a problem with another script that I use to change the appearance of the display name. This script is here :

Spoiler
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+# ■ Window_MapName Plus+
# ■ Author: Bigace360
# ■ Version: 1.0
# ■ Date: April 26, 2012
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# v1.0 (4.26.2012) ● Original script completed
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

module ACE
module MAPNAME
NAME_ALIGN = 1
FONT_SIZE = 24
FONT_TYPE = 'Verdana'
end
end

class Window_MapName < Window_Base
include ACE::MAPNAME
def initialize
super(0, 0, Graphics.width, fitting_height(1))
self.opacity, self.contents_opacity, @show_count = 0, 0, 0
self.contents.font.size, self.contents.font.name = FONT_SIZE, FONT_TYPE
refresh
end
def update_fadein
self.opacity += 32 unless $game_map.display_name.empty?
self.contents_opacity += 16
end
def update_fadeout
self.opacity -= 16 unless $game_map.display_name.empty?
self.contents_opacity -= 16
end
def refresh
contents.clear
self.visible = true
if $game_map.display_name.empty?
self.visible = false
return
end
draw_text(contents.rect, $game_map.display_name, NAME_ALIGN)
end
end
The script of Shaz doesn't work because there is the script of Bigace. Can you help me to modify one of these scripts please ?
Remove the refresh method from the first script, and in that method for the second one change the line

draw_text(contents.rect, $game_map.display_name, NAME_ALIGN)

to

draw_text(contents.rect, $game_system.get_map_name, NAME_ALIGN)

That should do it.
It doesn't work but I found the mistake. I fix it but there is another problem.

When I go on a map which has a name, this name appears in a rectangle at the top of the screen.

When I go on a map which don't have a name, nothing is happening, which is normal.

But when I go on a map which has a name and I come back speedly on a map which don't have name before the disappearance of the rectangle, there is a bug with empty rectangle which stays displayed on the screen.

552944Capture.jpg

Original thread: https://forums.rpgmakerweb.com/threads/vxace-problem-script-to-display-map-name.38930/