查看: 2124|回复: 8

[已经解决] 请问有没有能给选项添加说明文字的脚本呢

[复制链接]
梦石
0
星屑
871
在线时间
78 小时
注册时间
2022-3-19
回帖
40
发表于 2022-5-25 21:37:54 | 显示全部楼层 |阅读模式

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

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

×
有时候需要对每个选项进行一些说明,把所有选项的说明文都放在文本框的话可能会装不下,求一个脚本能够使光标停在不同选项的时候显示出不同的说明文字
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2022-5-25 22:26:01 | 显示全部楼层
https://rpg.blue/thread-479686-1-1.html
或者
[pre lang="ruby"]#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#             Help Window for Choices
#             Version: 2.0
#             Authors: DiamondandPlatinum3
#             Date: December 4, 2012  (Original)
#                   December 14, 2013 (Updated)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Description:
#
#    This script adds on to the default choice system, allowing you to have a
#    help window at the top of the screen to assist players in the choices they
#    have to make
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#------------------------------------------------------------------------------
#  Instructions:
#  
#   {Note to previous users of this script: This script has updated the way you
#    Insert data. Fear not, for the old way to insert data is still available;
#    so you will not have to redo anything, however read up on the new way to
#    insert data}
#   
#
#
#   ~ To use this script, just before using a choice event, use the following
#     script call to begin adding text to the help window:
#             add_command_list_help_text
#
#     Now using Show Text Windows, insert the text to be displayed.
#     Once the desired information is inserted, close the link with
#     the following script call:
#             end_command_list_help_text
#
#     Continue using that same pattern until all of your choices have
#     descriptions.
#
#   
#   ~ The Position of the Help Window depends on what position you gave the
#     Show Text window.
#
#
#     # Example Screen Can Be Found Here:
#           http://i.imgur.com/XAkhNEf.png
#
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#                  THERE IS NO EDITABLE REGION TO THIS SCRIPT
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=





#==============================================================================
# ** Game_Message
#------------------------------------------------------------------------------
#  This class handles the state of the message window that displays text or
# selections, etc. The instance of this class is referenced by $game_message.
#==============================================================================

class Game_Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # *= Alias Listings
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias_method(:dp3_gamemessage_initialize_235ufnh,               :initialize)
  alias_method(:dp3_gamemessage_clear_235ufnh,                    :clear     )
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_accessor :choice_help_text              # Help Text for choices (Hash)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize()
    dp3_gamemessage_initialize_235ufnh() # Call Original Method
    @choice_help_text = Hash.new()
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Clear
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear()
    dp3_gamemessage_clear_235ufnh() # Call Original Method
    @choice_help_text = Hash.new()
  end
end
  
  
  
  
  
  
  
  
#==============================================================================
# ** DP3_Choice_Window_Help
#------------------------------------------------------------------------------
#  This window displays help text for the choices inside of a choice window
#==============================================================================

class DP3_Choice_Window_Help < Window_Help
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Method: Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(text, position)
    super( [text.split("\n").size, 2].max )
    self.y = 0
    self.openness = 0
    set_text(text)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Method: Immediately Open
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def immediately_open()
    self.openness = 255
  end
end








#==============================================================================
# ** Window_ChoiceList
#------------------------------------------------------------------------------
#  This window is used for the event command [Show Choices].
#==============================================================================

class Window_ChoiceList < Window_Command
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # *= Alias Listings
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias_method(:dp3_windowchoicelist_update_235ufnh,            :update     )
  alias_method(:dp3_windowchoicelist_select_235ufnh,            :select     )
  alias_method(:dp3_windowchoicelist_cursordown_235ufnh,        :cursor_down)
  alias_method(:dp3_windowchoicelist_cursorup_235ufnh,          :cursor_up  )
  alias_method(:dp3_windowchoicelist_open_235ufnh,              :open       )
  alias_method(:dp3_windowchoicelist_close_235ufnh,             :close      )
  alias_method(:dp3_windowchoicelist_dispose_235ufnh,           :dispose    )
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Update
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update(*args)
    dp3_windowchoicelist_update_235ufnh(*args)
    @choicehelp_helpwindow.update() unless @choicehelp_helpwindow.nil?
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Select Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def select(*args)
    dp3_windowchoicelist_select_235ufnh(*args)
    dp3_dispose_choicehelp_window()
    unless dp3_get_current_choice_windowinfo[0].nil?
      @choicehelp_helpwindow = DP3_Choice_Window_Help.new(*dp3_get_current_choice_windowinfo)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Move Cursor Down
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def cursor_down(*args)
    dp3_windowchoicelist_cursordown_235ufnh(*args)
    @choicehelp_helpwindow.immediately_open() unless @choicehelp_helpwindow.nil?
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Move Cursor Up
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def cursor_up(*args)
    dp3_windowchoicelist_cursorup_235ufnh(*args)
    @choicehelp_helpwindow.immediately_open() unless @choicehelp_helpwindow.nil?
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Open
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def open(*args)
    dp3_windowchoicelist_open_235ufnh(*args) # Call Original Method
    @choicehelp_helpwindow.open() unless @choicehelp_helpwindow.nil?
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Close
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def close(*args)
    @choicehelp_helpwindow.close() unless @choicehelp_helpwindow.nil?
    dp3_windowchoicelist_close_235ufnh(*args) # Call Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Aliased Method: Dispose
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def dispose(*args)
    dp3_windowchoicelist_dispose_235ufnh(*args) # Call Original Method
    dp3_dispose_choicehelp_window()
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Method: Dispose ChoiceHelp Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def dp3_dispose_choicehelp_window()
    @choicehelp_helpwindow.dispose unless @choicehelp_helpwindow.nil? || @choicehelp_helpwindow.disposed?
    @choicehelp_helpwindow = nil
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Method: Get Required Info for the Window Choice
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def dp3_get_current_choice_windowinfo()
    return [nil] if $game_message.choice_help_text[self.index].nil?
    return [$game_message.choice_help_text[self.index][:text],
            $game_message.choice_help_text[self.index][:position] ]
  end
end








#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Method: Add Command List Help Text
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def add_command_list_help_text( text = nil )
    position = 0
   
    # Add Text Argument
    unless text.nil?
      text = text.gsub(/[\n\r]+/, "")
      text = text.gsub(/\\endl/, "\n")
      
    # Add Show Text Command Text Paramters
    else
      text = ""
      while( !@list[@index].nil? )
        @index += 1
        case @list[@index].code
        when 101 # Show Text Window Command
          position = @list[@index].parameters[3]
        when 401 # Show Text Line
          text += @list[@index].parameters[0] + "\n"
        when 355 # Script Command
          script = @list[@index].parameters[0] + "\n"
          while next_event_code == 655
            @index += 1
            script += @list[@index].parameters[0] + "\n"
          end
          break if script.include?("end_command_list_help_text")
        end
      end
    end
   
    # Add to List
    index = $game_message.choice_help_text.size
    $game_message.choice_help_text[index]             = Hash.new()
    $game_message.choice_help_text[index][:position]  = position
    $game_message.choice_help_text[index][:text]      = text
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Method: End Command List Help Text
  #--------------------------------------------------------------------------
  # Method only exists in case the user actually tries to call it outside of
  # bounds.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def end_command_list_help_text()
  end
end[/pre]

评分

参与人数 1星屑 +100 收起 理由
VIPArcher + 100 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
871
在线时间
78 小时
注册时间
2022-3-19
回帖
40
 楼主| 发表于 2022-5-26 13:06:03 | 显示全部楼层
alexncf125 发表于 2022-5-25 22:26
https://rpg.blue/thread-479686-1-1.html
或者
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ...


捕获.PNG


捕获1.PNG

回复

使用道具 举报

梦石
0
星屑
871
在线时间
78 小时
注册时间
2022-3-19
回帖
40
 楼主| 发表于 2022-5-26 13:24:50 | 显示全部楼层
在新建的项目里倒是测试成功了,但是也没有像脚本里说的  “帮助”窗口的位置会取决于“显示文本”窗口指定的位置,帮助窗口固定居上了

点评

那是因为105行被我改过了, 原版是对话框跟说明框会重叠, 所以我改成self.y = 0固定了在最上方  发表于 2022-5-26 13:50
回复

使用道具 举报

梦石
0
星屑
871
在线时间
78 小时
注册时间
2022-3-19
回帖
40
 楼主| 发表于 2022-5-26 14:20:38 | 显示全部楼层
开新游戏这个脚本就能用,要是读取旧存档就会报错,这个问题有办法解决吗

点评

新添脚本后一律是得开新游戏, 还用问的  发表于 2022-5-26 14:44
没有  发表于 2022-5-26 14:43
回复

使用道具 举报

梦石
0
星屑
871
在线时间
78 小时
注册时间
2022-3-19
回帖
40
 楼主| 发表于 2022-5-26 14:49:58 | 显示全部楼层
因为我之前弄的几个脚本都是中途加入,不影响存档的,就缺乏常识了……
多谢大佬!大佬辛苦了!
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部