查看: 2206|回复: 7

[已经解决] 事件中使用$game_temp.message_text,只显示后面的内容是怎么回事

[复制链接]
梦石
0
星屑
50
在线时间
0 小时
注册时间
2013-7-27
回帖
5
发表于 2013-7-27 13:58:58 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 会喵呜的熊 于 2013-7-27 16:17 编辑

脚本基本没改过,只在Window_Message里面改了对话窗口大小(12行以及173-178行)。另外改了Window_Help,去掉了显示技能和状态(?)的部分(这个应该无关?)。

在事件执行页里添加如下内容:
脚本:
$game_temp.message_text= "xxxxxxx"
脚本:
$game_temp.message_text= "yyyyyyy"
则只显示yyyyyyy。

如果添加:
脚本:
$game_temp.message_text= "xxxxxxx"
等待:20桢
脚本:
$game_temp.message_text= "yyyyyyy"
在xxxxxxx出现的20帧(两秒?)之内按回车,会正常出现yyyyyyy。但是如果过了时间,第二个对话框就不会出现了。

有什么办法可以让用脚本输入的文字像普通输入的文字一样显示(回车以后显示下面的文字)吗?谢谢。
梦石
0
星屑
3905
在线时间
1972 小时
注册时间
2013-1-3
回帖
9146
发表于 2013-7-27 14:32:29 | 显示全部楼层
最简单的方式就是添加独立开关了
1.png
2.png
范例在下面
Project2.zip (200.75 KB, 下载次数: 29)
《宿愿·寻剑篇》正式版已经发布!快去看看!点击进入论坛发布贴
回复

使用道具 举报

梦石
0
星屑
50
在线时间
0 小时
注册时间
2013-7-27
回帖
5
 楼主| 发表于 2013-7-27 14:44:54 | 显示全部楼层
紫英晓狼1130 发表于 2013-7-27 14:32
最简单的方式就是添加独立开关了

谢谢!由于需要输入的文字量比较大,每个都用独立开关操作可能不太实际。于是这等于是说无法用$game_temp.message_text达到和输入文章指令一样的效果吗?

点评

谢谢,还有什么办法推荐吗?  发表于 2013-7-27 15:10
其实没必要一定用这种方法  发表于 2013-7-27 14:50
回复

使用道具 举报

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
回帖
3515
发表于 2013-7-27 14:47:01 | 显示全部楼层
脚本1
循环
—条件分歧:按下C
——中断循环
—分歧结束
中断循环
脚本2

点评

谢谢!去试试这个!看来这是最简便的方式了?如果有长段文字还是下个加强脚本比较好吗?  发表于 2013-7-27 15:12

评分

参与人数 1星屑 +66 收起 理由
明特·布兰马修 + 66 认可答案

查看全部评分


http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
回帖
10960

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

发表于 2013-7-27 15:12:03 | 显示全部楼层
本帖最后由 美丽晨露 于 2013-7-27 15:14 编辑

楼主可以使用长文本脚本解决输入文章过长的问题。

[pre lang="ruby" line="1"]class Window_Message < Window_Selectable
def reset_window_stars(line_max)
   if $game_temp.in_battle
     self.y = 16
   else
     case $game_system.message_position
     when 0  # 上
       self.y = 16
     when 1  # 中
       self.y = 160
     when 2  # 下
       self.y = 304
     end
     self.height = 32 * (line_max + 1)
     self.contents = Bitmap.new(self.width - 32, self.height - 32)
   end
   if $game_system.message_frame == 0
     self.opacity = 255
   else
     self.opacity = 0
   end
   self.back_opacity = 160
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update(line_max = 4)
   super()
   # 渐变的情况下
   if @fade_in
     self.contents_opacity += 24
     if @input_number_window != nil
       @input_number_window.contents_opacity += 24
     end
     if self.contents_opacity == 255
       @fade_in = false
     end
     return
   end
   # 输入数值的情况下
   if @input_number_window != nil
     @input_number_window.update
     # 确定
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       $game_variables[$game_temp.num_input_variable_id] =
         @input_number_window.number
       $game_map.need_refresh = true
       # 释放输入数值窗口
       @input_number_window.dispose
       @input_number_window = nil
       terminate_message
     end
     return
   end
   # 显示信息中的情况下
   if @contents_showing
     # 如果不是在显示选择项中就显示暂停标志
     if $game_temp.choice_max == 0
       self.pause = true
     end
     # 取消
     if Input.trigger?(Input::B)
       if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
         $game_system.se_play($data_system.cancel_se)
         $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
         terminate_message
       end
     end
     # 确定
     if Input.trigger?(Input::C)
       if $game_temp.choice_max > 0
         $game_system.se_play($data_system.decision_se)
         $game_temp.choice_proc.call(self.index)
       end
       terminate_message
     end
     return
   end
   # 在渐变以外的状态下有等待显示的信息与选择项的场合
   if @fade_out == false and $game_temp.message_text != nil
     @contents_showing = true
     $game_temp.message_window_showing = true
     reset_window_stars(line_max)
     refresh
     Graphics.frame_reset
     self.visible = true
     self.contents_opacity = 0
     if @input_number_window != nil
       @input_number_window.contents_opacity = 0
     end
     @fade_in = true
     return
   end
   # 没有可以显示的信息、但是窗口为可见的情况下
   if self.visible
     @fade_out = true
     self.opacity -= 48
     if self.opacity == 0
       self.visible = false
       @fade_out = false
       $game_temp.message_window_showing = false
     end
     return
   end
end
end  
class Interpreter
attr_reader :line_max
alias sailcat_clear clear
def clear
  sailcat_clear
  @line_max = 4  # 信息最大行数
end
#--------------------------------------------------------------------------
# ● 显示文章
#--------------------------------------------------------------------------
def command_101
  # 另外的文章已经设置过 message_text 的情况下
  if $game_temp.message_text != nil
    # 结束
    return false
  end
  # 设置信息结束后待机和返回调用标志
  @message_waiting = true
  $game_temp.message_proc = Proc.new { @message_waiting = false }
  # message_text 设置为第 1 行
  $game_temp.message_text = @list[@index].parameters[0] + "\n"
  line_count = 1      
  # 循环
  loop do
    # 下一个事件指令为文章两行以上的情况
    if @list[@index+1].code == 401
      # message_text 添加到第 2 行以下
      $game_temp.message_text += @list[@index+1].parameters[0] + "\n"
      line_count += 1
    # 下一个事件指令为显示文章并且是长文的情况
    elsif @line_max != 4 and @list[@index+1].code == 101
      # 如果文章长度足够
      if line_count < @line_max
        # message_text 添加到现有文章以后
        $game_temp.message_text += @list[@index+1].parameters[0] + "\n"
        line_count += 1
      # 文章长度不够的情况下
      else
        # 继续
        return true
      end
    # 事件指令不在文章两行以下的情况
    else
      # 下一个事件指令为显示选择项的情况下
      if @list[@index+1].code == 102
        # 如果选择项能收纳在画面里
        if @list[@index+1].parameters[0].size <= @line_max - line_count
          # 推进索引
          @Index += 1
          # 设置选择项
          $game_temp.choice_start = line_count
          setup_choices(@list[@index].parameters)
        end
      # 下一个事件指令为处理输入数值的情况下
      elsif @list[@index+1].code == 103
        # 如果数值输入窗口能收纳在画面里
        if line_count < @line_max
          # 推进索引
          @index += 1
          # 设置输入数值
          $game_temp.num_input_start = line_count
          $game_temp.num_input_variable_id = @list[@index].parameters[0]
          $game_temp.num_input_digits_max = @list[@index].parameters[1]
        end
      end
      # 继续
      return true
    end
    # 推进索引
    @index += 1
  end
end
#--------------------------------------------------------------------------
# ● 注释
#--------------------------------------------------------------------------
def command_108
  # 注释关键字解释
  case @parameters[0]
  # 长文开始标记
  when "LN_start"
    if $game_temp.in_battle
      @line_max = 4
    else
      case $game_system.message_position
      when 0
        @line_max = 12
      when 1
        @line_max = 8
      when 2
        @line_max = 4
      end
    end
  # 长文结束标记
  when "LN_end"
    @line_max = 4
  end
  # 继续
  return true
end
end

class Scene_Map
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
   # 循环
   loop do
     # 按照地图、实例、主角的顺序刷新
     # (本更新顺序不会在的满足事件的执行条件下成为给予角色瞬间移动
     #  的机会的重要因素)
     $game_map.update
     $game_system.map_interpreter.update
     $game_player.update
     # 系统 (计时器)、画面刷新
     $game_system.update
     $game_screen.update
     # 如果主角在场所移动中就中断循环
     unless $game_temp.player_transferring
       break
     end
     # 执行场所移动
     transfer_player
     # 处理过渡中的情况下、中断循环
     if $game_temp.transition_processing
       break
     end
   end
   # 刷新活动块
   @spriteset.update
   # 刷新信息窗口
   @message_window.update($game_system.map_interpreter.line_max)
   # 游戏结束的情况下
   if $game_temp.gameover
     # 切换的游戏结束画面
     $scene = Scene_Gameover.new
     return
   end
   # 返回标题画面的情况下
   if $game_temp.to_title
     # 切换到标题画面
     $scene = Scene_Title.new
     return
   end
   # 处理过渡中的情况下
   if $game_temp.transition_processing
     # 清除过渡处理中标志
     $game_temp.transition_processing = false
     # 执行过渡
     if $game_temp.transition_name == ""
       Graphics.transition(20)
     else
       Graphics.transition(40, "Graphics/Transitions/" +
         $game_temp.transition_name)
     end
   end
   # 显示信息窗口中的情况下
   if $game_temp.message_window_showing
     return
   end
   # 遇敌计数为 0 且、且遇敌列表不为空的情况下
   if $game_player.encounter_count == 0 and $game_map.encounter_list != []
     # 不是在事件执行中或者禁止遇敌中
     unless $game_system.map_interpreter.running? or
            $game_system.encounter_disabled
       # 确定队伍
       n = rand($game_map.encounter_list.size)
       troop_id = $game_map.encounter_list[n]
       # 队伍有效的话
       if $data_troops[troop_id] != nil
         # 设置调用战斗标志
         $game_temp.battle_calling = true
         $game_temp.battle_troop_id = troop_id
         $game_temp.battle_can_escape = true
         $game_temp.battle_can_lose = false
         $game_temp.battle_proc = nil
       end
     end
   end
   # 按下 B 键的情况下
   if Input.trigger?(Input::B)
     # 不是在事件执行中或菜单禁止中
     unless $game_system.map_interpreter.running? or
            $game_system.menu_disabled
       # 设置菜单调用标志以及 SE 演奏
       $game_temp.menu_calling = true
       $game_temp.menu_beep = true
     end
   end
   # 调试模式为 ON 并且按下 F9 键的情况下
   if $DEBUG and Input.press?(Input::F9)
     # 设置调用调试标志
     $game_temp.debug_calling = true
   end
   # 不在主角移动中的情况下
   unless $game_player.moving?
     # 执行各种画面的调用
     if $game_temp.battle_calling
       call_battle
     elsif $game_temp.shop_calling
       call_shop
     elsif $game_temp.name_calling
       call_name
     elsif $game_temp.menu_calling
       call_menu
     elsif $game_temp.save_calling
       call_save
     elsif $game_temp.debug_calling
       call_debug
     end
   end
end
end
[/pre]

评分

参与人数 1星屑 +150 收起 理由
明特·布兰马修 + 150 认可答案

查看全部评分

大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复

使用道具 举报

梦石
0
星屑
50
在线时间
0 小时
注册时间
2013-7-27
回帖
5
 楼主| 发表于 2013-7-27 15:31:34 | 显示全部楼层
美丽晨露 发表于 2013-7-27 15:12
楼主可以使用长文本脚本解决输入文章过长的问题。

class Window_Message < Window_Selectable

对不起我很笨,在Main之前插入这个脚本后,显示156行Syntax Error,#掉156行以后显示110行Name Error。是不是除了插入这个脚本还需要做别的修改?谢谢。
回复

使用道具 举报

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
回帖
10960

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

发表于 2013-7-27 15:44:18 | 显示全部楼层
url=home.php?mod=space&uid=370741@Index[/url] += 1
改为
@Index += 1
论坛代码插入有BUG得说
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复

使用道具 举报

梦石
0
星屑
50
在线时间
0 小时
注册时间
2013-7-27
回帖
5
 楼主| 发表于 2013-7-27 16:16:44 | 显示全部楼层
美丽晨露 发表于 2013-7-27 15:44
url=home.php?mod=space&uid=370741@Index[/url] += 1
改为
@Index += 1

大感谢!话说认同答案在哪里……
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部