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

Project1

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

[已经解决] RMVA如何突破4个选择项?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
49
在线时间
152 小时
注册时间
2012-1-12
帖子
456
跳转到指定楼层
1
发表于 2012-4-9 21:56:19 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
如图,如何设置为5个选项或者更多啊!

Lv2.观梦者

梦石
0
星屑
681
在线时间
791 小时
注册时间
2011-10-20
帖子
2394

开拓者

2
发表于 2012-4-9 23:02:20 手机端发表。 | 只看该作者
地图中再建个 @变量存超级对话选项(command)调用他即可
欢迎点此进入我的egames.wink.ws,有RMQQ堂等

[url=http://rpg.blue/thread-317273-1-1.html]短篇八-赶选

http://yun.baidu.com/share/link?shareid=2158225779&uk=169642147&third=0


历险ARPG赢回你的疆域新的战斗模式?…………点击这里:[宋乱贼狂 for QQ堂]
http://rpg.blue/group-368-1.html
programing ....?
[url=http://rpg.blue/thrd-234658-1-1.html]
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
152 小时
注册时间
2012-1-12
帖子
456
3
 楼主| 发表于 2012-4-10 20:45:43 | 只看该作者
end55rpg 发表于 2012-4-9 23:02
地图中再建个 @变量存超级对话选项(command)调用他即可

详细点- -本人脚本盲,事件倒是摸索透了- -

点评

其实要修改较多的脚本  发表于 2012-4-11 12:11
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
45
在线时间
226 小时
注册时间
2012-3-26
帖子
72
4
发表于 2012-4-10 21:41:54 | 只看该作者
恩,刚好最近也遇到这个问题,搭车问


“和尚!你想对那个少女做什么?!”

点评

hcm
纯水啊,这不是水区。  发表于 2012-4-12 17:21
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
212 小时
注册时间
2012-3-5
帖子
228
5
发表于 2012-4-10 22:44:26 | 只看该作者
最简单的是把第4个选项设置成下一页,虽然不能同时出现,但能实现超多项选择。

点评

正解  发表于 2012-4-10 23:09
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
22017
在线时间
8574 小时
注册时间
2011-12-31
帖子
3362
6
发表于 2012-4-10 23:15:51 | 只看该作者
本帖最后由 tseyik 于 2012-4-11 09:19 编辑

這様行不行

這是A1君的拡張選択肢脚本
出處
http://a1tktk.web.fc2.com/

A1泛用

  1. # ===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    A1共通処理(RGSS2/RGSS3共用)
  4. #
  5. # バージョン   : 4.50 (2012/01/26)
  6. # 作者         : A1
  7. # URL     : http://a1tktk.web.fc2.com/
  8. # ---------------------------------------------------------------------------
  9. # 更新履歴   :2011/11/11 Ver1.00 新規作成
  10. #        :2011/12/22 Ver2.00 RGSS3用と同様の処理に変更
  11. #        :2011/12/30 Ver2.10 RGSS3用メソッドを追加
  12. #        :2011/12/30 Ver3.00 RGSS3用共通処理と統合
  13. #        :2011/12/31 Ver3.10 マップチップサーチの仕様を変更
  14. #        :2011/12/31 Ver3.10 拡張通行判定を追加
  15. #        :2012/01/01 Ver3.11 クラス名の取得処理を追加
  16. #              :2012/01/02 Ver3.20 配列を考慮したsplit処理を追加
  17. #              :2012/01/02 Ver3.20 配列の全ての要素を整数にする処理を追加
  18. #              :2012/01/02 Ver3.30 注釈の処理の仕様を変更
  19. #              :2012/01/02 Ver3.40 「前のイベントコマンドの取得」を追加
  20. #              :2012/01/03 Ver3.50 「フレーム更新」を追加
  21. #              :2012/01/04 Ver3.60 「指定のウィンドウが開いている間ウェイト」追加
  22. #              :2012/01/04 Ver3.70 RGSS2用処理見直し
  23. #              :2012/01/05 Ver3.80 注釈文字列にエスケープコマンド対応
  24. #              :2012/01/05 Ver3.80 多次元配列を考慮したsplit処理を追加
  25. #              :2012/01/05 Ver3.80 注釈にスクリプト処理機能を追加
  26. #              :2012/01/10 Ver3.90 文字縁取り描画を追加
  27. #              :2012/01/11 Ver4.00 テキストビットマップのキャッシュを追加
  28. #              :2012/01/13 Ver4.01 「タイルセットの変更」ができなくなる不具合を修正
  29. #              :2012/01/14 Ver4.10 split処理を強化
  30. #              :2012/01/14 Ver4.20 空白を含む注釈コマンドに対応
  31. #              :2012/01/14 Ver4.21 split処理の不具合を修正
  32. #              :2012/01/21 Ver4.30 メモの内容を取得する関数を追加
  33. #              :2012/01/24 Ver4.40 メモの内容を取得する関数を追加
  34. #              :2012/01/24 Ver4.50 メモの内容を取得する関数を追加
  35. # ---------------------------------------------------------------------------
  36. # 設置場所      
  37. #  なるべく上の方
  38. #
  39. # 必要スクリプト
  40. #    なし
  41. #==============================================================================
  42. $imported = {} if $imported == nil
  43. $imported["A1_Common_Script"] = 4.50
  44. #==============================================================================
  45. # ■ Kernel
  46. #==============================================================================
  47. module Kernel
  48.         #--------------------------------------------------------------------------
  49.         # ○ RGSSのバージョン取得
  50.         #--------------------------------------------------------------------------
  51.         def rgss_version
  52.                 return 3 if defined? Graphics.play_movie
  53.                 return 2 if defined? Graphics.resize_screen
  54.                 return 1
  55.         end
  56.         #--------------------------------------------------------------------------
  57.         # ○ コモンスクリプトのバージョン取得
  58.         #--------------------------------------------------------------------------
  59.         def common_version
  60.                 $imported["A1_Common_Script"]
  61.         end
  62.         #--------------------------------------------------------------------------
  63.         # ○ コモンスクリプトのバージョンが古い
  64.         #--------------------------------------------------------------------------
  65.         def old_common_script(script_name, version)
  66.                 msgbox("#{script_name}にはA1共通スクリプトVer#{version}以上が必要です")
  67.         end
  68. end
  69. #==============================================================================
  70. # ■ A1_System
  71. #==============================================================================
  72. module A1_System
  73. end
  74. #==============================================================================
  75. # ■ A1_System::CommonModule
  76. #==============================================================================

  77. class A1_System::CommonModule
  78.         #--------------------------------------------------------------------------
  79.         # ○ 定数
  80.         #--------------------------------------------------------------------------
  81.         TWOBYTE_LIST = {
  82.                 " " => " ",
  83.                 "=" => "=",
  84.                 ":" => ":"
  85.         }
  86.         #--------------------------------------------------------------------------
  87.         # ○ オブジェクト初期化
  88.         #--------------------------------------------------------------------------
  89.         def initialize
  90.                 define_command
  91.         end
  92.         #--------------------------------------------------------------------------
  93.         # ○ 変換対象の全角文字を半角に置換
  94.         #--------------------------------------------------------------------------
  95.         def replace_twobyte(str)
  96.                 for key in TWOBYTE_LIST.keys
  97.                         str.gsub!(key) {TWOBYTE_LIST[key]}
  98.                 end
  99.                 return str
  100.         end
  101.         #--------------------------------------------------------------------------
  102.         # ○ マイナスが含まれている文字列を数値にする
  103.         #--------------------------------------------------------------------------
  104.         def minus_to_i(s)
  105.                 if s[0,0] == "-"
  106.                         s.gsub!("-","")
  107.                         return s.to_i * -1
  108.                 else
  109.                         return s.to_i
  110.                 end
  111.         end
  112.         #--------------------------------------------------------------------------
  113.         # ○ ミリ秒単位の現在時間
  114.         #--------------------------------------------------------------------------
  115.         def now_usec
  116.                 now = Time.now
  117.                 hour = now.hour * 60 * 60
  118.                 min  = now.min * 60
  119.                 sec  = now.sec
  120.                 msec = (now.usec / 1000.0).round
  121.                 return (hour + min + sec) * 1000 + msec
  122.         end
  123.         #--------------------------------------------------------------------------
  124.         # ○ イベントリストの作成
  125.         #--------------------------------------------------------------------------
  126.         def create_event_list(code, indent, parameters)
  127.                 list = RPG::EventCommand.new
  128.                 list.code       = code
  129.                 list.indent     = indent
  130.                 list.parameters = parameters
  131.                 return list
  132.         end
  133.         #--------------------------------------------------------------------------
  134.         # ○ メソッド呼び出し
  135.         #--------------------------------------------------------------------------
  136.         def send_method(method_name)
  137.                 return send(method_name) if respond_to?(method_name)
  138.         end
  139.         #--------------------------------------------------------------------------
  140.         # ○ オブジェクトの型を判断してStringならエンコード
  141.         #--------------------------------------------------------------------------
  142.         def encoding_string(obj)
  143.                 obj.force_encoding("UTF-8") if obj.is_a?(String)
  144.                 return obj
  145.         end
  146.         #--------------------------------------------------------------------------
  147.         # ○ メモの内容から必要な情報を取得
  148.         #--------------------------------------------------------------------------
  149.         def note_data(note, key)
  150.                 result = []
  151.                 note.each_line {|line|
  152.                         next unless line =~ /<#{key}[ ]?(.*)>/
  153.                         return true if $1.empty?
  154.                         data = $a1_common.replace_twobyte($1).split(" ")
  155.                         for st in data
  156.                                 result.push(st)
  157.                         end
  158.                 }
  159.                 return false if result.empty?
  160.                 return result
  161.         end
  162.         #--------------------------------------------------------------------------
  163.         # ○ メモの内容からハッシュを作成
  164.         #--------------------------------------------------------------------------
  165.         def note_data_hash(note, key, data_default = nil, default = {}, ret = {})
  166.                 list = note_data_split(note, key)
  167.                 return default if list.empty?
  168.                 list.each {|data| ret[data[0]] = data[1] ? data[1] : data_default }
  169.                 return ret
  170.         end
  171.         #--------------------------------------------------------------------------
  172.         # ○ メモの内容からカンマ区切りの多元配列を取得
  173.         #--------------------------------------------------------------------------
  174.         def note_data_split(note, key, default = [], ret = [])
  175.                 data = note_data(note, key)
  176.                 return default unless data.is_a?(Array)
  177.                 data.each {|str| ret.push(convert_integer_from_array(split_array(str)))}
  178.                 return ret
  179.         end
  180.         #--------------------------------------------------------------------------
  181.         # ○ 配列の内容から数値があれば変換
  182.         #--------------------------------------------------------------------------
  183.         def convert_integer_from_array(data, ret = [])
  184.                 data.each {|str| ret.push(convert_integer(str))}
  185.                 return ret
  186.         end
  187.         #--------------------------------------------------------------------------
  188.         # ○ 数値があれば変換
  189.         #--------------------------------------------------------------------------
  190.         def convert_integer(str)
  191.                 return $1.to_i if str =~ /(^[-]?[0-9]+$)/
  192.                 str.is_a?(Array) ? convert_integer_from_array(str) : str
  193.         end
  194.         #--------------------------------------------------------------------------
  195.         # ○ メモの内容から単項目の数値を取得
  196.         #--------------------------------------------------------------------------
  197.         def note_data_one_value(note, key, default)
  198.                 data = note_data(note, key)
  199.                 return data[0].to_i if data.is_a?(Array)
  200.                 return default
  201.         end
  202.         #--------------------------------------------------------------------------
  203.         # ○ メモの内容から単項目を取得
  204.         #--------------------------------------------------------------------------
  205.         def note_data_one(note, key, default)
  206.                 data = note_data(note, key)
  207.                 return data[0] if data.is_a?(Array)
  208.                 return default
  209.         end
  210.         #--------------------------------------------------------------------------
  211.         # ○ メモの内容からカンマ区切りの文字列を取得
  212.         #--------------------------------------------------------------------------
  213.         def note_data_array_str(note, key, default)
  214.                 data = note_data(note, key)
  215.                 return data[0].split(",") if data.is_a?(Array)
  216.                 return default
  217.         end
  218.         #--------------------------------------------------------------------------
  219.         # ○ メモの内容からカンマ区切りの数値を取得
  220.         #--------------------------------------------------------------------------
  221.         def note_data_array_value(note, key, default)
  222.                 data = note_data(note, key)
  223.                 return default unless data.is_a?(Array)
  224.                 return convert_integer_from_array(split_array(data[0]))
  225.         end
  226.         #--------------------------------------------------------------------------
  227.         # ○ カンマ区切りの文字列メモを変換
  228.         #--------------------------------------------------------------------------
  229.         def note_data_array(note, key, type, default = nil, through = true)
  230.                 ret = []
  231.                 default.each {|dat| ret.push(dat)} if default != nil
  232.                
  233.                 data = note_data(note, key)
  234.                 return ret unless data.is_a?(Array)
  235.                
  236.                 data = data[0].split(",")
  237.                 for d in data
  238.                         next if ret.include?(d) if through
  239.                         ret.push(d.to_i) if type.is_a?(Integer)
  240.                         ret.push(d)      if type.is_a?(String)
  241.                 end
  242.                 return ret
  243.         end
  244.         #--------------------------------------------------------------------------
  245.         # ○ ディレクトリの作成
  246.         #--------------------------------------------------------------------------
  247.         def make_directory(dir_name)
  248.                 Dir::mkdir(dir_name) unless FileTest.exist?(dir_name)
  249.         end
  250.         #--------------------------------------------------------------------------
  251.         # ○ コマンドリスト
  252.         #--------------------------------------------------------------------------
  253.         def make_command(command, src = "", dect = "")
  254.                 src.gsub!("/","\\")
  255.                 dect.gsub!("/","\\")
  256.                 cmd = "#{command} \"#{src}\" \"#{dect}\""
  257.                 return cmd
  258.         end
  259.         #--------------------------------------------------------------------------
  260.         # ○ 素材の拡張子を取得
  261.         #--------------------------------------------------------------------------
  262.         def material_ext(directory, file, direct = false)
  263.                 exts = []
  264.                 exts = [".png",".bmp",".jpg"]               if directory =~ /(.*)Graphics\/(.*)/
  265.                 exts = [".mid",".ogg",".wav",".mp3",".wma"] if directory =~ /(.*)Audio(.*)/
  266.                
  267.                 find_file = sprintf("%s%s", directory, file) unless direct
  268.                 find_file = file if direct
  269.                
  270.                 for ext in exts
  271.                         return ext if File.exist?(sprintf("%s%s", find_file, ext))
  272.                 end
  273.                 return nil
  274.         end
  275.         #--------------------------------------------------------------------------
  276.         # ○ 素材が存在するかチェック
  277.         #--------------------------------------------------------------------------
  278.         def material_exist?(directory, file, direct = false)
  279.                 return false if material_ext(directory, file, direct) == nil
  280.                 return true
  281.         end
  282.         #--------------------------------------------------------------------------
  283.         # ○ ファイルコピー
  284.         #--------------------------------------------------------------------------
  285.         def copy_file(src, dest)
  286.                 srcFile = File.open( src, "rb" )
  287.                 dstFile = File.open( dest, "wb" )
  288.                 dstFile.write( srcFile.read )
  289.                 srcFile.close
  290.                 dstFile.close
  291.         end
  292.         #--------------------------------------------------------------------------
  293.         # ○ ファイルの存在を確認してファイルコピー
  294.         #--------------------------------------------------------------------------
  295.         def material_copy(src, dest, directory)
  296.                 ext = material_ext(directory, src, true)
  297.                 copy_file( src + ext, dest + ext ) if ext != nil
  298.         end
  299.         #--------------------------------------------------------------------------
  300.         # ○ 配列からAudioを作成
  301.         #--------------------------------------------------------------------------
  302.         def set_audio(sound, kind)
  303.                 case kind
  304.                 when "BGM"; audio = RPG::BGM.new
  305.                 when "BGS"; audio = RPG::BGS.new
  306.                 when "ME";  audio = RPG::ME.new
  307.                 when "SE";  audio = RPG::SE.new
  308.                 end
  309.                 audio.name   = sound[0]
  310.                 audio.volume = sound[1]
  311.                 audio.pitch  = sound[2]
  312.                 return audio
  313.         end
  314.         #--------------------------------------------------------------------------
  315.         # ○ 既に準拠識別子を持っているかチェック
  316.         #--------------------------------------------------------------------------
  317.         def chk_rtp(file_name, default)
  318.                 return "" if file_name =~ /^VX_.*/
  319.                 return "" if file_name =~ /^XP_.*/
  320.                 return "" if file_name =~ /^2000_.*/
  321.                 return "" if file_name =~ /^2003_.*/
  322.                 return default
  323.         end
  324.         #--------------------------------------------------------------------------
  325.         # ○ 先頭の $ を切り出す
  326.         #--------------------------------------------------------------------------
  327.         def one_character(file_name)
  328.                 return file_name unless file_name[0] == "$"
  329.                 tmp = file_name.clone
  330.                 tmp[0] = ""
  331.                 return tmp
  332.         end
  333.         #--------------------------------------------------------------------------
  334.         # ○ 配列を入れ替える
  335.         #--------------------------------------------------------------------------
  336.         def change_array(array, index1, index2)
  337.                 tmp = array[index1]
  338.                 array[index1] = array[index2]
  339.                 array[index2] = tmp
  340.                 return array
  341.         end
  342.         #--------------------------------------------------------------------------
  343.         # ○ 移動ルートの作成
  344.         #--------------------------------------------------------------------------
  345.         def create_move_route(repeat, skippable, wait, list)
  346.                 move_route = RPG::MoveRoute.new
  347.                 move_route.repeat    = repeat
  348.                 move_route.skippable = skippable
  349.                 move_route.wait      = wait
  350.                 move_route.list      = list
  351.                 return move_route
  352.         end
  353.         #--------------------------------------------------------------------------
  354.         # ○ 移動ルートコマンドの作成
  355.         #--------------------------------------------------------------------------
  356.         def create_move_command(code, parameters)
  357.                 list = RPG::MoveCommand.new
  358.                 list.code       = code
  359.                 list.parameters = parameters
  360.                 return list
  361.         end
  362.         #--------------------------------------------------------------------------
  363.         # ○ インタプリタ起動用リストの作成
  364.         #--------------------------------------------------------------------------
  365.         def create_list(code, indent, parameters)
  366.                 list            = RPG::EventCommand.new
  367.                 list.code       = code
  368.                 list.indent     = indent
  369.                 list.parameters = parameters
  370.                 return list
  371.         end
  372.         #--------------------------------------------------------------------------
  373.         # ○ クラス名の取得
  374.         #--------------------------------------------------------------------------
  375.         def class_name(class_instance)
  376.                 return class_instance.to_s.split(":")[0].gsub("#<","")
  377.         end
  378.         #--------------------------------------------------------------------------
  379.         # ○ 配列を考慮したsplit
  380.         #--------------------------------------------------------------------------
  381.         def split_array(str)
  382.                 str = convert_escape_characters(str)
  383.                
  384.                 ret       = []
  385.                 tmp_array = str.split(",")
  386.                
  387.                 return strip_array_str(tmp_array) unless str.include?("[")
  388.                 tmp_str   = ""
  389.                 tmp_array.each {|s|
  390.                         if char_in_str(s, "[", "]") && tmp_str.empty?
  391.                                 ret.push(s) unless s =~ /^\[/
  392.                                 ret.push([s[1...s.size-1]]) if s =~ /^\[/
  393.                         else
  394.                                 tmp_str = "#{tmp_str}#{s},"
  395.                                 if char_in_str(tmp_str, "[", "]")
  396.                                         unless tmp_str =~ /^\[/
  397.                                                 ret.push(tmp_str[0...tmp_str.size-1])
  398.                                                 tmp_str = ""
  399.                                         else
  400.                                                 tmp_str = tmp_str[1...tmp_str.size-2]
  401.                                                 tmp_str = split_array(tmp_str) if tmp_str.include?("[")
  402.                                                 tmp_str = tmp_str.split(",") if tmp_str.include?(",")
  403.                                                 ret.push(tmp_str)   if tmp_str.is_a?(Array)
  404.                                                 ret.push([tmp_str]) if !tmp_str.is_a?(Array)
  405.                                                 tmp_str = ""
  406.                                         end
  407.                                 end
  408.                         end
  409.                 }
  410.                 return strip_array_str(ret)
  411.         end
  412.         #--------------------------------------------------------------------------
  413.         # ○ 配列の中の文字列の先頭と末尾の空白を除去
  414.         #--------------------------------------------------------------------------
  415.         def strip_array_str(array, ret = [])
  416.                 array.each {|str| ret.push(strip_array_str(str)) if str.is_a?(Array); next if str.is_a?(Array); ret.push(str.strip) }
  417.                 return ret
  418.         end
  419.         #--------------------------------------------------------------------------
  420.         # ○ 文字列の中に文字が何文字含まれているか調べて同数ならtrueを返す
  421.         #--------------------------------------------------------------------------
  422.         def char_in_str(str, c1, c2)
  423.                 num1 = 0
  424.                 num2 = 0
  425.                 (0...str.size).each {|i| num1 += 1 if str[i] == c1; num2 += 1 if str[i] == c2 }
  426.                 return num1 == num2
  427.         end
  428.         #--------------------------------------------------------------------------
  429.         # ○ 制御文字の変換
  430.         #--------------------------------------------------------------------------
  431.         def convert_escape_characters(text)
  432.                 result = text.to_s.clone
  433.                 result.gsub!(/\\/)                           { "\e" }
  434.                 result.gsub!(/\e\e/)                         { "\\" }
  435.                 result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
  436.                 result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
  437.                 result.gsub!(/\eN\[(\d+)\]/i)                { actor_name($1.to_i) }
  438.                 result.gsub!(/\eP\[(\d+)\]/i)                { party_member_name($1.to_i) }
  439.                 result.gsub!(/\eG/i)                         { Vocab::currency_unit }
  440.                 loop { result = result.sub(/<s>(.+?)<\/s>/i) { eval($1) }; break unless $1 }
  441.                 result
  442.         end
  443.         #--------------------------------------------------------------------------
  444.         # ○ アクター n 番の名前を取得
  445.         #--------------------------------------------------------------------------
  446.         def actor_name(n)
  447.                 actor = n >= 1 ? $game_actors[n] : nil
  448.                 actor ? actor.name : ""
  449.         end
  450.         #--------------------------------------------------------------------------
  451.         # ○ パーティメンバー n 番の名前を取得
  452.         #--------------------------------------------------------------------------
  453.         def party_member_name(n)
  454.                 actor = n >= 1 ? $game_party.members[n - 1] : nil
  455.                 actor ? actor.name : ""
  456.         end
  457.         #--------------------------------------------------------------------------
  458.         # ○ 配列を全て整数にする
  459.         #--------------------------------------------------------------------------
  460.         def params_to_i(params)
  461.                 ret = []
  462.                 params.each {|param| ret.push(param.to_i)}
  463.                 return ret
  464.         end
  465.         #--------------------------------------------------------------------------
  466.         # ○ 注釈コマンド定義
  467.         #--------------------------------------------------------------------------
  468.         def define_command
  469.                 @cmd_108 = {}
  470.         end
  471.         #--------------------------------------------------------------------------
  472.         # ○ 注釈コマンド定義取得
  473.         #--------------------------------------------------------------------------
  474.         def cmd_108
  475.                 @cmd_108
  476.         end
  477.         #--------------------------------------------------------------------------
  478.         # ○ フレーム更新
  479.         #--------------------------------------------------------------------------
  480.         def update
  481.         end
  482.         #--------------------------------------------------------------------------
  483.         # ○ 文字の幅と高さを取得
  484.         #--------------------------------------------------------------------------
  485.         def text_size(font, size, text)
  486.                 bitmap = Cache.system("")
  487.                 bitmap.font.name = font
  488.                 bitmap.font.size = size
  489.                 tw = bitmap.text_size(text).width
  490.                 th = bitmap.text_size(text).height
  491.                 bitmap.dispose
  492.                 return [tw, th]
  493.         end
  494.         #--------------------------------------------------------------------------
  495.         # ○ 文字の幅を取得
  496.         #--------------------------------------------------------------------------
  497.         def text_width(font, text)
  498.                 texts = text.split("\n")
  499.                 @max_width = 0
  500.                 texts.each {|text|
  501.                         width = text_size(font.name, font.size, text)[0]
  502.                         @max_width = @max_width < width ? width : @max_width
  503.                 }
  504.                 return @max_width
  505.         end
  506. end
  507. #==============================================================================
  508. # ◆ RGSS3用処理
  509. #==============================================================================
  510. if rgss_version == 3
  511.         #==============================================================================
  512.         # ■ RPG::Tileset
  513.         #==============================================================================
  514.        
  515.         class RPG::Tileset
  516.                 #--------------------------------------------------------------------------
  517.                 # ○ 拡張通行判定
  518.                 #--------------------------------------------------------------------------
  519.                 def ex_flags
  520.                         @ex_flags ||= Table.new(8192)
  521.                         return @ex_flags
  522.                 end
  523.                 #--------------------------------------------------------------------------
  524.                 # ○ 拡張通行判定初期化
  525.                 #--------------------------------------------------------------------------
  526.                 def init_ex_flags
  527.                         @ex_flags = Table.new(8192)
  528.                 end
  529.         end
  530.         #==============================================================================
  531.         # ■ Game_Interpreter
  532.         #------------------------------------------------------------------------------
  533.         #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  534.         # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  535.         #==============================================================================
  536.        
  537.         class Game_Interpreter
  538.                 #--------------------------------------------------------------------------
  539.                 # ☆ オブジェクト初期化
  540.                 #     depth : ネストの深さ
  541.                 #--------------------------------------------------------------------------
  542.                 alias a1_common_gi_rgss3_initialize initialize
  543.                 def initialize(depth = 0, sub_interpreter = false)
  544.                         @sub_interpreter = sub_interpreter
  545.                         a1_common_gi_rgss3_initialize(depth)
  546.                 end
  547.                 #--------------------------------------------------------------------------
  548.                 # ☆ メッセージ表示がビジー状態の間ウェイト
  549.                 #--------------------------------------------------------------------------
  550.                 alias a1_common_gi_wait_for_message wait_for_message
  551.                 def wait_for_message
  552.                         return if @sub_interpreter
  553.                         a1_common_gi_wait_for_message
  554.                 end
  555.         end
  556.         #==============================================================================
  557.         # ■ Window_Message
  558.         #------------------------------------------------------------------------------
  559.         #  文章表示に使うメッセージウィンドウです。
  560.         #==============================================================================
  561.        
  562.         class Window_Message < Window_Base
  563.                 #--------------------------------------------------------------------------
  564.                 # ☆ 通常文字の処理
  565.                 #--------------------------------------------------------------------------
  566.                 alias a1_common_wm_process_normal_character process_normal_character
  567.                 def process_normal_character(c, pos)
  568.                         wait_for_one_character_before
  569.                         a1_common_wm_process_normal_character(c, pos)
  570.                 end
  571.                 #--------------------------------------------------------------------------
  572.                 # ○ 一文字出力前のウェイト
  573.                 #--------------------------------------------------------------------------
  574.                 def wait_for_one_character_before
  575.                 end
  576.         end
  577.         #==============================================================================
  578.         # ■ RPG::Map
  579.         #==============================================================================
  580.        
  581.         class RPG::Map
  582.                 #--------------------------------------------------------------------------
  583.                 # ○ マップチップを調べるか判定する
  584.                 #--------------------------------------------------------------------------
  585.                 def search_map_chip?
  586.                         return true if $a1_common.note_data(self.note, "マップチップサーチ")
  587.                         return false
  588.                 end
  589.         end
  590.         #==============================================================================
  591.         # ■ Game_Map
  592.         #------------------------------------------------------------------------------
  593.         #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  594.         # このクラスのインスタンスは $game_map で参照されます。
  595.         #==============================================================================
  596.        
  597.         class Game_Map
  598.                 #--------------------------------------------------------------------------
  599.                 # ☆ セットアップ
  600.                 #--------------------------------------------------------------------------
  601.                 alias a1_common_gm_setup setup
  602.                 def setup(map_id)
  603.                         a1_common_gm_setup(map_id)
  604.                         setup_tileset
  605.                         map_chip_search if search_map_chip?
  606.                 end
  607.                 #--------------------------------------------------------------------------
  608.                 # ★ タイルセットの取得
  609.                 #--------------------------------------------------------------------------
  610.                 def tileset
  611.                         setup_tileset unless @tileset && @now_tileset_id == @tileset_id
  612.                         return @tileset
  613.                 end
  614.                 #--------------------------------------------------------------------------
  615.                 # ○ タイルセットのセットアップ
  616.                 #--------------------------------------------------------------------------
  617.                 def setup_tileset
  618.                         @tileset        = $data_tilesets[@tileset_id].clone
  619.                         @tileset.flags  = $data_tilesets[@tileset_id].flags.clone
  620.                         @now_tileset_id = @tileset_id
  621.                 end
  622.                 #--------------------------------------------------------------------------
  623.                 # ○ マップチップを調べるか判定する
  624.                 #--------------------------------------------------------------------------
  625.                 def search_map_chip?
  626.                         return @map.search_map_chip?
  627.                 end
  628.                 #--------------------------------------------------------------------------
  629.                 # ○ 指定座標の全レイヤーのフラグ判定(イベント含む)
  630.                 #--------------------------------------------------------------------------
  631.                 def all_tiles_flag?(x, y, bit)
  632.                         all_tiles(x, y).any? {|tile_id| tileset.flags[tile_id] & bit != 0 }
  633.                 end
  634.                 #--------------------------------------------------------------------------
  635.                 # ○ 指定座標の全レイヤーの拡張フラグ判定(イベント含む)
  636.                 #--------------------------------------------------------------------------
  637.                 def all_tiles_flag_ex?(x, y, bit)
  638.                         all_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  639.                 end
  640.                 #--------------------------------------------------------------------------
  641.                 # ○ 指定座標の全レイヤーの拡張フラグ判定
  642.                 #--------------------------------------------------------------------------
  643.                 def layered_tiles_flag_ex?(x, y, bit)
  644.                         layered_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  645.                 end
  646.                 #--------------------------------------------------------------------------
  647.                 # ○ 地形タグの取得(イベント含む)
  648.                 #--------------------------------------------------------------------------
  649.                 def terrain_tag_all_tailes(x, y)
  650.                         return 0 unless valid?(x, y)
  651.                         all_tiles(x, y).each do |tile_id|
  652.                                 tag = tileset.flags[tile_id] >> 12
  653.                                 return tag if tag > 0
  654.                         end
  655.                         return 0
  656.                 end
  657.         end
  658.         #==============================================================================
  659.         # ■ DataManager
  660.         #------------------------------------------------------------------------------
  661.         #  データベースとゲームオブジェクトを管理するモジュールです。ゲームで使用する
  662.         # ほぼ全てのグローバル変数はこのモジュールで初期化されます。
  663.         #==============================================================================
  664.        
  665.         module DataManager
  666.                 #--------------------------------------------------------------------------
  667.                 # ○ エイリアス用特異メソッド
  668.                 #--------------------------------------------------------------------------
  669.                 class << self
  670.                         alias :a1_common_create_game_objects :create_game_objects
  671.                 end
  672.                 #--------------------------------------------------------------------------
  673.                 # ☆ 各種ゲームオブジェクトの作成
  674.                 #--------------------------------------------------------------------------
  675.                 def self.create_game_objects
  676.                         $a1_common ||= A1_System::CommonModule.new
  677.                         a1_common_create_game_objects
  678.                 end
  679.         end
  680.         #==============================================================================
  681.         # ■ Scene_Base
  682.         #------------------------------------------------------------------------------
  683.         #  ゲーム中の全てのシーンのスーパークラスです。
  684.         #==============================================================================
  685.        
  686.         class Scene_Base
  687.                 #--------------------------------------------------------------------------
  688.                 # ☆ フレーム更新(基本)
  689.                 #--------------------------------------------------------------------------
  690.                 alias a1_common_sb_update_basic update_basic
  691.                 def update_basic
  692.                         a1_common_sb_update_basic
  693.                         $a1_common.update
  694.                 end
  695.                 #--------------------------------------------------------------------------
  696.                 # ○ 指定のウィンドウが開いている間ウェイト
  697.                 #--------------------------------------------------------------------------
  698.                 def wait_for_window_open(window)
  699.                         update_basic until window.openness == 0
  700.                 end
  701.         end
  702.         #==============================================================================
  703.         # ■ Window_Base
  704.         #------------------------------------------------------------------------------
  705.         #  ゲーム中の全てのウィンドウのスーパークラスです。
  706.         #==============================================================================
  707.        
  708.         class Window_Base < Window
  709.                 #--------------------------------------------------------------------------
  710.                 # ★ 制御文字の事前変換
  711.                 #    実際の描画を始める前に、原則として文字列に変わるものだけを置き換える。
  712.                 #    文字「\」はエスケープ文字(\e)に変換。
  713.                 #--------------------------------------------------------------------------
  714.                 def convert_escape_characters(text)
  715.                         return $a1_common.convert_escape_characters(text)
  716.                 end
  717.         end
  718.         #==============================================================================
  719.         # ◆ RGSS2用処理
  720.         #==============================================================================
  721. elsif rgss_version == 2
  722.         #==============================================================================
  723.         # ■ Window
  724.         #==============================================================================
  725.        
  726.         class Window
  727.                 #--------------------------------------------------------------------------
  728.                 # ○ ウィンドウが開いている?
  729.                 #--------------------------------------------------------------------------
  730.                 def open?
  731.                         return self.openness == 255
  732.                 end
  733.                 #--------------------------------------------------------------------------
  734.                 # ○ ウィンドウが閉じている?
  735.                 #--------------------------------------------------------------------------
  736.                 def close?
  737.                         return self.openness == 0
  738.                 end
  739.         end
  740.         #==============================================================================
  741.         # ■ Cache
  742.         #------------------------------------------------------------------------------
  743.         #  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
  744.         # です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
  745.         # のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
  746.         # を返すようになっています。
  747.         #==============================================================================
  748.        
  749.         module Cache
  750.                 #--------------------------------------------------------------------------
  751.                 # ○ キャッシュ存在チェック
  752.                 #--------------------------------------------------------------------------
  753.                 def self.include?(key)
  754.                         @cache[key] && !@cache[key].disposed?
  755.                 end
  756.         end
  757.         #==============================================================================
  758.         # ■ Game_Interpreter
  759.         #------------------------------------------------------------------------------
  760.         #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  761.         # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  762.         #==============================================================================
  763.        
  764.         class Game_Interpreter
  765.                 #--------------------------------------------------------------------------
  766.                 # ○ 注釈
  767.                 #--------------------------------------------------------------------------
  768.                 def command_108
  769.                         @comments = [@params[0]]
  770.                         while next_event_code == 408
  771.                                 @index += 1
  772.                                 @comments.push(@list[@index].parameters[0])
  773.                         end
  774.                 end
  775.                 #--------------------------------------------------------------------------
  776.                 # ★ イベントコマンドの実行
  777.                 #--------------------------------------------------------------------------
  778.                 def execute_command
  779.                         return rgss3_execute_command unless @index >= @list.size-1
  780.                         command_end
  781.                         return true
  782.                 end
  783.                 #--------------------------------------------------------------------------
  784.                 # ○ RGSS3風「イベントコマンドの実行」
  785.                 #--------------------------------------------------------------------------
  786.                 def rgss3_execute_command
  787.                         command = @list[@index]
  788.                         @params = command.parameters
  789.                         @indent = command.indent
  790.                         method_name = "command_#{command.code}"
  791.                         send(method_name) if respond_to?(method_name)
  792.                 end
  793.                 #--------------------------------------------------------------------------
  794.                 # ○ 次のイベントコマンドのコードを取得
  795.                 #--------------------------------------------------------------------------
  796.                 def next_event_code
  797.                         @list[@index + 1].code
  798.                 end
  799.         end
  800.         #==============================================================================
  801.         # ■ Game_Map
  802.         #------------------------------------------------------------------------------
  803.         #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  804.         # このクラスのインスタンスは $game_map で参照されます。
  805.         #==============================================================================
  806.        
  807.         class Game_Map
  808.                 #--------------------------------------------------------------------------
  809.                 # ○ マップチップを調べるか判定する
  810.                 #--------------------------------------------------------------------------
  811.                 def search_map_chip?
  812.                         return $data_map_infos[@map_id].name =~ /\[サーチ\]/
  813.                 end
  814.                 #--------------------------------------------------------------------------
  815.                 # ○ 指定座標に存在するタイル扱いイベント(すり抜け以外)の配列取得
  816.                 #--------------------------------------------------------------------------
  817.                 def tile_events_xy(x, y)
  818.                         @tile_events.select {|event| event.pos_nt?(x, y) }
  819.                 end
  820.                 #--------------------------------------------------------------------------
  821.                 # ○ タイル扱いイベントの配列をリフレッシュ
  822.                 #--------------------------------------------------------------------------
  823.                 def refresh_tile_events
  824.                         @tile_events = @events.values.select {|event| event.tile? }
  825.                 end
  826.         end
  827.         #==============================================================================
  828.         # ■ Game_Character
  829.         #------------------------------------------------------------------------------
  830.         #  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
  831.         # クラスのスーパークラスとして使用されます。
  832.         #==============================================================================
  833.        
  834.         class Game_Character
  835.                 #--------------------------------------------------------------------------
  836.                 # ○ タイル判定
  837.                 #--------------------------------------------------------------------------
  838.                 def tile?
  839.                         @tile_id > 0 && @priority_type == 0
  840.                 end
  841.         end
  842.         #==============================================================================
  843.         # ■ Scene_Title
  844.         #------------------------------------------------------------------------------
  845.         #  タイトル画面の処理を行うクラスです。
  846.         #==============================================================================
  847.        
  848.         class Scene_Title < Scene_Base
  849.                 #--------------------------------------------------------------------------
  850.                 # ☆ データベースのロード
  851.                 #--------------------------------------------------------------------------
  852.                 alias a1_common_st_load_database load_database
  853.                 def load_database
  854.                         a1_common_st_load_database
  855.                         $data_map_infos = load_data("Data/MapInfos.rvdata")
  856.                 end
  857.                 #--------------------------------------------------------------------------
  858.                 # ☆ 各種ゲームオブジェクトの作成
  859.                 #--------------------------------------------------------------------------
  860.                 alias a1_common_st_create_game_objects create_game_objects
  861.                 def create_game_objects
  862.                         $a1_common ||= A1_System::CommonModule.new
  863.                         a1_common_st_create_game_objects
  864.                 end
  865.         end
  866.         #==============================================================================
  867.         # ◆ RGSS用処理
  868.         #==============================================================================
  869. elsif rgss_version == 1
  870. end
  871. #==============================================================================
  872. # ■ Cache
  873. #------------------------------------------------------------------------------
  874. #  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
  875. # です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
  876. # のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
  877. # を返すようになっています。
  878. #==============================================================================

  879. module Cache
  880.         #--------------------------------------------------------------------------
  881.         # ○ 拡大縮小したビットマップのロード
  882.         #--------------------------------------------------------------------------
  883.         def self.load_resize_bitmap(load_path, key, resize = nil)
  884.                 @cache ||= {}
  885.                 key = load_path if key == nil
  886.                 return @cache[key] if include?(key)
  887.                
  888.                 @cache[key] = Bitmap.new(load_path)
  889.                 return @cache[key] if resize == nil
  890.                 return @cache[key] if @cache[key].width == resize[0] and @cache[key].height == resize[1]
  891.                
  892.                 info = calc_size(resize, key)
  893.                 return resize_bitmap(@cache[key], info[0], info[1], key)
  894.         end
  895.         #--------------------------------------------------------------------------
  896.         # ○ 拡大縮小した色相変化済みビットマップを作成/取得
  897.         #--------------------------------------------------------------------------
  898.         def self.load_resize_hue_changed_bitmap(load_path, path, hue, resize)
  899.                 key = [path, hue]
  900.                 return @cache[key] if include?(key)
  901.                
  902.                 @cache[key] = load_resize_bitmap(load_path, path, resize).clone
  903.                 @cache[key].hue_change(hue)
  904.                 return @cache[key]
  905.         end
  906.         #--------------------------------------------------------------------------
  907.         # ○ リサイズするサイズを取得
  908.         #--------------------------------------------------------------------------
  909.         def self.calc_size(resize, key)
  910.                 width  = resize[0]
  911.                 width  = @cache[key].width * width.abs if width < 0
  912.                 height = resize[1]
  913.                 height = @cache[key].height * height.abs if height < 0
  914.                 height = Integer(@cache[key].height * (width.to_f / @cache[key].width.to_f)) if height == 0
  915.                 return [width, height]
  916.         end
  917.         #--------------------------------------------------------------------------
  918.         # ○ ビットマップの拡大縮小
  919.         #--------------------------------------------------------------------------
  920.         def self.resize_bitmap(bitmap, width, height, key)
  921.                 resize = Bitmap.new(width, height)
  922.                 resize.stretch_blt(resize.rect, bitmap, bitmap.rect)
  923.                 @cache[key] = resize
  924.                 return resize
  925.         end
  926.         #--------------------------------------------------------------------------
  927.         # ○ テキストビットマップの取得
  928.         #--------------------------------------------------------------------------
  929.         def self.text_picture(text, font)
  930.                 load_text_bitmap(text, font)
  931.         end
  932.         #--------------------------------------------------------------------------
  933.         # ○ フォントのキーを作成
  934.         #--------------------------------------------------------------------------
  935.         def self.make_font_key(text, font)
  936.                 [text, font.name, font.size, font.bold, font.italic, font.outline, font.shadow, font.color.to_s, font.out_color.to_s]
  937.         end
  938.         #--------------------------------------------------------------------------
  939.         # ○ テキストビットマップの作成
  940.         #--------------------------------------------------------------------------
  941.         def self.load_text_bitmap(text, font)
  942.                 @cache ||= {}
  943.                 key = make_font_key(text, font)
  944.                 return @cache[key] if include?(key)
  945.                
  946.                 # 計算用ダミービットマップ
  947.                 bitmap = Cache.system("")
  948.                 bitmap.font = font
  949.                 tw = bitmap.text_size(text).width + 8
  950.                
  951.                 # ビットマップ作成
  952.                 bitmap = Bitmap.new(tw, bitmap.font.size + 4)
  953.                 bitmap.font = font
  954.                 bitmap.draw_text(0, 0, bitmap.width, bitmap.height, text, 1)
  955.                
  956.                 @cache[key] = bitmap
  957.                 return @cache[key]
  958.         end
  959. end
  960. #==============================================================================
  961. # ■ Game_Interpreter
  962. #------------------------------------------------------------------------------
  963. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  964. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  965. #==============================================================================

  966. class Game_Interpreter
  967.         #--------------------------------------------------------------------------
  968.         # ○ 注釈
  969.         #--------------------------------------------------------------------------
  970.         alias a1_common_command_108 command_108
  971.         def command_108
  972.                 a1_common_command_108
  973.                 proc_comment(@comments)
  974.         end
  975.         #--------------------------------------------------------------------------
  976.         # ○ 注釈の処理
  977.         #--------------------------------------------------------------------------
  978.         def proc_comment(comments)
  979.                 param = ""
  980.                 comments.each {|comment| param += comment }
  981.                 params = param.sub(/^(\S+)/, "")
  982.                 command = $1
  983.                 comment_parameters = $a1_common.split_array(params) if params
  984.                 proc_comment_command(command, comment_parameters)
  985.         end
  986.         #--------------------------------------------------------------------------
  987.         # ○ 注釈の実行
  988.         #--------------------------------------------------------------------------
  989.         def proc_comment_command(command, params)
  990.                 cmd_108 = $a1_common.cmd_108[command]
  991.                 method(cmd_108).call(params) if cmd_108 != nil
  992.         end
  993.         #--------------------------------------------------------------------------
  994.         # ○ 前のイベントコマンドを取得
  995.         #--------------------------------------------------------------------------
  996.         def prev_event
  997.                 @list[@index - 1]
  998.         end
  999. end
  1000. #==============================================================================
  1001. # ■ Game_Map
  1002. #------------------------------------------------------------------------------
  1003. #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  1004. # このクラスのインスタンスは $game_map で参照されます。
  1005. #==============================================================================

  1006. class Game_Map
  1007.         #--------------------------------------------------------------------------
  1008.         # ○ 全マップチップを調べる
  1009.         #--------------------------------------------------------------------------
  1010.         def map_chip_search
  1011.                 tileset.init_ex_flags
  1012.                 ([email protected]).each {|x| map_chip_search_y(x) }
  1013.         end
  1014.         #--------------------------------------------------------------------------
  1015.         # ○ x座標にあるy座標のマップチップを調べる
  1016.         #--------------------------------------------------------------------------
  1017.         def map_chip_search_y(x)
  1018.                 ([email protected]).each {|y| map_pos_proc(x, y); map_chip_search_z(x, y) }
  1019.         end
  1020.         #--------------------------------------------------------------------------
  1021.         # ○ x,y座標にあるz座標のマップチップを調べる
  1022.         #--------------------------------------------------------------------------
  1023.         def map_chip_search_z(x, y)
  1024.                 ([email protected]).each {|z| map_chip_proc(x, y, z) }
  1025.                 tile_events_xy(x, y).collect {|ev| tile_event_proc(ev.tile_id) }
  1026.         end
  1027.         #--------------------------------------------------------------------------
  1028.         # ○ 座標に対して処理を行う
  1029.         #--------------------------------------------------------------------------
  1030.         def map_pos_proc(x, y)
  1031.         end
  1032.         #--------------------------------------------------------------------------
  1033.         # ○ マップチップに対して処理を行う
  1034.         #--------------------------------------------------------------------------
  1035.         def map_chip_proc(x, y, z)
  1036.         end
  1037.         #--------------------------------------------------------------------------
  1038.         # ○ タイルのイベントに対して処理を行う
  1039.         #--------------------------------------------------------------------------
  1040.         def tile_event_proc(tile_id)
  1041.         end
  1042. end
  1043. #==============================================================================
  1044. # ■ Window_Base
  1045. #------------------------------------------------------------------------------
  1046. #  ゲーム中の全てのウィンドウのスーパークラスです。
  1047. #==============================================================================

  1048. class Window_Base < Window
  1049.         #--------------------------------------------------------------------------
  1050.         # ○ 入力を受け付けるか?
  1051.         #--------------------------------------------------------------------------
  1052.         def can_input?
  1053.                 @can_input
  1054.         end
  1055.         #--------------------------------------------------------------------------
  1056.         # ○ 入力受け付け設定
  1057.         #--------------------------------------------------------------------------
  1058.         def can_input=(flag)
  1059.                 @can_input = flag
  1060.         end
  1061. end
  1062. #==============================================================================
  1063. # ■ Bitmap
  1064. #==============================================================================

  1065. class Bitmap
  1066.         #--------------------------------------------------------------------------
  1067.         # ○ 文字縁取り描画
  1068.         #--------------------------------------------------------------------------
  1069.         def draw_text_f(x, y, width, height, str, align = 0, color = Color.new(64,32,128))
  1070.                 shadow = self.font.shadow
  1071.                 b_color = self.font.color.dup
  1072.                 font.shadow = false
  1073.                 font.color = color
  1074.                 draw_text(x + 1, y, width, height, str, align)
  1075.                 draw_text(x - 1, y, width, height, str, align)
  1076.                 draw_text(x, y + 1, width, height, str, align)
  1077.                 draw_text(x, y - 1, width, height, str, align)
  1078.                 font.color = b_color
  1079.                 draw_text(x, y, width, height, str, align)
  1080.                 font.shadow = shadow
  1081.         end
  1082.         #--------------------------------------------------------------------------
  1083.         # ○ 文字縁取り描画の矩形を取得
  1084.         #--------------------------------------------------------------------------
  1085.         def draw_text_f_rect(r, str, align = 0, color = Color.new(64,32,128))
  1086.                 draw_text_f(r.x, r.y, r.width, r.height, str, align = 0, color)
  1087.         end
  1088. end

复制代码
拡張選択肢

  1. #===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    拡張選択肢(RGSS3)
  4. #
  5. # バージョン   : 1.10 (2012/01/02)
  6. # 作者         : A1
  7. # URL     : http://a1tktk.web.fc2.com/
  8. #---------------------------------------------------------------------------
  9. # 機能:
  10. # ・多くの選択項目を表示する選択肢です
  11. #---------------------------------------------------------------------------
  12. # 更新履歴   :2011/12/15 Ver1.00 リリース
  13. #            :2012/01/01 Ver1.01 キャンセル時の不具合を修正
  14. #            :2012/01/02 Ver1.10 A1共通スクリプトVer3.30対応
  15. #            :2012/01/09 Ver1.20 表示位置指定機能追加
  16. #            :2012/01/09 Ver1.20 拡張選択肢の選択肢に配列対応
  17. #---------------------------------------------------------------------------
  18. # 設置場所      
  19. #  A1共通スクリプトより下
  20. #
  21. # 必要スクリプト
  22. #    A1共通スクリプト
  23. #---------------------------------------------------------------------------
  24. # 使い方
  25. # イベントコマンド「注釈」に記述
  26. #
  27. #   拡張選択肢 c,v,s1,s2,s3…
  28. #   拡張選択肢 c,v,[s1,s2,s3…],x,y
  29. #              c:キャンセル時に選択されるIndex
  30. #              v:選択した結果が格納される変数番号
  31. #              s:選択肢文字列
  32. #               x:選択肢ウィンドウの表示x座標
  33. #                  左・中・右 もしくは 数値で記述
  34. #               y:選択肢ウィンドウの表示y座標
  35. #                  上・中・下 もしくは 数値で記述
  36. #
  37. #               変数番号を省略した場合でも
  38. #               $game_message.choice_index に結果が格納されます
  39. #
  40. #               キャンセル時に選択されるIndexを -1 にすると
  41. #               キャンセル無効になります
  42. #
  43. #    拡張選択肢の選択肢に配列対応
  44. #    [ ] で囲んだ文字列が選択肢になります
  45. #
  46. #    表示位置指定機能は、選択肢を配列にすることで有効になります
  47. #
  48. #    当スクリプト実行直後に文章コマンドが存在すると
  49. #    文章コマンドを先に実行して、拡張選択肢を表示します
  50. #==============================================================================
  51. $imported ||= {}
  52. $imported["A1_ExChoice"] = true
  53. if $imported["A1_Common_Script"]
  54. old_common_script("拡張選択肢", "3.30") if common_version < 3.30
  55. #==============================================================================
  56. # ■ Game_Message
  57. #------------------------------------------------------------------------------
  58. #  文章や選択肢などを表示するメッセージウィンドウの状態を扱うクラスです。この
  59. # クラスのインスタンスは $game_message で参照されます。
  60. #==============================================================================

  61. class Game_Message
  62.   #--------------------------------------------------------------------------
  63.   # ○ 公開インスタンス変数
  64.   #--------------------------------------------------------------------------
  65.   attr_accessor :choice_index             # 選択肢のIndex
  66.   attr_accessor :choice_cancel            # 選択肢のキャンセル
  67.   attr_accessor :choice_x                 # 選択肢のx座標
  68.   attr_accessor :choice_y                 # 選択肢のy座標
  69.   #--------------------------------------------------------------------------
  70.   # ☆ クリア
  71.   #--------------------------------------------------------------------------
  72.   alias a1_ex_choice_mg_initialize initialize
  73.   def initialize
  74.     a1_ex_choice_mg_initialize
  75.     @choice_index  = -1
  76.     @choice_cancel = false
  77.     @choice_x      = nil
  78.     @choice_y      = nil
  79.   end
  80. end
  81. #==============================================================================
  82. # ■ Window_ChoiceList
  83. #------------------------------------------------------------------------------
  84. #  イベントコマンド[選択肢の表示]に使用するウィンドウです。
  85. #==============================================================================

  86. class Window_ChoiceList < Window_Command
  87.   #--------------------------------------------------------------------------
  88.   # ☆ ウィンドウ位置の更新
  89.   #--------------------------------------------------------------------------
  90.   alias a1_ex_choice_wc_update_placement update_placement
  91.   def update_placement
  92.     a1_ex_choice_wc_update_placement
  93.     setup_x
  94.     setup_y
  95.     fit_height
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ○ x座標のセットアップ
  99.   #--------------------------------------------------------------------------
  100.   def setup_x
  101.     return if !$game_message.choice_x || $game_message.choice_x.empty?
  102.     return self.x = 0 if $game_message.choice_x == "左"
  103.     return self.x = (Graphics.width - self.width) / 2 if $game_message.choice_x == "中"
  104.     return if $game_message.choice_x == "右"
  105.     self.x = $game_message.choice_x.to_i
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ○ y座標のセットアップ
  109.   #--------------------------------------------------------------------------
  110.   def setup_y
  111.     return if !$game_message.choice_y || $game_message.choice_y.empty?
  112.     return self.y = 0 if $game_message.choice_x == "上"
  113.     return self.y = (Graphics.height - self.height) / 2 if $game_message.choice_y == "中"
  114.     return self.y = Graphics.height - self.height if $game_message.choice_y == "下"
  115.     self.y = $game_message.choice_y.to_i
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ○ 高さの調整
  119.   #--------------------------------------------------------------------------
  120.   def fit_height
  121.     if self.y < 0
  122.       self.y = 0
  123.       self.height = Graphics.height - @message_window.height
  124.     end
  125.     if self.y + self.height > Graphics.height
  126.       self.height = Graphics.height - self.y
  127.     end
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ☆ 決定ハンドラの呼び出し
  131.   #--------------------------------------------------------------------------
  132.   alias a1_ex_choice_wc_call_ok_handler call_ok_handler
  133.   def call_ok_handler
  134.     $game_message.choice_cancel = false
  135.     $game_message.choice_index = index
  136.     a1_ex_choice_wc_call_ok_handler
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ☆ キャンセルハンドラの呼び出し
  140.   #--------------------------------------------------------------------------
  141.   alias a1_ex_choice_wc_call_cancel_handler call_cancel_handler
  142.   def call_cancel_handler
  143.     $game_message.choice_cancel = true
  144.     a1_ex_choice_wc_call_cancel_handler
  145.   end
  146. end
  147. #==============================================================================
  148. # ■ A1_System::CommonModule
  149. #==============================================================================

  150. class A1_System::CommonModule
  151.   #--------------------------------------------------------------------------
  152.   # ☆ 注釈コマンド定義
  153.   #--------------------------------------------------------------------------
  154.   alias a1_ex_choice_define_command define_command
  155.   def define_command
  156.     a1_ex_choice_define_command
  157.     @cmd_108["拡張選択肢"] = :a1_ex_choice
  158.   end
  159. end
  160. #==============================================================================
  161. # ■ Game_Interpreter
  162. #------------------------------------------------------------------------------
  163. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  164. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  165. #==============================================================================

  166. class Game_Interpreter
  167.   
  168.   #--------------------------------------------------------------------------
  169.   # ○ 拡張選択肢付き文章の表示
  170.   #--------------------------------------------------------------------------
  171.   def ex_choice_with_message(choice_param, cancel_index)
  172.     wait_for_message
  173.     @index += 1
  174.     params = @list[@index].parameters
  175.     $game_message.face_name = params[0]
  176.     $game_message.face_index = params[1]
  177.     $game_message.background = params[2]
  178.     $game_message.position = params[3]
  179.     while next_event_code == 401       # 文章データ
  180.       @index += 1
  181.       $game_message.add(@list[@index].parameters[0])
  182.     end
  183.     ex_choice(choice_param, cancel_index)
  184.     wait_for_message
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ○ 拡張選択肢の処理
  188.   #--------------------------------------------------------------------------
  189.   def ex_choice(choice_param, cancel_index)
  190.     setup_choices([choice_param, cancel_index])
  191.     Fiber.yield while $game_message.choice?
  192.     unless @variable_no.empty?
  193.       return $game_variables[@variable_no.to_i] = $game_message.choice_index unless $game_message.choice_cancel
  194.       $game_variables[@variable_no.to_i] = cancel_index - 1
  195.     end
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ○ 拡張選択肢
  199.   #--------------------------------------------------------------------------
  200.   def a1_ex_choice(params)
  201.     cancel_index = params[0].to_i + 1
  202.     params.delete_at(0)
  203.     @variable_no = params[0]
  204.     params.delete_at(0)
  205.     return setup_choice_param(cancel_index, params) unless params[0].is_a?(Array)
  206.     $game_message.choice_x = params[1]
  207.     $game_message.choice_y = params[2]
  208.     setup_choice_param(cancel_index, params[0])
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ○ 選択肢のセットアップ
  212.   #--------------------------------------------------------------------------
  213.   def setup_choice_param(cancel_index, params)
  214.     choice_param = params
  215.     choice_param = $a1_common.send_method($1) if params[0] =~ /@m\((.+)\)/
  216.     return ex_choice_with_message(choice_param, cancel_index) if next_event_code == 101
  217.     ex_choice(choice_param, cancel_index)
  218.   end
  219. end
  220. end

复制代码
使用方法
編輯中
# 事件指令「注釈」 埴上以下指令
#  格式
#   拡張選択肢 c,v,s1,s2,s3…(1.1前的格式)
#   拡張選択肢 c,v,[s1,s2,s3…],x,y    (1.2的格式)
#              c:取消選択時的Index  0:可取消 -1:不可取消
#              v:儲存選択結果変数番号  選第一个返回0,選第二个返回1………
#              s:選択肢文字列  例[s1,s2,s3,S4]
#               x:選択肢窗口的x座標
#                 数値 左・中・右
#               y:選択肢窗口的y座標
#                  数値上・中・下  
#
#               変数番号省略時
#               結果儲存在$game_message.choice_index
#
#              
上圖的例子
就是在註譯中填上
拡張選択肢 0,1,[大道寺,柿崎,上杉,004,005],左,下
之後根据変量1做出不同作法

点评

日文?不懂!给只范例~给你最佳?怎么样?(这样好像有威胁人的感觉- -语文没学好就是不好- -)  发表于 2012-4-11 19:10
经常带来国外的脚本,很不错啊……  发表于 2012-4-11 08:50
求脚本~  发表于 2012-4-10 23:31
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
152 小时
注册时间
2012-1-12
帖子
456
7
 楼主| 发表于 2012-4-11 19:06:29 | 只看该作者
布兰度西特 发表于 2012-4-10 22:44
最简单的是把第4个选项设置成下一页,虽然不能同时出现,但能实现超多项选择。 ...

下一页我知道,只不过我是要制作选择人物的选项,下一页上一页的不美观~


‘‘──tang19990919于2012-4-11 19:10补充以下内容

日文?不懂!给只范例~给你最佳?怎么样?(这样好像有威胁人的感觉- -语文没学好就是不好- -)
’’

点评

使用方法不就在帖的下方麼 把二個脚本貼上去  发表于 2012-4-11 19:36
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
22017
在线时间
8574 小时
注册时间
2011-12-31
帖子
3362
8
发表于 2012-4-11 20:08:46 | 只看该作者

没有RGSS300.DLL
打開範例後先儲存才可運行


‘‘──tseyik于2012-4-11 20:11补充以下内容

(拡張選択肢)改了(choice)
’’

Project9.rar

315.79 KB, 下载次数: 1004

回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
439
在线时间
23 小时
注册时间
2012-4-2
帖子
4
9
发表于 2012-4-12 21:25:08 | 只看该作者
为什么不设定一个下一页呢,我也不懂脚本。能用事件就用事件解决呗
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
152 小时
注册时间
2012-1-12
帖子
456
10
 楼主| 发表于 2012-4-19 02:46:28 | 只看该作者
呼叫@tseyik!
脚本出问题了!
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 03:50

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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