查看: 2249|回复: 11

[已经解决] 關於選項問題…

[复制链接]
梦石
0
星屑
946
在线时间
158 小时
注册时间
2016-8-25
回帖
92
发表于 2021-10-17 17:06:42 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 黑雪哲也 于 2021-10-24 14:18 编辑

關於選項問題,這是之前老早某些好心網友幫回答的腳本。

這個→https://rpg.blue/thread-396738-1-1.html

然後現在重用不知道為何發生了這個問題。

e.jpg


求解答,感謝。

  1. =begin

  2. ▼ 選択肢拡張 ver. 3.2

  3. RPGツクールVXAce用スクリプト

  4. 制作 : 木星ペンギン
  5. URL  : http://woodpenguin.blog.fc2.com/

  6. ------------------------------------------------------------------------------
  7. 概要

  8. □ 選択肢を連続して設定した場合、つなげて一つの選択肢にする機能の追加。
  9. □ 条件を設定することで、その項目を表示しない機能の追加。
  10. □ 選択肢のカーソル初期位置を指定する機能と
  11.     現在のカーソル位置を変数に入れる機能の追加。

  12. □ 選択肢ウィンドウの位置を一時的に変更する機能の追加。
  13. □ 条件を設定することで、その項目を半透明にして選択不可にする機能の追加。
  14. □ 選択肢毎にヘルプメッセージを表示できる機能の追加。

  15. ------------------------------------------------------------------------------
  16. 使い方

  17. □ 選択肢の表示を続けて配置すると、一つの選択肢にまとめられます。
  18.   ・「キャンセルの場合」の処理は、無効以外を設定したものが適用され、
  19.      複数ある場合は後の選択肢のものが適用されます。
  20.   
  21. □ 選択肢の文章中に if(条件) と入れ、その条件が偽になると項目が表示されなくなります。
  22.   ・条件は eval によって評価されます。(詳細は【組み込み関数】を参照)
  23.   ・s でスイッチ、v で変数を参照できます。
  24.   ・「キャンセルの場合」の項目が表示されない場合、無効と同じ処理をします。

  25. □ 注釈に以下の文字列を入れることで、指定された変数の値が
  26.     カーソルの初期位置になります。
  27.   
  28.     カーソル記憶(n)
  29.    
  30.       n : カーソル初期位置の入った変数番号
  31.   
  32.   ・選択肢のカーソルの位置が変更されるたびに、
  33.     この変数に選択肢の番号が入れられるようになります。
  34.   
  35. □ 注釈に以下の文字列を入れることで、選択肢ウィンドウの表示位置を
  36.    一時的に変更することが出来ます。
  37.   
  38.     選択肢位置(x, y[, row])
  39.    
  40.       x   : ウィンドウを表示する X 座標。
  41.       y   : ウィンドウを表示する Y 座標。
  42.       row : 選択肢を表示する最大行数。
  43.             指定しない場合は、通常の最大行数を無視して
  44.             すべての選択肢が表示されます。
  45.   
  46. □ 注釈に以下の文字列を入れることで、選択肢ウィンドウの背景が非表示になります。
  47.   
  48.     背景OFF
  49.    
  50. □ 選択肢の文章中に en(条件) と入れ、その条件が偽になると項目が半透明で表示されます。
  51.   ・条件は eval によって評価されます。(詳細は【組み込み関数】を参照)
  52.   ・s でスイッチ、v で変数を参照できます。
  53.   ・「キャンセルの場合」の項目が半透明の場合、ブザーが鳴ります。
  54.   
  55. □ 各項目の下に、注釈で以下の文字列を入れると、続きの注釈を
  56.     項目のヘルプメッセージとしてカーソルを合わせたときに標示することができます。
  57.   
  58.     選択肢ヘルプ
  59.    
  60. □ 詳細は下記のサイトを参照してください。

  61.   http://woodpenguin.web.fc2.com/rgss3/choice_ex.html
  62.   
  63. =end
  64. module WdTk
  65. module ChoiceEX
  66. #//////////////////////////////////////////////////////////////////////////////
  67. #
  68. # 設定項目
  69. #
  70. #//////////////////////////////////////////////////////////////////////////////
  71.   #--------------------------------------------------------------------------
  72.   # ● 選択肢の最大行数
  73.   #     選択肢を表示するウィンドウの行数の最大数です。
  74.   #     選択肢がこの数より小さければ、選択肢の数に合わせます。
  75.   #--------------------------------------------------------------------------
  76.   RowMax = 4
  77.   
  78.   #--------------------------------------------------------------------------
  79.   # ● 選択肢ヘルプを読み取る文字列
  80.   #--------------------------------------------------------------------------
  81.   Help = "選択肢ヘルプ"
  82.   
  83. end

  84. #//////////////////////////////////////////////////////////////////////////////
  85. #
  86. # 以降、変更する必要なし
  87. #
  88. #//////////////////////////////////////////////////////////////////////////////

  89.   @material ||= []
  90.   @material << :ChoiceEX
  91.   def self.include?(sym)
  92.     @material.include?(sym)
  93.   end
  94.   
  95. end

  96. #==============================================================================
  97. # ■ Game_Message
  98. #==============================================================================
  99. class Game_Message
  100.   #--------------------------------------------------------------------------
  101.   # ● 公開インスタンス変数
  102.   #--------------------------------------------------------------------------
  103.   attr_accessor :choice_x                 # 選択肢ウィンドウの表示 X 座標
  104.   attr_accessor :choice_y                 # 選択肢ウィンドウの表示 Y 座標
  105.   attr_accessor :choice_row_max           # 選択肢ウィンドウの表示行数
  106.   attr_accessor :choice_help              # 選択肢のヘルプ
  107.   attr_accessor :choice_var_id            # 選択肢のカーソル位置を入れる変数ID
  108.   attr_accessor :choice_background        # 選択肢ウィンドウ背景の表示状態
  109.   #--------------------------------------------------------------------------
  110.   # ○ クリア
  111.   #--------------------------------------------------------------------------
  112.   alias _wdtk_choice_clear clear
  113.   def clear
  114.     _wdtk_choice_clear
  115.     @choice_x = @choice_y = nil
  116.     @choice_row_max = WdTk::ChoiceEX::RowMax
  117.     @choice_help = {}
  118.     @choice_var_id = 0
  119.     @choice_background = 0
  120.   end
  121. end

  122. #==============================================================================
  123. # ■ Game_Interpreter
  124. #==============================================================================
  125. class Game_Interpreter
  126.   #--------------------------------------------------------------------------
  127.   # ☆ 選択肢のセットアップ
  128.   #--------------------------------------------------------------------------
  129.   def setup_choices(params)
  130.     add_choices(params, @index)
  131.     $game_message.choice_proc = Proc.new {|n| @branch[@indent] = n }
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 選択肢の追加
  135.   #--------------------------------------------------------------------------
  136.   def add_choices(params, i, d = 0)
  137.     params[0].each_with_index {|s, n| $game_message.choices[n + d] = s }
  138.     $game_message.choice_cancel_type = params[1] + d if params[1] > 0
  139.     indent = @list.indent
  140.     loop do
  141.       i += 1
  142.       if @list.indent == indent
  143.         case @list.code
  144.         when 402 # [**] の場合
  145.           get_help_texts(@list.parameters[0] + d, i + 1)
  146.         when 404 # 分岐終了
  147.           break
  148.         end
  149.       end
  150.     end
  151.     i += 1
  152.     add_choices(@list.parameters, i, d + 5) if @list.code == 102
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● ヘルプ用テキストの取得
  156.   #--------------------------------------------------------------------------
  157.   def get_help_texts(b, i)
  158.     if @list.code == 108 && @list.parameters[0] == WdTk::ChoiceEX::Help
  159.       $game_message.choice_help = []
  160.       while @list[i + 1].code == 408
  161.         i += 1
  162.         $game_message.choice_help << @list.parameters[0]
  163.       end
  164.     end
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ◯ 注釈
  168.   #--------------------------------------------------------------------------
  169.   alias _wdtk_choice_command_108 command_108
  170.   def command_108
  171.     _wdtk_choice_command_108
  172.     @comments.each do |comment|
  173.       case comment
  174.       when /選択肢位置\((\d+),\s*(\d+),?\s*(\d*)\)/
  175.         $game_message.choice_x = $1.to_i
  176.         $game_message.choice_y = $2.to_i
  177.         $game_message.choice_row_max = ($3.empty? ? 99 : $3.to_i)
  178.       when /カーソル記憶\((\d+)\)/
  179.         $game_message.choice_var_id = $1.to_i
  180.       when /背景(ON|OFF)/
  181.         $game_message.choice_background = ($1 == "ON" ? 0 : 1)
  182.       end
  183.     end
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ☆ 分岐終了の場合
  187.   #--------------------------------------------------------------------------
  188.   def command_404
  189.     if next_event_code == 102
  190.       @branch[@indent] -= 5 if @branch.include?(@indent)
  191.       @index += 1
  192.       command_skip
  193.     end
  194.   end
  195. end

  196. #==============================================================================
  197. # ■ Window_ChoiceList
  198. #==============================================================================
  199. class Window_ChoiceList
  200.   #--------------------------------------------------------------------------
  201.   # ☆ 入力処理の開始
  202.   #--------------------------------------------------------------------------
  203.   def start
  204.     return unless close?
  205.     clear_command_list
  206.     make_command_list
  207.     if @list.empty?
  208.       $game_message.choice_proc.call(-1)
  209.       return
  210.     end
  211.     update_placement
  212.     refresh
  213.     select(0)
  214.     if $game_message.choice_var_id > 0
  215.       select_ext($game_variables[$game_message.choice_var_id])
  216.     end
  217.     open
  218.     activate
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # ☆ ウィンドウ位置の更新
  222.   #--------------------------------------------------------------------------
  223.   def update_placement
  224.     self.width = [max_choice_width + 12, 96].max + padding * 2
  225.     self.width = [width, Graphics.width].min
  226.     n = [@list.size, $game_message.choice_row_max].min
  227.     self.height = fitting_height(n)
  228.     self.x = Graphics.width - width
  229.     if @message_window.y >= Graphics.height / 2
  230.       self.y = @message_window.y - height
  231.     else
  232.       self.y = @message_window.y + @message_window.height
  233.     end
  234.     self.x = $game_message.choice_x if $game_message.choice_x
  235.     self.y = $game_message.choice_y if $game_message.choice_y
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ☆ 選択肢の最大幅を取得
  239.   #--------------------------------------------------------------------------
  240.   def max_choice_width
  241.     @list.collect {|com| text_size(com[:name]).width }.max || 0
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ☆ コマンドリストの作成
  245.   #--------------------------------------------------------------------------
  246.   def make_command_list
  247.     $game_message.choices.each_with_index do |choice, i|
  248.       next unless choice
  249.       str = choice.dup
  250.       next if str.slice!(/\s*if\(([^\)]+)\)/i) && !choice_eval($1)
  251.       enable = !str.slice!(/\s*en\(([^\)]+)\)/i) || choice_eval($1)
  252.       add_command(str, :choice, enable, i)
  253.     end
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ○ 項目の描画
  257.   #--------------------------------------------------------------------------
  258.   alias _wdtk_choice_draw_item draw_item
  259.   def draw_item(index)
  260.     @choice_enabled = command_enabled?(index)
  261.     _wdtk_choice_draw_item(index)
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● テキスト描画色の変更
  265.   #--------------------------------------------------------------------------
  266.   def change_color(color, enabled = true)
  267.     super(color, enabled && @choice_enabled)
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ☆ 決定ハンドラの呼び出し
  271.   #--------------------------------------------------------------------------
  272.   def call_ok_handler
  273.     $game_message.choice_proc.call(current_ext)
  274.     close
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ● キャンセルボタンが押されたときの処理
  278.   #--------------------------------------------------------------------------
  279.   def process_cancel
  280.     return super if $game_message.choice_cancel_type % 5 == 0
  281.     index = @list.index {|c| c[:ext] == $game_message.choice_cancel_type - 1 }
  282.     return unless index
  283.     return super if command_enabled?(index)
  284.     Sound.play_buzzer
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ● ウィンドウを閉じる
  288.   #--------------------------------------------------------------------------
  289.   def close
  290.     @message_window.on_show_fast unless $game_message.choice_help.empty?
  291.     super
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ● ヘルプウィンドウ更新メソッドの呼び出し
  295.   #--------------------------------------------------------------------------
  296.   def call_update_help
  297.     update_help if active && !$game_message.choice_help.empty?
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● ヘルプウィンドウの更新
  301.   #--------------------------------------------------------------------------
  302.   def update_help
  303.     @message_window.force_clear
  304.     if $game_message.choice_help.include?(current_ext)
  305.       $game_message.texts.replace($game_message.choice_help[current_ext])
  306.     else
  307.       $game_message.texts.clear
  308.     end
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● 分岐用
  312.   #--------------------------------------------------------------------------
  313.   def choice_eval(formula)
  314.     s, v = $game_switches, $game_variables
  315.     begin
  316.       Kernel.eval(formula)
  317.     rescue
  318.       msgbox "以下の条件判定でエラーが出ました。\n\n", formula
  319.       true
  320.     end
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● フレーム更新
  324.   #--------------------------------------------------------------------------
  325.   def update
  326.     last_index = @index
  327.     super
  328.     if last_index != @index && $game_message.choice_var_id > 0
  329.       $game_variables[$game_message.choice_var_id] = current_ext
  330.     end
  331.   end
  332. end

  333. #==============================================================================
  334. # ■ Window_Message
  335. #==============================================================================
  336. class Window_Message
  337.   #--------------------------------------------------------------------------
  338.   # ○ ウィンドウ背景の更新
  339.   #--------------------------------------------------------------------------
  340.   alias _wdtk_choice_update_background update_background
  341.   def update_background
  342.     _wdtk_choice_update_background
  343.     @choice_window.opacity = $game_message.choice_background == 0 ? 255 : 0
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● 文章の標示を強制クリア
  347.   #--------------------------------------------------------------------------
  348.   def force_clear
  349.     @gold_window.close
  350.     @fiber = nil
  351.     close
  352.     if WdTk.include?(:MesEff)
  353.       @character_sprites.each do |sprite, params|
  354.         next if params.empty?
  355.         sprite.bitmap.clear
  356.         sprite.visible = false
  357.         params.clear
  358.       end
  359.     end
  360.   end
  361.   #--------------------------------------------------------------------------
  362.   # ● 文章を最後まで表示する
  363.   #--------------------------------------------------------------------------
  364.   def on_show_fast
  365.     @show_fast = true
  366.   end
  367. end[/pre]
复制代码



別名:黑幽。
一個社恐的遊戲與畫圖愛好者。
路過的各位請關注一下~感謝~
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2021-10-17 18:35:23 | 显示全部楼层
资讯不足, 无法解答,不用謝。
回复

使用道具 举报

老鹰

梦石
40
星屑
37812
在线时间
7091 小时
注册时间
2012-5-26
回帖
3297

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

发表于 2021-10-17 22:58:34 | 显示全部楼层
把这个脚本复制到主楼,用
  1. 代码块
复制代码

点评

?  发表于 2021-10-18 11:51
回复

使用道具 举报

梦石
0
星屑
3093
在线时间
344 小时
注册时间
2021-10-18
回帖
141
发表于 2021-10-18 15:33:47 | 显示全部楼层
那个empty?的判断没找到,是你动过继承还是不小心删改了方法?
回复

使用道具 举报

梦石
0
星屑
946
在线时间
158 小时
注册时间
2016-8-25
回帖
92
 楼主| 发表于 2021-10-20 16:41:18 | 显示全部楼层
百里_飞柳 发表于 2021-10-17 22:58
把这个脚本复制到主楼,用

抱歉哈哈…代碼塊不熟悉,腳本丟在上面了,感謝0.0..
別名:黑幽。
一個社恐的遊戲與畫圖愛好者。
路過的各位請關注一下~感謝~
回复

使用道具 举报

梦石
0
星屑
946
在线时间
158 小时
注册时间
2016-8-25
回帖
92
 楼主| 发表于 2021-10-23 22:40:22 | 显示全部楼层
掘窖人 发表于 2021-10-18 15:33
那个empty?的判断没找到,是你动过继承还是不小心删改了方法?

我這個腳本是做到一半才加入的。
別名:黑幽。
一個社恐的遊戲與畫圖愛好者。
路過的各位請關注一下~感謝~
回复

使用道具 举报

梦石
0
星屑
17038
在线时间
6058 小时
注册时间
2011-7-18
回帖
152

开拓者

发表于 2021-10-24 00:03:35 | 显示全部楼层
本帖最后由 gqxastg 于 2021-10-24 00:52 编辑

在选择肢脚本后新开一页插入这个
[pre lang="ruby"]class Game_Message
  def choice_help
    return @choice_help if @choice_help
    @choice_x = @choice_y = nil
    @choice_row_max = WdTk::ChoiceEX::RowMax
    @choice_help = {}
    @choice_var_id = 0
    @choice_background = 0
    @under_choice = false
    return @choice_help
  end
end[/pre]另外这个选择肢脚本其实版本更新到3.7了,建议更新一下
http://woodpenguin.web.fc2.com/rgss3/choice_ex.txt
备份[pre lang="ruby"]=begin

▼ 選択肢拡張 ver. 3.7

RPGツクールVXAce用スクリプト

制作 : 木星ペンギン
URL  : http://woodpenguin.blog.fc2.com/

------------------------------------------------------------------------------
概要

□ 選択肢を連続して設定した場合、つなげて一つの選択肢にする機能の追加。
□ 条件を設定することで、その項目を表示しない機能の追加。
□ 選択肢のカーソル初期位置を指定する機能と
    現在のカーソル位置を変数に入れる機能の追加。

□ 選択肢ウィンドウの位置を一時的に変更する機能の追加。
□ 条件を設定することで、その項目を半透明にして選択不可にする機能の追加。
□ 選択肢毎にヘルプメッセージを表示できる機能の追加。

------------------------------------------------------------------------------
使い方

□ 選択肢の表示を続けて配置すると、一つの選択肢にまとめられます。
  ・「キャンセルの場合」の処理は、無効以外を設定したものが適用され、
     複数ある場合は後の選択肢のものが適用されます。
  
□ 選択肢の文章中に if(条件) と入れ、その条件が偽になると項目が表示されなくなります。
  ・条件は eval によって評価されます。(詳細は【組み込み関数】を参照)
  ・s でスイッチ、v で変数を参照できます。
  ・「キャンセルの場合」の項目が表示されない場合、無効と同じ処理をします。

□ 注釈に以下の文字列を入れることで、指定された変数の値が
    カーソルの初期位置になります。
  
    カーソル記憶(n)
   
      n : カーソル初期位置の入った変数番号
  
  ・変数の値がマイナスだった場合、初期カーソルは表示されません。
  ・選択肢のカーソルの位置が変更されるたびに、
    この変数に選択肢の番号が入れられるようになります。
  
□ 注釈に以下の文字列を入れることで、選択肢ウィンドウの表示位置を
   一時的に変更することが出来ます。
  
    選択肢位置(x, y[, row])
   
      x   : ウィンドウを表示する X 座標。
      y   : ウィンドウを表示する Y 座標。
      row : 選択肢を表示する最大行数。
            指定しない場合は、通常の最大行数を無視して
            すべての選択肢が表示されます。
  
□ 注釈に以下の文字列を入れることで、メッセージの下に選択肢を
   表示させます。
    [文章の表示]をこの後に実行してください。
  
    選択肢位置(メッセージ下)
   
□ 注釈に以下の文字列を入れることで、選択肢ウィンドウの背景が非表示になります。
  
    背景OFF
   
□ 選択肢の文章中に en(条件) と入れ、その条件が偽になると項目が半透明で表示されます。
  ・条件は eval によって評価されます。(詳細は【組み込み関数】を参照)
  ・s でスイッチ、v で変数を参照できます。
  ・「キャンセルの場合」の項目が半透明の場合、ブザーが鳴ります。
  
□ 各項目の下に、注釈で以下の文字列を入れると、続きの注釈を
    項目のヘルプメッセージとしてカーソルを合わせたときに標示することができます。
  
    選択肢ヘルプ
   
□ 詳細は下記のサイトを参照してください。

  http://woodpenguin.web.fc2.com/rgss3/choice_ex.html
  
=end
module WdTk
module ChoiceEX
#//////////////////////////////////////////////////////////////////////////////
#
# 設定項目
#
#//////////////////////////////////////////////////////////////////////////////
  #--------------------------------------------------------------------------
  # ● 選択肢の最大行数
  #     選択肢を表示するウィンドウの行数の最大数です。
  #     選択肢がこの数より小さければ、選択肢の数に合わせます。
  #--------------------------------------------------------------------------
  RowMax = 4
  
  #--------------------------------------------------------------------------
  # ● 選択肢ヘルプを読み取る文字列
  #--------------------------------------------------------------------------
  Help = "選択肢ヘルプ"
  
end

#//////////////////////////////////////////////////////////////////////////////
#
# 以降、変更する必要なし
#
#//////////////////////////////////////////////////////////////////////////////

  @material ||= []
  @material << :ChoiceEX
  def self.include?(sym)
    @material.include?(sym)
  end
  
end

#==============================================================================
# ■ Game_Message
#==============================================================================
class Game_Message
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :choice_x                 # 選択肢ウィンドウの表示 X 座標
  attr_accessor :choice_y                 # 選択肢ウィンドウの表示 Y 座標
  attr_accessor :choice_row_max           # 選択肢ウィンドウの表示行数
  attr_accessor :choice_help              # 選択肢のヘルプ
  attr_accessor :choice_var_id            # 選択肢のカーソル位置を入れる変数ID
  attr_accessor :choice_background        # 選択肢ウィンドウ背景の表示状態
  attr_accessor :under_choice             # 選択肢をメッセージの下に表示
  #--------------------------------------------------------------------------
  # ○ クリア
  #--------------------------------------------------------------------------
  alias _wdtk_choice_clear clear
  def clear
    _wdtk_choice_clear
    @choice_x = @choice_y = nil
    @choice_row_max = WdTk::ChoiceEX::RowMax
    @choice_help = {}
    @choice_var_id = 0
    @choice_background = 0
    @under_choice = false
  end
end

#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # ☆ 選択肢のセットアップ
  #--------------------------------------------------------------------------
  def setup_choices(params)
    add_choices(params, @index)
    $game_message.choice_proc = Proc.new {|n| @branch[@indent] = n }
  end
  #--------------------------------------------------------------------------
  # ● 選択肢の追加
  #--------------------------------------------------------------------------
  def add_choices(params, i, d = 0)
    params[0].each_with_index {|s, n| $game_message.choices[n + d] = s }
    $game_message.choice_cancel_type = params[1] + d if params[1] > 0
    indent = @list.indent
    loop do
      i += 1
      if @list.indent == indent
        case @list.code
        when 402 # [**] の場合
          get_help_texts(@list.parameters[0] + d, i + 1)
        when 404 # 分岐終了
          break
        end
      end
    end
    i += 1
    add_choices(@list.parameters, i, d + 5) if @list.code == 102
  end
  #--------------------------------------------------------------------------
  # ● ヘルプ用テキストの取得
  #--------------------------------------------------------------------------
  def get_help_texts(b, i)
    if @list.code == 108 && @list.parameters[0] == WdTk::ChoiceEX::Help
      $game_message.choice_help = []
      while @list[i + 1].code == 408
        i += 1
        $game_message.choice_help << @list.parameters[0]
      end
    end
  end
  #--------------------------------------------------------------------------
  # ◯ 注釈
  #--------------------------------------------------------------------------
  alias _wdtk_choice_command_108 command_108
  def command_108
    _wdtk_choice_command_108
    @comments.each do |comment|
      case comment
      when /選択肢位置\((\d+),\s*(\d+),?\s*(\d*)\)/
        $game_message.choice_x = $1.to_i
        $game_message.choice_y = $2.to_i
        $game_message.choice_row_max = ($3.empty? ? 99 : $3.to_i)
      when "選択肢位置(メッセージ下)"
        $game_message.under_choice = true
        $game_message.choice_background = 1
      when /カーソル記憶\((\d+)\)/
        $game_message.choice_var_id = $1.to_i
      when /背景(ON|OFF)/
        $game_message.choice_background = ($1 == "ON" ? 0 : 1)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ☆ 分岐終了の場合
  #--------------------------------------------------------------------------
  def command_404
    if next_event_code == 102
      @branch[@indent] -= 5 if @branch.include?(@indent)
      @index += 1
      command_skip
    end
  end
end

#==============================================================================
# ■ Window_ChoiceList
#==============================================================================
class Window_ChoiceList
  #--------------------------------------------------------------------------
  # ☆ 入力処理の開始
  #--------------------------------------------------------------------------
  def start
    return unless close?
    clear_command_list
    make_command_list
    if @list.empty?
      $game_message.choice_proc.call(-1)
      return
    end
    update_placement
    refresh
    select(0)
    if $game_message.choice_var_id > 0
      value = $game_variables[$game_message.choice_var_id]
      if value >= 0
        select_ext($game_variables[$game_message.choice_var_id])
      else
        unselect
      end
    end
    open
    activate
  end
  #--------------------------------------------------------------------------
  # ☆ ウィンドウ位置の更新
  #--------------------------------------------------------------------------
  def update_placement
    self.width = [max_choice_width + 12, 96].max + padding * 2
    self.width = [width, Graphics.width].min
    n = [@list.size, $game_message.choice_row_max].min
    self.height = fitting_height(n)
    self.x = Graphics.width - width
    if @message_window.y >= Graphics.height / 2
      self.y = @message_window.y - height
    else
      self.y = @message_window.y + @message_window.height
    end
    self.x = $game_message.choice_x if $game_message.choice_x
    self.y = $game_message.choice_y if $game_message.choice_y
    self.z = $game_message.under_choice ? 210 : 100
  end
  #--------------------------------------------------------------------------
  # ☆ 選択肢の最大幅を取得
  #--------------------------------------------------------------------------
  def max_choice_width
    @list.collect {|com| text_ex_width(com[:name]) }.max || 0
  end
  #--------------------------------------------------------------------------
  # ● 制御文字つきテキストの幅を取得
  #--------------------------------------------------------------------------
  def text_ex_width(text)
    text2 = convert_escape_characters(text)
    icon_width = text2.scan(/\eI\[\d+\]/i).size * 24
    text2.gsub!(/\e(?:[\$\.\|\^!><\{\}\\]|[A-Z]+)(?:\[\d+\])?/i, "")
    text2.delete!("\e")
    text_size(text2).width + icon_width
  end
  #--------------------------------------------------------------------------
  # ☆ コマンドリストの作成
  #--------------------------------------------------------------------------
  def make_command_list
    $game_message.choices.each_with_index do |choice, i|
      next unless choice
      str = choice.dup
      next if str.slice!(/\s*if\(([^\)]+)\)/i) && !choice_eval($1)
      enable = !str.slice!(/\s*en\(([^\)]+)\)/i) || choice_eval($1)
      add_command(str, :choice, enable, i)
    end
  end
  #--------------------------------------------------------------------------
  # ○ 項目の描画
  #--------------------------------------------------------------------------
  alias _wdtk_choice_draw_item draw_item
  def draw_item(index)
    @choice_enabled = command_enabled?(index)
    _wdtk_choice_draw_item(index)
  end
  #--------------------------------------------------------------------------
  # ● テキスト描画色の変更
  #--------------------------------------------------------------------------
  def change_color(color, enabled = true)
    super(color, enabled && @choice_enabled)
  end
  #--------------------------------------------------------------------------
  # ○ カーソルを上に移動
  #--------------------------------------------------------------------------
  alias _wdtk_choice_cursor_up cursor_up
  def cursor_up(wrap = false)
    self.index = 0 if index < 0
    _wdtk_choice_cursor_up(wrap)
  end
  #--------------------------------------------------------------------------
  # ☆ 決定ハンドラの呼び出し
  #--------------------------------------------------------------------------
  def call_ok_handler
    $game_message.choice_proc.call(current_ext)
    close
  end
  #--------------------------------------------------------------------------
  # ● キャンセルボタンが押されたときの処理
  #--------------------------------------------------------------------------
  def process_cancel
    return super if $game_message.choice_cancel_type % 5 == 0
    index = @list.index {|c| c[:ext] == $game_message.choice_cancel_type - 1 }
    return unless index
    return super if command_enabled?(index)
    Sound.play_buzzer
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウを閉じる
  #--------------------------------------------------------------------------
  def close
    @message_window.on_show_fast unless $game_message.choice_help.empty?
    super
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウィンドウ更新メソッドの呼び出し
  #--------------------------------------------------------------------------
  def call_update_help
    update_help if active && !$game_message.choice_help.empty?
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウィンドウの更新
  #--------------------------------------------------------------------------
  def update_help
    @message_window.force_clear
    if $game_message.choice_help.include?(current_ext)
      $game_message.texts.replace($game_message.choice_help[current_ext])
    else
      $game_message.texts.clear
    end
  end
  #--------------------------------------------------------------------------
  # ● 分岐用
  #--------------------------------------------------------------------------
  def choice_eval(formula)
    s, v = $game_switches, $game_variables
    begin
      Kernel.eval(formula)
    rescue
      msgbox "以下の条件判定でエラーが出ました。\n\n", formula
      true
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    last_index = @index
    super
    if last_index != @index && $game_message.choice_var_id > 0
      $game_variables[$game_message.choice_var_id] = current_ext
    end
  end
end

#==============================================================================
# ■ Window_Message
#==============================================================================
class Window_Message
  #--------------------------------------------------------------------------
  # ○ インスタンス変数のクリア
  #--------------------------------------------------------------------------
  alias _wdtk_choice_clear_instance_variables clear_instance_variables
  def clear_instance_variables
    @choice_background = 0
    _wdtk_choice_clear_instance_variables
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ背景の更新
  #--------------------------------------------------------------------------
  alias _wdtk_choice_update_background update_background
  def update_background
    _wdtk_choice_update_background
    @choice_background = $game_message.choice_background
    @choice_window.opacity = @choice_background == 0 ? 255 : 0
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ位置の更新
  #--------------------------------------------------------------------------
  alias _wdtk_choice_update_placement update_placement
  def update_placement
    _wdtk_choice_update_placement
    reset_under_choice
  end
  #--------------------------------------------------------------------------
  # ○ 背景と位置の変更判定
  #--------------------------------------------------------------------------
  alias _wdtk_choice_settings_changed? settings_changed?
  def settings_changed?
    _wdtk_choice_settings_changed? ||
    @choice_background != $game_message.choice_background
  end
  #--------------------------------------------------------------------------
  # ○ 改ページ処理
  #--------------------------------------------------------------------------
  alias _wdtk_choice_new_page new_page
  def new_page(text, pos)
    _wdtk_choice_new_page(text, pos)
    reset_under_choice
  end
  #--------------------------------------------------------------------------
  # ○ 改行文字の処理
  #--------------------------------------------------------------------------
  alias _wdtk_choice_process_new_line process_new_line
  def process_new_line(text, pos)
    if $game_message.under_choice
      $game_message.choice_y += pos[:height]
      ch = self.contents_height + self.y - $game_message.choice_y
      $game_message.choice_row_max = ch / line_height
    end
    _wdtk_choice_process_new_line(text, pos)
  end
  #--------------------------------------------------------------------------
  # ● 選択肢をメッセージ下に表示する際のリセット
  #--------------------------------------------------------------------------
  def reset_under_choice
    if $game_message.under_choice
      $game_message.choice_x = self.x + 16 + new_line_x
      $game_message.choice_y = self.y
      $game_message.choice_row_max = visible_line_number
    end
  end
  #--------------------------------------------------------------------------
  # ● 文章の標示を強制クリア
  #--------------------------------------------------------------------------
  def force_clear
    @gold_window.close
    @fiber = nil
    close
    if WdTk.include?(:MesEff)
      @character_sprites.each do |sprite, params|
        next if params.empty?
        sprite.bitmap.clear
        sprite.visible = false
        params.clear
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 文章を最後まで表示する
  #--------------------------------------------------------------------------
  def on_show_fast
    @show_fast = true
  end
end
[/pre]

顺便一提使用代码块的方法是:高级模式下点击选项栏右上角“<>”样子的图标(会显示“添加代码文字”),然后把脚本代码粘贴到弹出框中最大的输入框里,再点“提交”即可
(建议保持勾选“纯文本”)
就算不进入高级模式也有相同的图标(会显示“代码”),方法一样

评分

参与人数 1赞 +1 收起 理由
alexncf125 + 1 精品文章

查看全部评分

这里岚风·雷,任饭、PM理性粉、UT/DR原作粉、(Trans)Furry自萌,半吊子技术一枚_(:з」∠)_    游戏制作交流工(liao)作(tian)室欢迎来玩!
【无偿/有偿】RGSS3(VA)脚本定制 + 合作招募/同好交友    修正Firefox/火狐浏览器的代码框复制问题(油猴脚本)
Click→←Click
回复

使用道具 举报

梦石
0
星屑
946
在线时间
158 小时
注册时间
2016-8-25
回帖
92
 楼主| 发表于 2021-10-24 14:19:20 | 显示全部楼层
gqxastg 发表于 2021-10-24 00:03
在选择肢脚本后新开一页插入这个
class Game_Message
  def choice_help

原來如此!感謝您!已經解決了。
別名:黑幽。
一個社恐的遊戲與畫圖愛好者。
路過的各位請關注一下~感謝~
回复

使用道具 举报

梦石
0
星屑
946
在线时间
158 小时
注册时间
2016-8-25
回帖
92
 楼主| 发表于 2021-10-24 14:30:31 | 显示全部楼层
gqxastg 发表于 2021-10-24 00:03
在选择肢脚本后新开一页插入这个
class Game_Message
  def choice_help

不過又是之前一樣的問題……
我已經照腳本上的註釋打上『選択肢位置(X/Y)』位置
但選擇框還是在右下…

点评

英语括号,应该是这样的 選択肢位置(150, 200)  发表于 2021-10-24 15:32
別名:黑幽。
一個社恐的遊戲與畫圖愛好者。
路過的各位請關注一下~感謝~
回复

使用道具 举报

梦石
0
星屑
946
在线时间
158 小时
注册时间
2016-8-25
回帖
92
 楼主| 发表于 2021-10-24 18:49:07 | 显示全部楼层
黑雪哲也 发表于 2021-10-24 14:30
不過又是之前一樣的問題……
我已經照腳本上的註釋打上『選択肢位置(X/Y)』位置
但選擇框還是在右下 ...

喔喔,原來是這樣=w=b....再次感謝!
別名:黑幽。
一個社恐的遊戲與畫圖愛好者。
路過的各位請關注一下~感謝~
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部