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

Project1

 找回密码
 注册会员
搜索
查看: 2864|回复: 4
打印 上一主题 下一主题

[已经解决] 如何使用這個選項擴張腳本...

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
135 小时
注册时间
2013-6-10
帖子
29
1
发表于 2013-6-13 10:06:02 | 显示全部楼层

RE: 如何使用這個選項擴張腳本...

本帖最后由 xTsukihime 于 2013-6-29 07:42 编辑

覺得這ExChoice太難用了。
试一试Large Choices。

[spoiler]

  1. =begin
  2. #==============================================================================
  3. ** Large Choices
  4. Author: Tsukihime
  5. Date: Apr 10, 2013
  6. ------------------------------------------------------------------------------
  7. ** Change log
  8. Apr 10, 2013
  9.    - added option to disable automatic show combining
  10. Mar 26, 2013
  11.    - fixed bug where cancel choice was not properly updated
  12. Jan 12, 2013
  13.    - fixed bug where the first set of nested options were numbered incorrectly
  14. Dec 7, 2012
  15.    - implemented proper branch canceling
  16. Dec 6, 2012
  17.    - Initial release
  18. ------------------------------------------------------------------------------   
  19. ** Terms of Use
  20. * Free to use in commercial/non-commercial projects
  21. * No real support. The script is provided as-is
  22. * Will do bug fixes, but no compatibility patches
  23. * Features may be requested but no guarantees, especially if it is non-trivial
  24. * Preserve this header
  25. ------------------------------------------------------------------------------
  26. ** Description

  27. This script combines groups of "show choice" options together as one large
  28. command. This allows you to create more than 4 choices by simply creating
  29. several "show choice" commands.
  30. ------------------------------------------------------------------------------
  31. ** Usage

  32. Add a show choice command.
  33. If you want more choices, add another one, and fill it out as usual.

  34. Note that you should only specify one cancel choice (if you specify more than
  35. one, then the last one is taken).

  36. For "branch" canceling, note that *all* cancel branches are executed.
  37. You should only have a cancel branch on the last set of choices

  38. You can disable automatic choice combining by enabling the "Manual Combine"
  39. option, which will require you to make this script call before the first
  40. show choice command

  41.     combine_choices
  42.    
  43. In order to combine choices together
  44. #==============================================================================
  45. =end
  46. $imported = {} if $imported.nil?
  47. $imported["TH_LargeChoices"] = true
  48. #==============================================================================
  49. # ** Configuration
  50. #==============================================================================
  51. module TH
  52.   module Large_Choices
  53.    
  54.     # Turning this option on will require you to manually specify that
  55.     # a sequence of Show Choice options should be combined
  56.     Manual_Combine = false
  57.    
  58. #==============================================================================
  59. # ** Rest of the script
  60. #==============================================================================     
  61.     Code_Filter = [402, 403, 404]
  62.     Regex = /<large choices>/i
  63.   end
  64. end

  65. class Game_Temp
  66.   
  67.   # temp solution to get this working
  68.   attr_accessor :branch_choice
  69.   
  70.   def branch_choice
  71.     @branch_choice || 5
  72.   end
  73. end

  74. class Game_Interpreter
  75.   
  76.   #-----------------------------------------------------------------------------
  77.   # Clean up
  78.   #-----------------------------------------------------------------------------
  79.   alias :th_large_choices_clear :clear
  80.   def clear
  81.     th_large_choices_clear
  82.     @first_choice_cmd = nil
  83.     @choice_search = 0
  84.     @combine_choices = false
  85.   end
  86.   
  87.   #-----------------------------------------------------------------------------
  88.   # Prepare for more choices
  89.   #-----------------------------------------------------------------------------
  90.   alias :th_large_choices_setup_choices :setup_choices
  91.   def setup_choices(params)
  92.     # start with our original choices
  93.     th_large_choices_setup_choices(params)
  94.    
  95.     return if TH::Large_Choices::Manual_Combine && !@combine_choices

  96.     # store our "first" choice in the sequence
  97.     @first_choice_cmd = @list[@index]
  98.    
  99.     # reset branch choice
  100.     $game_temp.branch_choice = @first_choice_cmd.parameters[1]
  101.    
  102.     # Start searching for more choices
  103.     @num_choices = $game_message.choices.size
  104.     @choice_search = @index + 1
  105.     search_more_choices
  106.   end
  107.   
  108.   def combine_choices
  109.     @combine_choices = true
  110.   end
  111.   
  112.   #-----------------------------------------------------------------------------
  113.   # New. Check whether the next command (after all branches) is another choice
  114.   # command. If so, merge it with the first choice command.
  115.   #-----------------------------------------------------------------------------
  116.   def search_more_choices
  117.     skip_choice_branches
  118.     next_cmd = @list[@choice_search]
  119.    
  120.     # Next command isn't a "show choice" so we're done
  121.     return if next_cmd.code != 102
  122.    
  123.     @choice_search += 1
  124.     # Otherwise, push the choices into the first choice command to merge
  125.     # the commands.
  126.     @first_choice_cmd.parameters[0].concat(next_cmd.parameters[0])
  127.    
  128.     # Update all cases to reflect merged choices
  129.     update_show_choices(next_cmd.parameters)
  130.     update_cancel_choice(next_cmd.parameters)
  131.     update_choice_numbers
  132.    
  133.     # delete the command to effectively merge the branches
  134.     @list.delete(next_cmd)
  135.    
  136.     # Now search for more
  137.     search_more_choices
  138.   end

  139.   #-----------------------------------------------------------------------------
  140.   # New. Update the options for the first "show choice" command
  141.   #-----------------------------------------------------------------------------
  142.   def update_show_choices(params)
  143.     params[0].each {|s| $game_message.choices.push(s) }
  144.   end
  145.   
  146.   #-----------------------------------------------------------------------------
  147.   # New. If cancel specified, update it to reflect merged choice numbers
  148.   # The last one is taken if multiple cancel choices are specified
  149.   #-----------------------------------------------------------------------------
  150.   def update_cancel_choice(params)
  151.    
  152.     # disallow, just ignore
  153.     return if params[1] == 0   
  154.    
  155.     # branch on cancel
  156.     return update_branch_choice if params[1] == 5
  157.    
  158.     # num_choices is not one-based
  159.     cancel_choice = params[1] + (@num_choices)
  160.     # update cancel choice, as well as the first choice command
  161.     $game_message.choice_cancel_type = cancel_choice
  162.     @first_choice_cmd.parameters[1] = cancel_choice
  163.   end
  164.   
  165.   #-----------------------------------------------------------------------------
  166.   # New. Set the initial choice command to "branch cancel"
  167.   #-----------------------------------------------------------------------------
  168.   def update_branch_choice
  169.     branch_choice = $game_message.choices.size + 1
  170.     $game_message.choice_cancel_type = branch_choice
  171.     $game_temp.branch_choice = branch_choice
  172.     @first_choice_cmd.parameters[1] = branch_choice
  173.   end
  174.   
  175.   def command_403
  176.     command_skip if @branch[@indent] != $game_temp.branch_choice - 1
  177.   end
  178.   
  179.   #-----------------------------------------------------------------------------
  180.   # New. For each branch, update it to reflect the merged choice numbers.
  181.   #-----------------------------------------------------------------------------
  182.   def update_choice_numbers
  183.    
  184.     # Begin searching immediately after cmd 102 (show choice)
  185.     i = @choice_search
  186.    
  187.     # Rough search for "When" commands. The search must skip nested commands
  188.     while TH::Large_Choices::Code_Filter.include?(@list[i].code) || @list[i].indent != @indent
  189.       if @list[i].code == 402 && @list[i].indent == @indent
  190.         @list[i].parameters[0] = @num_choices
  191.         @num_choices += 1
  192.       end
  193.       i += 1
  194.     end
  195.   end
  196.   
  197.   #-----------------------------------------------------------------------------
  198.   # New. Returns the next command after our choice branches
  199.   #-----------------------------------------------------------------------------
  200.   def skip_choice_branches
  201.     # start search at the next command
  202.     # skip all choice branch-related commands and any branches
  203.     while TH::Large_Choices::Code_Filter.include?(@list[@choice_search].code) || @list[@choice_search].indent != @indent
  204.       @choice_search += 1
  205.     end
  206.     return @choice_search
  207.   end
  208. end
复制代码
[/spoiler]

http://himeworks.wordpress.com/2 ... n-multiple-choices/

用法:把幾個連起來就好了。


large_choice1.jpg (92.17 KB, 下载次数: 22)

large_choice1.jpg

large_choice2.jpg (92.8 KB, 下载次数: 22)

large_choice2.jpg

评分

参与人数 1星屑 +100 收起 理由
Sion + 100 感谢帮忙

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-6-5 20:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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