Project1

标题: 救命,地图显示脚本 [打印本页]

作者: creeper0924    时间: 2015-8-23 19:53
标题: 救命,地图显示脚本
本帖最后由 creeper0924 于 2015-8-23 20:31 编辑

这个脚本放哪儿都出现(stack level too deep)的问题{:2_277:}
通常在第93行。。。
RUBY 代码复制
  1. # ▼▲▼ XRXS20. 地名显示 1.01 ▼▲▼
  2. # 汉化修改 by 黑暗骑士
  3. #==============================================================================
  4. # ■ Window_Map_Name
  5. #------------------------------------------------------------------------------
  6. #  这是一个显示的地图名称的窗口
  7. #==============================================================================
  8. class Window_Map_Name < Window_Base
  9.   #--------------------------------------------------------------------------
  10.   # ● 初始化对象
  11.   #--------------------------------------------------------------------------
  12.   def initialize
  13.   super(460, 0, 180, 64)
  14.   self.contents = Bitmap.new(width-32, height-32)
  15.   @showing_time = 0
  16.   @text_color = Color.new(255,255,255,255) # 地名:描写文字色
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 文本集
  20.   # text : 文字串显示在窗口
  21.   # align : 对齐(0 .左,1 .中心,2 .右)
  22.   #--------------------------------------------------------------------------
  23.   def set_text(text, align = 2)
  24.   # 如果文本和对准中的至少一个是从与上次不同
  25.   if text != @text or align != @align
  26.   # 重绘
  27.   self.contents.clear
  28.   @showing_time = 100
  29.   @text = text
  30.   @align = align
  31.   @actor = nil
  32.   self.contents_opacity = 255
  33.   x = 4
  34.   y = 0
  35.   self.contents.font.color = Color.new( 0, 0, 0, 192)
  36.   self.contents.draw_text(x+2, y+2, self.width - 40, 32, "-"+text+"-",align=1)
  37.   self.contents.font.color = Color.new( 64, 64, 64, 192)
  38.   self.contents.draw_text(x-1, y-1, self.width - 40, 32, "-"+text+"-", align=1)
  39.   self.contents.draw_text(x+1, y-1, self.width - 40, 32, "-"+text+"-", align=1)
  40.   self.contents.draw_text(x-1, y+1, self.width - 40, 32, "-"+text+"-", align=1)
  41.   self.contents.draw_text(x+1, y+1, self.width - 40, 32, "-"+text+"-", align=1)
  42.   self.contents.font.color = @text_color
  43.   self.contents.draw_text(x, y, self.width - 40, 32, "-"+text+"-", align=1)
  44.   else
  45.   @showing_time -= 1
  46.   if @showing_time < 16
  47.   # 开始淡出
  48.   self.contents_opacity = @showing_time * 16
  49.   elsif @showing_time <= 0
  50.   # 关闭你有一定的时间显示
  51.   self.contents.clear
  52.   end
  53.   end
  54.   self.visible = true
  55.   end
  56.   end
  57.   #==============================================================================
  58.   # ■ Scene_Map
  59.   #==============================================================================
  60.   class Scene_Map
  61.   #--------------------------------------------------------------------------
  62.   # ● 主处理
  63.   #--------------------------------------------------------------------------
  64.   alias xrxs20_main main
  65.   def main
  66.   # 绘制地名窗口
  67.   @map_name_window = Window_Map_Name.new
  68.   @map_name_window.opacity = 0
  69.   # 取消
  70.   xrxs20_main
  71.   # 要释放的地方窗口的名称
  72.   @map_name_window.dispose
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 刷新画面
  76.   #--------------------------------------------------------------------------
  77.   alias xrxs20_update update
  78.   def update
  79.   # 地图窗口刷新
  80.   @map_name_window.set_text($game_map.name,1)
  81.   xrxs20_update
  82.   end
  83.   end
  84.   #==============================================================================
  85.   # ■ Scene_Title
  86.   #==============================================================================
  87.   class Scene_Title
  88.   #--------------------------------------------------------------------------
  89.   # ● 主处理
  90.   #--------------------------------------------------------------------------
  91.   alias xrxs20_main main
  92.   def main
  93.   $map_infos = load_data("Data/MapInfos.rxdata")
  94.   for key in $map_infos.keys
  95.   $map_infos[key] = $map_infos[key].name
  96.   end
  97.   xrxs20_main
  98.   end
  99.   end
  100.   #==============================================================================
  101.   # ■ Game_Map
  102.   #==============================================================================
  103.   class Game_Map
  104.   #--------------------------------------------------------------------------
  105.   # ● 获取地图名称
  106.   #---------------------------------------------------------------------------
  107.   def name
  108.   $map_infos[@map_id]
  109.   end
  110. end

作者: 欧买歌    时间: 2015-8-23 21:22
你的脚本编辑器里有完全重复的脚本
作者: creeper0924    时间: 2015-8-24 05:30
欧买歌 发表于 2015-8-23 21:22
你的脚本编辑器里有完全重复的脚本

解决方法??
作者: 浩气青天    时间: 2015-8-24 06:34
creeper0924 发表于 2015-8-24 05:30
解决方法??

试试把两个完全重复的脚本删除其中之一?
作者: 笑傲乾坤    时间: 2015-8-28 17:48
提示: 作者被禁止或删除 内容自动屏蔽
作者: VIPArcher    时间: 2015-8-29 14:34
来试试大号的:https://rpg.blue/thread-378119-1-1.html
作者: Shandaini    时间: 2021-4-26 16:46
  1. #==============================================================================
  2. # ■ Window_MapName
  3. #==============================================================================

  4. class Window_MapName < Window_Base
  5. #--------------------------------------------------------------------------
  6. # ● 初始化
  7. #--------------------------------------------------------------------------
  8. def initialize
  9.    @map_id = $game_map.map_id
  10.    super(0, 0, 182, 52)
  11.    self.contents.font.size = 20
  12.    self.z = 151
  13.    refresh
  14. end
  15. #--------------------------------------------------------------------------
  16. # ● 刷新
  17. #--------------------------------------------------------------------------
  18. def refresh
  19.    self.opacity = 255
  20.    self.contents_opacity = 255
  21.    name = $data_mapinfos[@map_id].name
  22.    width = self.contents.text_size(name).width
  23.    height = self.contents.text_size(name).height
  24.    self.width = width + 32
  25.    self.height = height + 32
  26.    self.contents = Bitmap.new(width, height)
  27.    self.contents.font.size = 20
  28.    self.x = 0
  29.    self.y = 0
  30.    self.contents.font.color = system_color
  31.    self.contents.draw_text(0, 0, width, 20, name, 1)
  32. end
  33. #--------------------------------------------------------------------------
  34. # ● 更新
  35. #--------------------------------------------------------------------------
  36. def update
  37.    if $game_map.map_id != @map_id
  38.      @map_id = $game_map.map_id
  39.      refresh
  40.      self.opacity -= 5
  41.      self.contents_opacity = 255
  42.    end
  43.    refresh if $game_map.map_id == 388
  44.    return if self.opacity == 0
  45.    self.opacity = 255                       #原来是-=5
  46.    self.contents_opacity = 255              #原来是-=5
  47. end

  48. end

  49. class Scene_Title < Scene_Base
  50. #--------------------------------------------------------------------------
  51. # ● 数据库载入
  52. #--------------------------------------------------------------------------
  53. alias old_ld load_database
  54. def load_database
  55.    old_ld
  56.    $data_mapinfos       = load_data("Data/MapInfos.rvdata")
  57. end
  58. end

  59. class Scene_Map < Scene_Base
  60. #--------------------------------------------------------------------------
  61. # ● 开始
  62. #--------------------------------------------------------------------------
  63. alias old_start start
  64. def start
  65.    old_start
  66.    @mapname_window = Window_MapName.new
  67. end
  68. #--------------------------------------------------------------------------
  69. # ● 结束
  70. #--------------------------------------------------------------------------
  71. alias old_ter terminate
  72. def terminate
  73.    old_ter
  74.    @mapname_window.dispose
  75. end
  76. #--------------------------------------------------------------------------
  77. # ● 更新
  78. #--------------------------------------------------------------------------
  79. alias old_update update
  80. def update
  81.    old_update
  82.    @mapname_window.update
  83. end
  84. end
复制代码

你可以用我这个




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1