sacred-ritual-academy/Scripts/_.27.rb
2025-03-18 19:45:34 -05:00

116 lines
No EOL
6.3 KiB
Ruby
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ■ 注釈取得スクリプト (VX Ace用)
#------------------------------------------------------------------------------
# 製作者 : CanariAlternate
# サイト名 : カルトの鳥篭
# サイトURL : http://canarialt.blog.fc2.com
#------------------------------------------------------------------------------
# ■ 概要 : 注釈を取得する処理を定義する。
#
# ■ 必須 : なし
#
# ■ 位置 : 「Game_Event」より下
#------------------------------------------------------------------------------
# ■ 注釈での設定方法
# 以下の例のように実行内容の1行目から注釈以外のコマンドまでの注釈のどこかに
# キーワードを記述すると有効(結果を反転してる場合には無効)になります。
#
# 例 : 実行内容
# ◆注釈キーワードA キーワードC
# キーワードG キーワードF
# キーワードE
# ◆注釈キーワードD
# キーワードH キーワードB
# ◆変数の操作などの注釈以外のイベントコマンド
# ◆注釈:ここ以下に書いても無視される。
# ◆
#
# ※キーワードとなる文字列の設定は正規表現です。詳しいことはヘルプを「正規表現」で検索すると出てきます。
# 簡単に言うと / で囲まれた文字列があるかないかで判定します。
# \ とか ! みたいな記号を使いたい時はヘルプを参照して下さい。
# 設定例、/\[キーワード\]/ #=> [キーワード]
#
# ※キーワードを記述すると有効と無効が切り替わります。初期状態は無効です。
# 例 : 初期状態を反転, 記述したイベントの全ての頁を反転, 記述した頁のみを反転
# まず 「初期状態を反転」 で有効に
# 次に 「記述したイベントの全ての頁を反転」で無効に
# 最後に「記述した頁のみを反転」 で有効に
#------------------------------------------------------------------------------
# 更新履歴 : 2012/10/05 Ver1.00 コードを共通処理スクリプトに統一
# 2012/10/06 Ver1.01 コードを共通処理スクリプトから分離
# 2012/10/08 Ver1.02 コードの整理
# 2013/02/19 Ver1.03 共通処理スクリプトの廃止による変更を施した。
#==============================================================================
$imported ||= {}
$imported[:CanariAlternate_EventNote] = true
#==============================================================================
# ■ Calt
#------------------------------------------------------------------------------
#  CanariAlternateが製作したスクリプトの管理用モジュール
#==============================================================================
module Calt
#--------------------------------------------------------------------------
# ● イベントコマンドから注釈を取得 [新規]
#--------------------------------------------------------------------------
def self.Read_EventNote(list)
return String.new unless list && list[i = 0].code == 108
note = list[i].parameters[0]
note += "\n#{list[i].parameters[0]}" while [108, 408].include?(list[i += 1].code)
return note
end
end
#==============================================================================
# ■ Game_Event
#------------------------------------------------------------------------------
#  イベントを扱うクラスです。条件判定によるイベントページ切り替えや、並列処理
# イベント実行などの機能を持っており、Game_Map クラスの内部で使用されます。
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ● イベントページの設定をセットアップ [追加]
#--------------------------------------------------------------------------
alias setup_page_settings_EventNote setup_page_settings
def setup_page_settings
setup_page_settings_EventNote
setup_note_settings
end
#--------------------------------------------------------------------------
# ● イベントページ更新時に注釈から設定を取得 [新規]
#--------------------------------------------------------------------------
def setup_note_settings
# 注釈の取得処理はここに追加
end
#--------------------------------------------------------------------------
# ● 1頁目の注釈にキーワードが含まれているか判定 [新規]
#--------------------------------------------------------------------------
def whole_note_include?(keyword)
return @event.pages[0].event_note =~ keyword ? true : false
end
#--------------------------------------------------------------------------
# ● この頁の注釈にキーワードが含まれているか判定 [新規]
#--------------------------------------------------------------------------
def event_note_include?(keyword)
return @page.event_note =~ keyword ? true : false
end
end
#==============================================================================
# ■ RPG::Event::Page
#------------------------------------------------------------------------------
#  イベントページのデータクラス。
#==============================================================================
class RPG::Event::Page
#--------------------------------------------------------------------------
# ● 取得する注釈内容を変更 [新規]
#--------------------------------------------------------------------------
attr_writer :event_note
#--------------------------------------------------------------------------
# ● この頁の注釈を取得 [新規]
#--------------------------------------------------------------------------
def event_note
return @event_note ||= Calt::Read_EventNote(@list)
end
end