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

Project1

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

[有事请教] 如何新增控制碼 改變數組文字顏色與顯示圖標 求腳本修改

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1264
在线时间
301 小时
注册时间
2023-6-6
帖子
22
跳转到指定楼层
1
发表于 2023-7-18 01:16:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
100星屑
本帖最后由 xuprmpau 于 2023-7-20 01:04 编辑

首先此腳本功能請看
http://ytomy.sakura.ne.jp/tkool/rpgtech/php/tech.php?tool=XP&cat=tech_xp/menu&tech=outline#USAGE

接著想求 如何在此腳本的數組文字
新增兩項功能   
1.
如果寫\\C[N]文字
則文字會像內建的改變文字顏色一樣去改變顏色
2.
如果寫\\I[檔名]則顯示Icons資料夾裡相對應檔名的圖標圖案

以下腳本

RUBY 代码复制
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ あらすじ - KGC_Outline ◆
  3. #_/    ◇ Last update : 2007/05/28 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  あらすじを閲覧する機能を追加します。
  6. #_/  Provides the function to show "Outline".
  7. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  8.  
  9. #==============================================================================
  10. # ★ カスタマイズ項目 - Customize ★
  11. #==============================================================================
  12.  
  13. module KGC
  14.   # ◆あらすじ画面背景透過
  15.   OLINE_BACK_TRANSPARENT = true
  16.   # ◆スクロール速度【単位:px】
  17.   OLINE_SCROLL_SPEED = 8
  18.  
  19.   # ◆通し番号を描画
  20.   OLINE_SERIAL_NUMBER = false
  21.   # ◆通し番号の桁数
  22.   OLINE_SERIAL_NUMBER_DIGITS = 3
  23.  
  24.   # ◆無効なあらすじのタイトル
  25.   OLINE_DISABLED_TITLE = "- - - - - - - -"
  26.   # ◆無効なあらすじは表示しない
  27.   OLINE_HIDE_DISABLED  = true
  28.  
  29.   # ◆完了記号
  30.   OLINE_COMPLETION_SYMBOL   = "★"
  31.   # ◆未完記号
  32.   OLINE_INCOMPLETION_SYMBOL = " "
  33.  
  34.   # ◆あらすじ内容
  35.   #  ≪["タイトル", ["本文", ...]], ...≫
  36.   #  本文は、配列の各要素が1行に相当。
  37.   #    **** 制御コマンド ****
  38.   #  \\V[n]  : 変数 ID:n
  39.   #  \\G     : 所持金
  40.   #  \\N[n]  : ID:n のアクター名
  41.   #  \\EN[n] : ID:n のエネミー名
  42.   #  \\IN[n] : ID:n のアイテム名
  43.   #  \\WN[n] : ID:n の武器名
  44.   #  \\AN[n] : ID:n の防具名
  45.   OLINE_CONTENTS = [
  46.     ["操作方法",  # No.0
  47.       ["遊戲基本操作:",
  48.       "ENTER、SPACE、C鍵:確認/調查/對話    ",
  49.       "ESC、X鍵   :取消/呼叫選單",
  50.       "↑↓←→     :方向移動",
  51.       "同時按下ALT+ENTER鍵:切換全螢幕/視窗畫面",]],
  52.     ["魔法屬性",  # No.1
  53.       ["突然見知らぬ場所へ飛ばされてしまった。",
  54.       "ここは一体どこなのだろうか?",
  55.       "",
  56.       "……むぅ。",
  57.       "ここで腐っていても仕方が無いので、とりあえず周囲の",
  58.       "探索をすることになってしまったらしい。",
  59.       "はぁ、めんどくさ(´・ω・`)",
  60.       "早く帰って風呂入って寝てぇ。",
  61.       "",
  62.       "\\N[2]「\\N[1]、真面目に書け。」",
  63.       "",
  64.       "\\N[2]…、見てたの?",
  65.       "",
  66.       "\\N[2]「当たり前だ。」",
  67.       "",
  68.       "いや、てか何でお前も書いてるんだ?",
  69.       "今日は俺の当番 うわなにをするやめ(ry",
  70.       "",
  71.       "\\N[2]「まったく、お前に任せるとロクなことを書かないな。",
  72.       "明日からお前抜きで書かせて貰うぞ。」",
  73.       "",
  74.       "そ、そりゃちっとヒドイんではないかい?",
  75.       "",
  76.       "\\N[2]「反省したか?」",
  77.       "",
  78.       "うぐ…、すいません。"]],
  79.      ["狀態一覽表",  # No.0
  80.       ["行動狀態:",
  81.       "ENTER、SPACE、C鍵:確認/調查/對話    ",
  82.       "ESC、X鍵:  取消/呼叫選單",
  83.       "↑↓←→:  方向移動",
  84.       "同時按下ALT+ENTER鍵: 切換全螢幕/視窗畫面",]]
  85.   ]  # -- Don't delete this line! --
  86. end
  87.  
  88. #### OLINE_BACK_TRANSPARENT
  89. ### Makes the background of "Outline" transparency.
  90.  
  91. #### OLINE_SCROLL_SPEED
  92. ### Scroll speed. {Unit : pixel}
  93.  
  94. #### OLINE_SERIAL_NUMBER
  95. ### Draws the serial number.
  96.  
  97. #### OLINE_SERIAL_NUMBER_DIGITS
  98. ### Digits of the serial number.
  99.  
  100. #### OLINE_HIDE_DISABLED
  101. ### Hides disabled "Outline".
  102.  
  103. #### OLINE_COMPLETION_SYMBOL
  104. ### Completion symbol.
  105.  
  106. #### OLINE_INCOMPLETION_SYMBOL
  107. ### Incompletion symbol.
  108.  
  109.  
  110. #### OLINE_CONTENTS
  111. ### Contents of "Outline".
  112. #  << ["Title", ["Body", ...]], ... >>
  113. #  In the "Body", each element of the array corresponds to one line.
  114. #    **** Control statement ****
  115. #  \\V[n]  : Variable of ID:n
  116. #  \\G     : Money
  117. #  \\N[n]  : Actor's name of ID:n
  118. #  \\EN[n] : Enemies' name of ID:n
  119. #  \\IN[n] : Item's name of ID:n
  120. #  \\WN[n] : Weapon's name of ID:n
  121. #  \\AN[n] : Armor's name of ID:n
  122.  
  123. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  124.  
  125. $imported = {} if $imported == nil
  126. $imported["Outline"] = true
  127.  
  128. #--------------------------------------------------------------------------
  129. # ● あらすじ画面呼び出し
  130. #--------------------------------------------------------------------------
  131. def call_outline
  132.   # プレイヤーの姿勢を矯正
  133.   $game_player.straighten
  134.   # あらすじ画面に切り替え
  135.   $scene = Scene_Outline.new(true)
  136. end
  137.  
  138. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  139.  
  140. #==============================================================================
  141. # ■ Module - KGC_Outline
  142. #==============================================================================
  143.  
  144. module KGC::Outline
  145.   #--------------------------------------------------------------------------
  146.   # ● あらすじ有効化
  147.   #     index : あらすじ番号
  148.   #     value : 有効状態 (true | false)
  149.   #--------------------------------------------------------------------------
  150.   def self.set_enabled(index, value = true)
  151.     if $game_system.outline_enable == nil
  152.       $game_system.outline_enable = []
  153.     end
  154.     $game_system.outline_enable[index] = value
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● あらすじ完了
  158.   #     index : あらすじ番号
  159.   #     value : 完了状態 (true | false)
  160.   #--------------------------------------------------------------------------
  161.   def self.set_completed(index, value = true)
  162.     if $game_system.outline_complete == nil
  163.       $game_system.outline_complete = []
  164.     end
  165.     $game_system.outline_complete[index] = value
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 制御コマンド処理
  169.   #     string : 処理対象文字列
  170.   #--------------------------------------------------------------------------
  171.   def self.apply_control_statement(string)
  172.     buf = string.dup
  173.     buf.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i].to_s }
  174.     buf.gsub!(/\\G/i) { $game_party.gold.to_s }
  175.     buf.gsub!(/\\N\[(\d+)\]/i) { $game_actors[$1.to_i].name }
  176.     buf.gsub!(/\\EN\[(\d+)\]/i) { $data_enemies[$1.to_i].name }
  177.     buf.gsub!(/\\IN\[(\d+)\]/i) { $data_items[$1.to_i].name }
  178.     buf.gsub!(/\\WN\[(\d+)\]/i) { $data_weapons[$1.to_i].name }
  179.     buf.gsub!(/\\AN\[(\d+)\]/i) { $data_armors[$1.to_i].name }
  180.     return buf
  181.   end
  182.   #
  183.   #
  184. end
  185.  
  186. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  187.  
  188. #==============================================================================
  189. # ■ Game_System
  190. #==============================================================================
  191.  
  192. class Game_System
  193.   attr_accessor :outline_enable, :outline_complete
  194.   #--------------------------------------------------------------------------
  195.   # ● オブジェクト初期化
  196.   #--------------------------------------------------------------------------
  197.   alias initialize_KGC_Outline initialize
  198.   def initialize
  199.     initialize_KGC_Outline
  200.  
  201.     @outline_enable = []
  202.     @outline_complete = []
  203.   end
  204. end
  205.  
  206. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  207.  
  208. #==============================================================================
  209. # ■ Window_OutlineList
  210. #------------------------------------------------------------------------------
  211. #  あらすじ一覧を表示するウィンドウです。
  212. #==============================================================================
  213.  
  214. class Window_OutlineList < Window_Selectable
  215.   #--------------------------------------------------------------------------
  216.   # ● オブジェクト初期化
  217.   #--------------------------------------------------------------------------
  218.   def initialize
  219.     super(0, 64, 160, 400)
  220.     self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
  221.     self.index = 0
  222.     self.z = 1000
  223.     refresh
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● 選択あらすじ内容
  227.   #--------------------------------------------------------------------------
  228.   def outline
  229.     return @data[self.index]
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ● リフレッシュ
  233.   #--------------------------------------------------------------------------
  234.   def refresh
  235.     self.contents.dispose if self.contents != nil
  236.     @data = []
  237.     @data_index = []
  238.     # リスト作成
  239.     $game_system.outline_enable = [] if $game_system.outline_enable == nil
  240.     $game_system.outline_complete = [] if $game_system.outline_complete == nil
  241.     KGC::OLINE_CONTENTS.each_with_index { |oline, i|
  242.       if $game_system.outline_enable[i]
  243.         @data << OutlineList_Info.new(oline[0], oline[1], i)
  244.       elsif !KGC::OLINE_HIDE_DISABLED
  245.         @data << OutlineList_Info.new(KGC::OLINE_DISABLED_TITLE, nil, i)
  246.       end
  247.     }
  248.     # リスト描画
  249.     @item_max = [@data.size, 1].max
  250.     self.contents = Bitmap.new(self.width - 32, 32 * @item_max)
  251.     if @data.size == 0
  252.       @data << OutlineList_Info.new
  253.     else
  254.       @data.each_index { |i| draw_item(i) }
  255.     end
  256.     # 根据列表项的数量计算窗口的高度
  257.     window_height = [32 * @item_max+32, 400].min
  258.     # 设置窗口的高度
  259.     self.height = window_height
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # ● 項目描画
  263.   #--------------------------------------------------------------------------
  264.   def draw_item(index)
  265.     self.contents.fill_rect(0, 32 * index, self.width - 32, 32, Color.new(0, 0, 0, 0))
  266.     # タイトル生成
  267.     text = ($game_system.outline_complete[@data[index].index] ?
  268.       KGC::OLINE_COMPLETION_SYMBOL : KGC::OLINE_INCOMPLETION_SYMBOL) +
  269.       (KGC::OLINE_SERIAL_NUMBER ? sprintf("%0*d : ",
  270.       KGC::OLINE_SERIAL_NUMBER_DIGITS, @data[index].index + 1) : "") +
  271.       KGC::Outline.apply_control_statement(@data[index].title)
  272.     # 描画色設定
  273.     self.contents.font.color = $game_system.outline_enable[@data[index].index] ?
  274.       normal_color : disabled_color
  275.     self.contents.draw_text(0, 32 * index, self.width - 32, 32, text)
  276.   end
  277. end
  278.  
  279. #==============================================================================
  280. # ■ OutlineList_Info
  281. #------------------------------------------------------------------------------
  282. #   あらすじ一覧の情報を保持するクラスです。
  283. #==============================================================================
  284.  
  285. class OutlineList_Info
  286.   attr_accessor :title, :contents, :index
  287.   #--------------------------------------------------------------------------
  288.   # ● オブジェクト初期化
  289.   #--------------------------------------------------------------------------
  290.   def initialize(title = "", contents = nil, index = 0)
  291.     @title = title
  292.     @contents = contents
  293.     @index = index
  294.   end
  295. end
  296.  
  297. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  298.  
  299. #==============================================================================
  300. # ■ Window_OutlineTitle
  301. #------------------------------------------------------------------------------
  302. #  あらすじの題名を表示するウィンドウです。
  303. #==============================================================================
  304.  
  305. class Window_OutlineTitle < Window_Base
  306.   #--------------------------------------------------------------------------
  307.   # ● オブジェクト初期化
  308.   #--------------------------------------------------------------------------
  309.   def initialize
  310.     super(0, 0, 640, 64)
  311.     self.contents = Bitmap.new(width - 32, height - 32)
  312.     self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ● リフレッシュ
  316.   #     text  : 表示する文字列
  317.   #--------------------------------------------------------------------------
  318.   def refresh(text)
  319.     self.contents.clear
  320.     text2 = KGC::Outline.apply_control_statement(text)
  321.     self.contents.draw_text(0, 0, self.width - 32, 32, text2, 1)
  322.   end
  323. end
  324.  
  325. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  326.  
  327. #==============================================================================
  328. # ■ Window_Outline
  329. #------------------------------------------------------------------------------
  330. #  あらすじ(の内容)を表示するウィンドウです。
  331. #==============================================================================
  332.  
  333. class Window_Outline < Window_Base
  334.   #--------------------------------------------------------------------------
  335.   # ● オブジェクト初期化
  336.   #--------------------------------------------------------------------------
  337.   def initialize
  338.     super(160, 64, 480, 416)
  339.     self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
  340.     self.active = false
  341.     refresh
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● リフレッシュ
  345.   #     oline : あらすじ
  346.   #--------------------------------------------------------------------------
  347.   def refresh(oline = nil)
  348.     self.oy = 0
  349.     self.contents.dispose if self.contents != nil
  350.     return if oline == nil
  351.     # 本文を描画
  352.     self.contents = Bitmap.new(self.width - 32, 32 * oline.size)
  353.     oline.each_with_index { |l ,i|
  354.       next if l == nil
  355.       text = KGC::Outline.apply_control_statement(l)
  356.      self.contents.draw_text(0, i * 32, self.width - 32, 32, text)
  357.     }
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 更新
  361.   #--------------------------------------------------------------------------
  362.   def update
  363.     super
  364.     # スクロール
  365.     if self.active
  366.       scroll_max = [self.contents.height - (self.height - 32), 0].max
  367.       if Input.press?(Input::UP)
  368.         self.oy = [self.oy - KGC::OLINE_SCROLL_SPEED, 0].max
  369.       elsif Input.press?(Input::DOWN)
  370.         self.oy = [self.oy + KGC::OLINE_SCROLL_SPEED, scroll_max].min
  371.       elsif Input.repeat?(Input::L)
  372.         self.oy = [self.oy - (self.height - 32), 0].max
  373.       elsif Input.repeat?(Input::R)
  374.         self.oy = [self.oy + (self.height - 32), scroll_max].min
  375.       end
  376.     end
  377.   end
  378.   #
  379.   #
  380. end
  381.  
  382. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  383.  
  384. #==============================================================================
  385. # ■ Scene_Outline
  386. #------------------------------------------------------------------------------
  387. #  あらすじ画面の処理を行うクラスです。
  388. #==============================================================================
  389.  
  390. class Scene_Outline
  391.   #--------------------------------------------------------------------------
  392.   # ● オブジェクト初期化
  393.   #     map_call : マップからの呼び出しフラグ
  394.   #--------------------------------------------------------------------------
  395.   def initialize(map_call = false)
  396.     @map_call = map_call
  397.   end
  398.   #--------------------------------------------------------------------------
  399.   # ● メイン処理
  400.   #--------------------------------------------------------------------------
  401.   def main
  402.     # スプライトセットを作成
  403.     @spriteset = Spriteset_Map.new if KGC::OLINE_BACK_TRANSPARENT
  404.     # ウィンドウを作成
  405.     @list_window = Window_OutlineList.new
  406.     @title_window = Window_OutlineTitle.new
  407.     @content_window = Window_Outline.new
  408.     # トランジション実行
  409.     Graphics.transition
  410.     # メインループ
  411.     loop {
  412.       Graphics.update
  413.       Input.update
  414.       update
  415.       if $scene != self
  416.         break
  417.       end
  418.     }
  419.     # トランジション準備
  420.     Graphics.freeze
  421.     # ウィンドウを解放
  422.     @list_window.dispose
  423.     @title_window.dispose
  424.     @content_window.dispose
  425.     @spriteset.dispose if KGC::OLINE_BACK_TRANSPARENT
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # ● フレーム更新
  429.   #--------------------------------------------------------------------------
  430.   def update
  431.     # ウィンドウ更新
  432.     @list_window.update
  433.     @title_window.update
  434.     @content_window.update
  435.     # アクティブウィンドウ操作
  436.     if @list_window.active
  437.       update_list
  438.     elsif @content_window.active
  439.       update_content
  440.     end
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● フレーム更新 (リスト)
  444.   #--------------------------------------------------------------------------
  445.   def update_list
  446.     # B ボタンが押された場合
  447.     if Input.trigger?(Input::B)
  448.       # キャンセル SE を演奏
  449.       $game_system.se_play($data_system.cancel_se)
  450.       if @map_call
  451.         # マップ画面に切り替え
  452.         $scene = Scene_Map.new
  453.       else
  454.         # メニュー画面に切り替え
  455.         if $imported["MenuAlter"]
  456.           index = KGC::MA_COMMANDS.index(12)
  457.           if index != nil
  458.             $scene = Scene_Menu.new(index)
  459.           else
  460.             $scene = Scene_Menu.new
  461.           end
  462.         else
  463.           $scene = Scene_Menu.new
  464.         end
  465.       end
  466.       return
  467.     end
  468.     # C ボタンが押された場合
  469.     if Input.trigger?(Input::C)
  470.       outline = @list_window.outline
  471.       # 閲覧できない場合
  472.       if outline.contents == nil
  473.         # ブザー SE を演奏
  474.         $game_system.se_play($data_system.buzzer_se)
  475.         return
  476.       end
  477.       # 決定 SE を演奏
  478.       $game_system.se_play($data_system.decision_se)
  479.       # あらすじを更新
  480.       @title_window.refresh(outline.title)
  481.       @content_window.refresh(outline.contents)
  482.       # ウィンドウ切り替え
  483.       @list_window.active = false
  484.       @list_window.z = 0
  485.       @content_window.active = true
  486.       @content_window.z = 1000
  487.       return
  488.     end
  489.   end
  490.   #--------------------------------------------------------------------------
  491.   # ● フレーム更新 (本文)
  492.   #--------------------------------------------------------------------------
  493.   def update_content
  494.     # B ボタンが押された場合
  495.     if Input.trigger?(Input::B)
  496.       # キャンセル SE を演奏
  497.       $game_system.se_play($data_system.cancel_se)
  498.       # ウィンドウ切り替え
  499.       @list_window.active = true
  500.       @list_window.z = 1000
  501.       @content_window.active = false
  502.       @content_window.z = 0
  503.       return
  504.     end
  505.   end
  506. end

Lv3.寻梦者

梦石
0
星屑
1264
在线时间
301 小时
注册时间
2023-6-6
帖子
22
2
 楼主| 发表于 2023-7-20 01:02:50 | 只看该作者
以下是葉子任務系統的控制碼部分
  1. class Game_Task
  2.   attr_accessor   :name                   # 名稱
  3.   attr_accessor   :briefing               # 簡介
  4.   def initialize(name, briefing)
  5.     @name = name
  6.     @briefing = briefing
  7.   end
  8.   def height
  9.     text = @briefing.clone
  10.     x = 0
  11.     y = 64
  12.     min_y = 0
  13.     # 限制文字處理
  14.     begin
  15.       last_text = text.clone
  16.       text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  17.     end until text == last_text
  18.     text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  19.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  20.     end
  21.     # 為了方便、將 "\\\\" 變換為 "\000"
  22.     text.gsub!(/\\\\/) { "\000" }
  23.     # "\C" 變為 "\001"
  24.     text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  25.     # "\I" 變為 "\002"
  26.     text.gsub!(/\\[Ii]/) { "\002" }
  27.     # "\P" 變為 "\003"
  28.     text.gsub!(/\\[Pp]/) { "\003" }
  29.     # c 獲取 1 個字 (如果不能取得文字就循環)
  30.     while ((c = text.slice!(/./m)) != nil)
  31.       # \\ 的情況下
  32.       if c == "\000"
  33.         # 還原為本來的文字
  34.         c = "\\"
  35.       end
  36.       # \C[n] 的情況下
  37.       if c == "\001"
  38.         # 更改文字色
  39.         text.sub!(/\[([0-9]+)\]/, "")
  40.         # 下面的文字
  41.         next
  42.       end
  43.       # 圖標的情況下
  44.       if c == "\002"
  45.         icon_name = ''
  46.         while ((cha = text.slice!(/./m)) != ']')
  47.           next if cha == '['
  48.           icon_name += cha
  49.         end
  50.         icon = RPG::Cache.icon(icon_name)
  51.         if x + icon.width > 368
  52.           x = 0
  53.           y += [32, min_y].max
  54.           min_y = 0
  55.         end
  56.         x += 28
  57.         next
  58.       end
  59.       # 圖片的情況下
  60.       if c == "\003"
  61.         pic_name = ''
  62.         while ((cha = text.slice!(/./m)) != ']')
  63.           next if cha == '['
  64.           pic_name += cha
  65.         end
  66.         pic = RPG::Cache.picture(pic_name)
  67.         if x + pic.width > 368
  68.           x = 0
  69.           y += [32, min_y].max
  70.           min_y = 0
  71.         end
  72.         x += pic.width
  73.         min_y = [pic.height, 32].max
  74.         next
  75.       end
  76.       # 另起一行文字的情況下
  77.       if c == "\n"
  78.         y += [32, min_y].max
  79.         min_y = 0
  80.         x = 0
  81.         # 下面的文字
  82.         next
  83.       end
  84.       # 自動換行處理
  85.       if x + 22 > 368
  86.         y += [32, min_y].max
  87.         min_y = 0
  88.         x = 0
  89.       end
  90.       # x 為要描繪文字的加法運算
  91.       x += 22
  92.     end
  93.     return (y + [32, min_y].max)
  94.   end
  95.   def id
  96.     return $game_party.tasks_info.index(self)
  97.   end
  98. end
复制代码


如果我沒理解錯 是不是像這樣添加在我上述腳本def self.apply_control_statement(string)裡面???
我自己怎麼弄都 弄不成功
求解


回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7946
在线时间
1182 小时
注册时间
2007-7-29
帖子
2055
3
发表于 2023-7-26 02:08:49 | 只看该作者
apply_control_statement 只是把格式化的字符串替换成对应的字符串,过程不涉及描绘。\c[n] 这类改变颜色的做法通常是在描绘时处理,我目测应该是在 draw_item 里头。
稍微了解脚本的应该都有办法改到,只是这玩意儿手上没有RM debug很麻烦,目前我手头上就没RM,只能理论提及。
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 06:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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