#============================================================================
# SCRIPT WINDOW_TEST
# classe Window_Test_Map par dani_nouvel_star
# Mai 2007
# Ce script permet d'afficher en temps réel toutes les variables que l'on veut.
# Il faut le placer avant main.
# ATTENTION :
# La classe scene_map est modifiée, donc si vous combinez avec un script qui
# modifie aussi la scene_map il faut faire attention à ce que l'objet de type
# "Window_Test_Map" soit bien mise à jour ou libérée au bonne endroit.
# si y a des problèmes, envoyez-moi un mail à :
dani_nouvel_star@hotmail.com# activer? ou désactiver? la fenêtre test======================================
$fenetre_de_test = true
# fréquence de rafraîchissement de la fenêtre
# modifier à tous les frames n'est pas toujours conseillé car ça peut ramer
# L'update se fera tous les n frames pour :
# n = $frequence_min_update
$frequence_min_update = 1 # valeur supérieure ou égale à 1
#==============================================================================
#==============================================================================
# ■ Window_Test_Map
# Objet descendant de la classe Window_Base
#==============================================================================
class Window_Test_Map < Window_Base
#--------------------------------------------------------------------------
# ● Window_Test_Map / initialize
#--------------------------------------------------------------------------
def initialize
super(0, 406, 700, 125)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.back_opacity=0
self.contents.font.name = "Arial"
self.contents.font.size = 20
refresh
end
#--------------------------------------------------------------------------
# ● Window_Test_Map / refresh
#--------------------------------------------------------------------------
def refresh
# on peut mettre plus de lignes si on veut :
# DEFINITION DES VALEURS A TESTER : -------------------------------
# le tableau test doit avoir la forme suivante
#$test = [
# $test1,
# $test2,
# $test3,
# $test4,
# $test5,
# $test6 # ne pas mettre de virgule à la dernière ligne
# ]
#etc.
$test = [
$game_variables[ID]
]
#etc.
# fin DEFINITION DES VALEURS
self.contents.clear
for i in 1..$test.size
if !$test[i]
$test[i] = "pas de valeur"
end
self.contents.font.color = system_color
self.contents.draw_text(-50, 15*(i -1), 300, 32, ""+i.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(-110, 15*(i -1), 300, 32, $test[i-1].to_s, 1)
end
end
#--------------------------------------------------------------------------
# ● Window_Test_Map / update
#--------------------------------------------------------------------------
def update
super
return if Graphics.frame_count % $frequence_min_update != 0
refresh
end
end
#==============================================================================
# ■ Scene_Map 2
# -> une fenêtre de test est rajouté et peut-être activée dans "Main" en faisant
# $fenetre_de_test = true. Grâce à cette fenêtre test on pourra afficher en
# temps réel des variables que l'on affecteras aux variables : $test1, $test2,
# etc. Ces variables doivent être des chaînes de caractères.
#==============================================================================
class Scene_Map
# Spriteset_Map aura une variable globale associée
#--------------------------------------------------------------------------
# ● Scene_Map / main
#--------------------------------------------------------------------------
def main
# スプライトセットを作成
$spriteset_map = Spriteset_Map.new
# メッセージウィンドウを作成
@message_window = Window_Message.new
if $fenetre_de_test
#---------------------------------------------------------------
# création d'un nouvel objet de type "Window_Test_Map"
@window_test_map = Window_Test_Map.new
#---------------------------------------------------------------
end
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# スプライトセットを解放
$spriteset_map.dispose
# メッセージウィンドウを解放
@message_window.dispose
if $fenetre_de_test
#---------------------------------------------------------------
# après un freeze graphique on libère la mémoire
@window_test_map.dispose
#---------------------------------------------------------------
end
# タイトル画面に切り替え中の場合
if $scene.is_a?(Scene_Title)
# 画面をフェードアウト
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# ● Scene_Map / update
# méthode appelée à chaque frame
#--------------------------------------------------------------------------
def update
# ループ
loop do
# マップ、インタプリタ、プレイヤーの順に更新
# (この更新順序は、イベントを実行する条件が満たされているときに
# プレイヤーに一瞬移動する機会を与えないなどの理由で重要)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# システム (タイマー)、画面を更新
$game_system.update
$game_screen.update
# プレイヤーの場所移動中でなければループを中断
unless $game_temp.player_transferring
break
end
# 場所移動を実行
transfer_player
# トランジション処理中の場合、ループを中断
if $game_temp.transition_processing
break
end
end
# スプライトセットを更新
$spriteset_map.update
# メッセージウィンドウを更新
@message_window.update
# ゲームオーバーの場合
if $fenetre_de_test
#---------------------------------------------------------------
# dans cet update, il y a le refresh donc la fréquence peut-être
# modifié car vaut mieux ne pas rafraîchir tous les frames car ça
# prend de la ressource
@window_test_map.update
#---------------------------------------------------------------
end
if $game_temp.gameover
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# タイトル画面に戻す場合
if $game_temp.to_title
# タイトル画面に切り替え
$scene = Scene_Title.new
return
end
# トランジション処理中の場合
if $game_temp.transition_processing
# トランジション処理中フラグをクリア
$game_temp.transition_processing = false
# トランジション実行
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# メッセージウィンドウ表示中の場合
if $game_temp.message_window_showing
return
end
# エンカウント カウントが 0 で、エンカウントリストが空ではない場合
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# イベント実行中かエンカウント禁止中でなければ
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# トループを決定
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# トループが有効なら
if $data_troops[troop_id] != nil
# バトル呼び出しフラグをセット
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
if Input.trigger?(Input::F5)
if !$game_temp.pause
$game_temp.pause = true
else
$game_temp.pause = false
end
end
# B ボタンが押された場合
if Input.trigger?(Input::B)
# イベント実行中かメニュー禁止中でなければ
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# メニュー呼び出しフラグと SE 演奏フラグをセット
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# デバッグモードが ON かつ F9 キーが押されている場合
if $DEBUG and Input.press?(Input::F9)
# デバッグ呼び出しフラグをセット
$game_temp.debug_calling = true
end
# プレイヤーの移動中ではない場合
unless $game_player.moving?
# 各種画面の呼び出しを実行
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
end