查看: 1454|回复: 1

[已经解决] 选项脚本与对话时打开菜单脚本冲突

[复制链接]
梦石
0
星屑
50
在线时间
65 小时
注册时间
2012-9-22
回帖
3
发表于 2013-11-9 21:06:48 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 chimerica 于 2013-11-11 20:06 编辑

自己用简单粗暴的方法解决了_(:з」∠)_

使用了http://rpg.blue/thread-338478-1-1.html中3L的脚本,另外使用了http://rpg.blue/forum.php?mod=viewthread&tid=336236中的脚本,用R键调出菜单。
调出菜单可以正常进行,用X关闭菜单时就会报错
QQ截图20131109210455.png
请问有什么方法能够使之兼容吗?
(为了以防万一贴一下选项的脚本)
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Visual Novel Choices
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.9
  6. #------------------------------------------------------------------------------#
  7. #  2013-01-16 - Version 1.9 - Added Y offset for choice window
  8. #  2012-11-28 - Version 1.8 - Z level setting added
  9. #  2012-11-28 - Version 1.7 - Added compatability for some cursor scripts
  10. #  2012-11-28 - Version 1.6 - Fixed a bug that could crash the game.
  11. #  2012-11-28 - Version 1.5 - Added offset to change postion of cursor x and y
  12. #  2012-11-28 - Version 1.4 - Fixed z levels and made cursor use an image
  13. #  2012-11-27 - Version 1.3 - Fixed a bug with cancel choice selection
  14. #  2012-11-27 - Version 1.2 - added a switch to disable script effects
  15. #  2012-11-27 - Version 1.1 - added ability to use different image per choice
  16. #                           - added a couple more options
  17. #  2012-11-27 - Version 1.0 - release
  18. #------------------------------------------------------------------------------#
  19. #  This script overwrites the default "Show Choices" list. The choices are
  20. #  changed so they display centered on the screen with a graphic behind each
  21. #  of them. Made with visual novel choice selection in mind.
  22. #------------------------------------------------------------------------------#
  23. #  INSTRUCTIONS:
  24. #  Copy the graphic from the demo /Graphics/System into your project.
  25. #  Copy the script into your script list, below Materials and above Main
  26. #
  27. #  Some setup options below, most only need to be changed if you use your own
  28. #  custom choice image.
  29. #------------------------------------------------------------------------------#
  30. #  Codes:
  31. #------------------------------------------------------------------------------#
  32. #  Most of the usual codes that work in messages should work in choices.
  33. #  (eg. \V[x], \N[x], \C[x], etc. Look at message tooltip to know more.)
  34. #
  35. #  A new one has been added so you can change the background image for separate
  36. #  choice options.
  37. #
  38. #  \B[x]
  39. #
  40. #  This works by adding the number x (as you put in the code above) to the end
  41. #  of the CHOICE IMAGE file name. For example, the default choice image is:
  42. #  "Choice.png" located in /Graphics/System/. If you put the code anywhere in
  43. #  a choice box:  \B[3]  it will look for "Choice3.png" image in the same
  44. #  location.
  45. #------------------------------------------------------------------------------#

  46. ($imported ||= {})["Galvs_Image_Choices"] = true
  47. module Galv_Choice

  48. #------------------------------------------------------------------------------#
  49. #  SCRIPT SETUP OPTIONS
  50. #------------------------------------------------------------------------------#
  51.    
  52.   CURSOR_IMAGE = "Cursor"  # Images used to determine which option you select
  53.   CURSOR_OPACITY = 255      # Opacity of the cursor
  54.   CURSOR_Y_OFFSET = 0       # Nudge cursor position vertically
  55.   CURSOR_X_OFFSET = 0       # Nudge cursor position horizontally

  56.   CHOICE_IMAGE = "Choice"   # Image for each choice located in /Graphics/System
  57.   IMAGE_Y_OFFSET = 3        # Nudge your choice image vertically if needed
  58.   IMAGE_OPACITY = 215       # The opacity of the image

  59.   CHOICE_HEIGHT = 45        # How tall each choice.
  60.   CHOICE_ITEM_Y = 2         # Offset for choice item text
  61.    
  62.   CENTER_TEXT = true        # left aligned if false, centered if true
  63.                              
  64.   DISABLE_SWITCH = 1        # Turn this switch ON to disable this script
  65.    
  66.   CHOICES_Y = 0             # Y offset to move choice window up or down.
  67.                             # useful if you use a script that creates a namebox
  68.   CHOICES_Z = 50            # The z value of the choices window. Try changing it
  69.                             # if pictures or other scripts appear over or under
  70.                             # the choices window to how you like.
  71.    
  72. #------------------------------------------------------------------------------#
  73.   OTHER_Y_OFFSET = 12       # May fix other cursor scripts positioning
  74. #------------------------------------------------------------------------------#
  75. #  SCRIPT SETUP OPTIONS
  76. #------------------------------------------------------------------------------#

  77. end

  78. class Window_ChoiceList < Window_Command

  79.   alias galv_choice_initialize initialize
  80.   def initialize(message_window)
  81.     galv_choice_initialize(message_window)
  82.     self.z = Galv_Choice::CHOICES_Z
  83.   end
  84.    
  85.   def start
  86.     [url=home.php?mod=space&uid=370741]@Index[/url] = 0
  87.     setup_choices
  88.     make_cursor
  89.     refresh
  90.     open
  91.     activate
  92.     update_placement
  93.     update_bgs
  94.     refresh
  95.     select(0)
  96.   end
  97.    
  98.   def make_cursor
  99.     return if $game_switches[Galv_Choice::DISABLE_SWITCH]
  100.     @cursor_sprite = Sprite.new
  101.     @cursor_sprite.bitmap = Cache.system(Galv_Choice::CURSOR_IMAGE)
  102.   end
  103.    
  104.   def setup_choices
  105.     @choice_sprite = []
  106.     if !$game_switches[Galv_Choice::DISABLE_SWITCH]
  107.       self.opacity = 0
  108.       get_widths
  109.     else
  110.       self.opacity = 255
  111.     end
  112.   end
  113.    
  114.   alias galv_choice_update_placement update_placement
  115.   def update_placement
  116.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  117.       galv_choice_update_placement
  118.     else
  119.       self.width = [max_choice_width + 12, 96].max + padding * 4
  120.       self.width = [width, Graphics.width].min
  121.       self.height = contents_height + Galv_Choice::CHOICE_HEIGHT - 10
  122.       self.x = (Graphics.width - width) / 2
  123.       
  124.       if @message_window.openness < 100
  125.         self.y = Graphics.height - contents_height + item_height / 2
  126.       elsif @message_window.y >= Graphics.height / 2
  127.         self.y = @message_window.y - contents_height + item_height / 2 - Galv_Choice::CHOICES_Y
  128.       else
  129.         self.y = @message_window.y + @message_window.height + item_height / 2 + Galv_Choice::CHOICES_Y
  130.       end
  131.     end
  132.   end

  133.   alias galv_choice_contents_height contents_height
  134.   def contents_height
  135.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  136.       galv_choice_contents_height
  137.     else
  138.       (item_max + 1) * item_height
  139.     end
  140.   end
  141.    
  142.   def draw_item(index)
  143.     rect = item_rect_for_text(index)
  144.     draw_text_ex(rect.x, rect.y, command_name(index))
  145.     if !$game_switches[Galv_Choice::DISABLE_SWITCH]
  146.       draw_bgs(index)
  147.     end
  148.   end
  149.    
  150.   def item_rect_for_text(index)
  151.     rect = item_rect(index)
  152.      
  153.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  154.       rect.x += 4
  155.       rect.width -= 8
  156.       rect
  157.     else
  158.       if Galv_Choice::CENTER_TEXT
  159.         rect.x = (max_choice_width - @text_sizes.collect {|s| text_size(s).width }[index] + (padding * 3)) / 2
  160.       else
  161.         rect.x += 4
  162.       end
  163.       rect.width -= 8
  164.       rect.y += Galv_Choice::CHOICE_ITEM_Y
  165.       rect
  166.     end
  167.   end
  168.    
  169.   def get_widths
  170.     @text_sizes = []
  171.     @choice_background = []
  172.     $game_message.choices.each_with_index do |c,i|
  173.       @text_sizes[i] = esc_characters(c,i)
  174.     end
  175.   end
  176.    
  177.   def esc_characters(text,index)
  178.     result = text.to_s.clone
  179.     result.gsub!(/\\/)            { "\e" }
  180.     result.gsub!(/\e\e/)          { "\" }
  181.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  182.     result.gsub!(/\eN\[(\d+)\]/i) { $game_actors[$1.to_i].name}
  183.     result.gsub!(/\eP\[(\d+)\]/i) {
  184.       if $game_party.members[$1.to_i].nil?
  185.         ""
  186.       else
  187.         $game_party.members[$1.to_i].name
  188.       end
  189.     }
  190.     result.gsub!(/\eG/i)          { Vocab::currency_unit }
  191.     result.gsub!(/\eC\[(\d+)\]/i)  { "" }
  192.     result.gsub!(/\eI\[(\d+)\]/i)  { "   " }
  193.     result.gsub!(/\eB\[(\d+)\]/i)  { @choice_background[index] = $1.to_i }
  194.     result.gsub!(/\eB\[(\d+)\]/i)  { "" }
  195.     result
  196.   end
  197.    
  198.   def convert_escape_characters(text)
  199.     result = text.to_s.clone
  200.     result.gsub!(/\\/)            { "\e" }
  201.     result.gsub!(/\e\e/)          { "\" }
  202.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  203.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  204.     result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
  205.     result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
  206.     result.gsub!(/\eG/i)          { Vocab::currency_unit }
  207.     result.gsub!(/\eB\[(\d+)\]/i)  { "" }
  208.     result
  209.   end
  210.    
  211.   def item_height
  212.     return line_height if $game_switches[Galv_Choice::DISABLE_SWITCH]
  213.     return Galv_Choice::CHOICE_HEIGHT
  214.   end
  215.    
  216.   def item_rect(index)
  217.     rect = Rect.new
  218.     rect.width = item_width
  219.     rect.height = item_height - 15
  220.     rect.height += 15 if $game_switches[Galv_Choice::DISABLE_SWITCH]
  221.     rect.x = index % col_max * (item_width + spacing)
  222.     rect.y = index / col_max * item_height
  223.     rect
  224.   end
  225.    
  226.   def draw_bgs(index)
  227.     return if @choice_sprite[index] != nil
  228.      
  229.     if @choice_background[index].nil?
  230.       b = ""
  231.     else
  232.       b = @choice_background[index]
  233.     end
  234.     @choice_sprite[index] = Sprite.new
  235.     @choice_sprite[index].bitmap = Cache.system(Galv_Choice::CHOICE_IMAGE + b.to_s)
  236.     @choice_sprite[index].x = index % col_max * (item_width + spacing)
  237.     @choice_sprite[index].y = index / col_max * item_height
  238.     @choice_sprite[index].z = self.z - 2
  239.   end

  240.   def update_bgs
  241.     @choice_sprite.each_with_index do |s,i|
  242.       s.y = self.y + i * Galv_Choice::CHOICE_HEIGHT + Galv_Choice::IMAGE_Y_OFFSET
  243.       s.x = (Graphics.width - s.width) / 2
  244.       s.opacity = Galv_Choice::IMAGE_OPACITY
  245.     end
  246.   end
  247.    
  248.   def dispose_bgs
  249.     @choice_sprite.each_with_index do |s,i|
  250.       s.dispose
  251.       s.bitmap.dispose
  252.     end
  253.     if !$game_switches[Galv_Choice::DISABLE_SWITCH]
  254.       @cursor_sprite.dispose
  255.       @cursor_sprite.bitmap.dispose
  256.       @choice_sprite = []
  257.     end
  258.   end
  259.    
  260.   alias galv_choice_call_ok_handler call_ok_handler
  261.   def call_ok_handler
  262.     galv_choice_call_ok_handler
  263.     dispose_bgs
  264.   end
  265.   alias galv_choice_call_cancel_handler call_cancel_handler
  266.   def call_cancel_handler
  267.     galv_choice_call_cancel_handler
  268.     dispose_bgs
  269.   end
  270.    
  271.   def update_cursor
  272.     if $game_switches[Galv_Choice::DISABLE_SWITCH]
  273.       super
  274.     else
  275.       cursor_rect.empty
  276.       return if @cursor_sprite.nil? || @choice_sprite.nil?
  277.       if [url=home.php?mod=space&uid=370741]@Index[/url] < 0
  278.         @cursor_sprite.opacity = 0
  279.       else
  280.         @cursor_sprite.opacity = Galv_Choice::CURSOR_OPACITY
  281.         @cursor_sprite.x = @choice_sprite[@index].x + Galv_Choice::CURSOR_X_OFFSET
  282.         @cursor_sprite.y = @choice_sprite[@index].y + Galv_Choice::CURSOR_Y_OFFSET
  283.         @cursor_sprite.z = self.z - 1
  284.         cursor_rect.y = (item_height * @index) + Galv_Choice::OTHER_Y_OFFSET
  285.       end
  286.     end
  287.   end

  288. end # Window_ChoiceList < Window_Command
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部