设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索

请问有没有能给选项添加说明文字的脚本呢

查看数: 1632 | 评论数: 5 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2022-5-25 21:37

正文摘要:

有时候需要对每个选项进行一些说明,把所有选项的说明文都放在文本框的话可能会装不下,求一个脚本能够使光标停在不同选项的时候显示出不同的说明文字 ...

回复

tuifeiheihu 发表于 2022-5-26 14:49:58
因为我之前弄的几个脚本都是中途加入,不影响存档的,就缺乏常识了……
多谢大佬!大佬辛苦了!
tuifeiheihu 发表于 2022-5-26 14:20:38
开新游戏这个脚本就能用,要是读取旧存档就会报错,这个问题有办法解决吗

点评

新添脚本后一律是得开新游戏, 还用问的  发表于 2022-5-26 14:44
没有  发表于 2022-5-26 14:43
tuifeiheihu 发表于 2022-5-26 13:24:50
在新建的项目里倒是测试成功了,但是也没有像脚本里说的  “帮助”窗口的位置会取决于“显示文本”窗口指定的位置,帮助窗口固定居上了

点评

那是因为105行被我改过了, 原版是对话框跟说明框会重叠, 所以我改成self.y = 0固定了在最上方  发表于 2022-5-26 13:50
alexncf125 发表于 2022-5-25 22:26:01
https://rpg.blue/thread-479686-1-1.html
或者
RUBY 代码复制
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Help Window for Choices
  3. #             Version: 2.0
  4. #             Authors: DiamondandPlatinum3
  5. #             Date: December 4, 2012  (Original)
  6. #                   December 14, 2013 (Updated)
  7. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8. #  Description:
  9. #
  10. #    This script adds on to the default choice system, allowing you to have a
  11. #    help window at the top of the screen to assist players in the choices they
  12. #    have to make
  13. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  14. #------------------------------------------------------------------------------
  15. #  Instructions:
  16. #  
  17. #   {Note to previous users of this script: This script has updated the way you
  18. #    Insert data. Fear not, for the old way to insert data is still available;
  19. #    so you will not have to redo anything, however read up on the new way to
  20. #    insert data}
  21. #   
  22. #
  23. #
  24. #   ~ To use this script, just before using a choice event, use the following
  25. #     script call to begin adding text to the help window:
  26. #             add_command_list_help_text
  27. #
  28. #     Now using Show Text Windows, insert the text to be displayed.
  29. #     Once the desired information is inserted, close the link with
  30. #     the following script call:
  31. #             end_command_list_help_text
  32. #
  33. #     Continue using that same pattern until all of your choices have
  34. #     descriptions.
  35. #
  36. #   
  37. #   ~ The Position of the Help Window depends on what position you gave the
  38. #     Show Text window.
  39. #
  40. #
  41. #     # Example Screen Can Be Found Here:
  42. #           [url]http://i.imgur.com/XAkhNEf.png[/url]
  43. #
  44. #
  45. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  46. #                  THERE IS NO EDITABLE REGION TO THIS SCRIPT
  47. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  48.  
  49.  
  50.  
  51.  
  52.  
  53. #==============================================================================
  54. # ** Game_Message
  55. #------------------------------------------------------------------------------
  56. #  This class handles the state of the message window that displays text or
  57. # selections, etc. The instance of this class is referenced by $game_message.
  58. #==============================================================================
  59.  
  60. class Game_Message
  61.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  62.   # *= Alias Listings
  63.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64.   alias_method(:dp3_gamemessage_initialize_235ufnh,               :initialize)
  65.   alias_method(:dp3_gamemessage_clear_235ufnh,                    :clear     )
  66.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  67.   # * New Public Instance Variables
  68.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  69.   attr_accessor :choice_help_text              # Help Text for choices (Hash)
  70.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  71.   # * Aliased Method: Object Initialization
  72.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  73.   def initialize()
  74.     dp3_gamemessage_initialize_235ufnh() # Call Original Method
  75.     @choice_help_text = Hash.new()
  76.   end
  77.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  78.   # * Aliased Method: Clear
  79.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  80.   def clear()
  81.     dp3_gamemessage_clear_235ufnh() # Call Original Method
  82.     @choice_help_text = Hash.new()
  83.   end
  84. end
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. #==============================================================================
  94. # ** DP3_Choice_Window_Help
  95. #------------------------------------------------------------------------------
  96. #  This window displays help text for the choices inside of a choice window
  97. #==============================================================================
  98.  
  99. class DP3_Choice_Window_Help < Window_Help
  100.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101.   # * New Method: Object Initialization
  102.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103.   def initialize(text, position)
  104.     super( [text.split("\n").size, 2].max )
  105.     self.y = 0
  106.     self.openness = 0
  107.     set_text(text)
  108.   end
  109.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  110.   # * New Method: Immediately Open
  111.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  112.   def immediately_open()
  113.     self.openness = 255
  114.   end
  115. end
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124. #==============================================================================
  125. # ** Window_ChoiceList
  126. #------------------------------------------------------------------------------
  127. #  This window is used for the event command [Show Choices].
  128. #==============================================================================
  129.  
  130. class Window_ChoiceList < Window_Command
  131.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  132.   # *= Alias Listings
  133.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  134.   alias_method(:dp3_windowchoicelist_update_235ufnh,            :update     )
  135.   alias_method(:dp3_windowchoicelist_select_235ufnh,            :select     )
  136.   alias_method(:dp3_windowchoicelist_cursordown_235ufnh,        :cursor_down)
  137.   alias_method(:dp3_windowchoicelist_cursorup_235ufnh,          :cursor_up  )
  138.   alias_method(:dp3_windowchoicelist_open_235ufnh,              :open       )
  139.   alias_method(:dp3_windowchoicelist_close_235ufnh,             :close      )
  140.   alias_method(:dp3_windowchoicelist_dispose_235ufnh,           :dispose    )
  141.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  142.   # * Aliased Method: Update
  143.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  144.   def update(*args)
  145.     dp3_windowchoicelist_update_235ufnh(*args)
  146.     @choicehelp_helpwindow.update() unless @choicehelp_helpwindow.nil?
  147.   end
  148.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  149.   # * Aliased Method: Select Item
  150.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  151.   def select(*args)
  152.     dp3_windowchoicelist_select_235ufnh(*args)
  153.     dp3_dispose_choicehelp_window()
  154.     unless dp3_get_current_choice_windowinfo[0].nil?
  155.       @choicehelp_helpwindow = DP3_Choice_Window_Help.new(*dp3_get_current_choice_windowinfo)
  156.     end
  157.   end
  158.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  159.   # * Aliased Method: Move Cursor Down
  160.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  161.   def cursor_down(*args)
  162.     dp3_windowchoicelist_cursordown_235ufnh(*args)
  163.     @choicehelp_helpwindow.immediately_open() unless @choicehelp_helpwindow.nil?
  164.   end
  165.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  166.   # * Aliased Method: Move Cursor Up
  167.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  168.   def cursor_up(*args)
  169.     dp3_windowchoicelist_cursorup_235ufnh(*args)
  170.     @choicehelp_helpwindow.immediately_open() unless @choicehelp_helpwindow.nil?
  171.   end
  172.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  173.   # * Aliased Method: Open
  174.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  175.   def open(*args)
  176.     dp3_windowchoicelist_open_235ufnh(*args) # Call Original Method
  177.     @choicehelp_helpwindow.open() unless @choicehelp_helpwindow.nil?
  178.   end
  179.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  180.   # * Aliased Method: Close
  181.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  182.   def close(*args)
  183.     @choicehelp_helpwindow.close() unless @choicehelp_helpwindow.nil?
  184.     dp3_windowchoicelist_close_235ufnh(*args) # Call Original Method
  185.   end
  186.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  187.   # * Aliased Method: Dispose
  188.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  189.   def dispose(*args)
  190.     dp3_windowchoicelist_dispose_235ufnh(*args) # Call Original Method
  191.     dp3_dispose_choicehelp_window()
  192.   end
  193.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  194.   # * New Method: Dispose ChoiceHelp Window
  195.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  196.   def dp3_dispose_choicehelp_window()
  197.     @choicehelp_helpwindow.dispose unless @choicehelp_helpwindow.nil? || @choicehelp_helpwindow.disposed?
  198.     @choicehelp_helpwindow = nil
  199.   end
  200.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  201.   # * New Method: Get Required Info for the Window Choice
  202.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  203.   def dp3_get_current_choice_windowinfo()
  204.     return [nil] if $game_message.choice_help_text[self.index].nil?
  205.     return [$game_message.choice_help_text[self.index][:text],
  206.             $game_message.choice_help_text[self.index][:position] ]
  207.   end
  208. end
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217. #==============================================================================
  218. # ** Game_Interpreter
  219. #------------------------------------------------------------------------------
  220. #  An interpreter for executing event commands. This class is used within the
  221. # Game_Map, Game_Troop, and Game_Event classes.
  222. #==============================================================================
  223.  
  224. class Game_Interpreter
  225.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226.   # * New Method: Add Command List Help Text
  227.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  228.   def add_command_list_help_text( text = nil )
  229.     position = 0
  230.  
  231.     # Add Text Argument
  232.     unless text.nil?
  233.       text = text.gsub(/[\n\r]+/, "")
  234.       text = text.gsub(/\\endl/, "\n")
  235.  
  236.     # Add Show Text Command Text Paramters
  237.     else
  238.       text = ""
  239.       while( !@list[@index].nil? )
  240.         @index += 1
  241.         case @list[@index].code
  242.         when 101 # Show Text Window Command
  243.           position = @list[@index].parameters[3]
  244.         when 401 # Show Text Line
  245.           text += @list[@index].parameters[0] + "\n"
  246.         when 355 # Script Command
  247.           script = @list[@index].parameters[0] + "\n"
  248.           while next_event_code == 655
  249.             @index += 1
  250.             script += @list[@index].parameters[0] + "\n"
  251.           end
  252.           break if script.include?("end_command_list_help_text")
  253.         end
  254.       end
  255.     end
  256.  
  257.     # Add to List
  258.     index = $game_message.choice_help_text.size
  259.     $game_message.choice_help_text[index]             = Hash.new()
  260.     $game_message.choice_help_text[index][:position]  = position
  261.     $game_message.choice_help_text[index][:text]      = text
  262.   end
  263.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  264.   # * New Method: End Command List Help Text
  265.   #--------------------------------------------------------------------------
  266.   # Method only exists in case the user actually tries to call it outside of
  267.   # bounds.
  268.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  269.   def end_command_list_help_text()
  270.   end
  271. end

评分

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

查看全部评分

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-27 19:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表