Pokémon Script Project Forum Index

Manuel | Search
 Information des admins 
Si vous désirez parler de PSP ou obtenir du soutient là dessus, merci d'aller faire un tour sur https://pokemonworkshop.com/forum/index.php Imbécile heureux

[Script] Scan de ressources

 
Post new topic   Reply to topic    Pokémon Script Project Forum Index -> Game Making -> Ressources techniques -> Scripts
Previous topic :: Next topic   
Author Message
Angi-MK
Membre


Joined: 29 Oct 2008
Posts: 2,303
Localisation: Québec
Masculin

PostPosted: Fri 30 Oct - 23:20 (2009)    Post subject: [Script] Scan de ressources

Vous en avez mare de ces projets qui offre dans leur démo des tonnes de fichiers inutiles ?
Et bien ne faites pas la même erreurs, testez les ressources utilisées et celles qui ne sont jamais utilisés, virez-les !

Ce script va scanner vos fichier et vous faire une liste détaillé de ceux utilisés ou non.
Il vous permet aussi de vous annoncer qu'un fichier est manquant, exemple:
-vous utiliser une musique pour une ville mais celle-ci n'est plus dans le dossier du jeu.
A vous ensuite de reirer ou ajouter les fichier en question Clin d'œil foireux
pour appeller ce script,placer simplement ce code dans unserer un script :
Code:

$scene = Scene_Scan.new

et voila la bête à placer au-dessus de main (merci à zeus81 qui en est l'auteur):


[code]
#=================================
# Ressources Scanner
# Script créé par Zeus81
#=================================
#
#
# Pour l'utiliser faire insérer un script et écrire :
# $scene = Scene_Scan.new
# Sinon vous pouvez aussi l'écrire en dessous de $scene = Scene_Title.new
# dans le Main pour qu'il se lance automatiquement au démarrage
# comme ça c'est plus rapide !
#
# Si il y a quelque chose que vous ne comprenez pas faites un scan en mettant
# juste "Afficher l'en-tête" et tout sera expliquer.

class Window_Scan < Window_Selectable

attr_reader :phase

def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Comic Sans MS"
self.phase = 0
viewport = Viewport.new(366, 406, 168, 20)
viewport.z = 9999
@sprite = Sprite.new(viewport)
@sprite.bitmap = Bitmap.new(40, 20)
for i in 0...20
@sprite.bitmap.fill_rect(i, 0, 40-2*i, 20, Color.new(0, 255, 0, 13*i))
end
@text = Sprite.new(viewport)
@text.bitmap = Bitmap.new(168, 20)
@text.bitmap.font.name = "Comic Sans MS"
@text.bitmap.font.size = 20
@text.bitmap.font.color = normal_color
@text.bitmap.draw_text(0, 0, 168, 20, "Analyse en cours", 1)
refresh
end

def update_scan_bar
@sprite.x += 1
@sprite.x = -40 if @sprite.x >= 168
end

def draw_scan_bar
@sprite.visible = true
@text.visible = true
self.contents.fill_rect(349, 389, 170, 22, Color.new(0, 0, 0))
end

def refresh
@sprite.visible = false
@text.visible = false
@sprite.x = -40
self.contents.clear
self.contents.fill_rect(0, 32, 608, 1, normal_color)
self.contents.fill_rect(256, 32, 1, 416, normal_color)
self.contents.fill_rect(256, 296, 352, 1, normal_color)

self.contents.font.size = 28
self.contents.font.color = knockout_color
self.contents.draw_text(0, 0, 608, 32, "Ressources Scanner", 1)

self.contents.font.size = 20
self.contents.font.color = crisis_color
self.contents.draw_text(0, 32, 256, 32, "Fichiers à analyser", 1)
self.contents.draw_text(256, 32, 352, 32, "Options de configuration", 1)

self.contents.font.color = normal_color
self.contents.draw_text(0, 64, 128, 32, "Audio", 1)
self.contents.draw_text(0, 96, 128, 32, "BGM", 1)
self.contents.draw_text(0, 120, 128, 32, "BGS", 1)
self.contents.draw_text(0, 144, 128, 32, "ME", 1)
self.contents.draw_text(0, 168, 128, 32, "SE", 1)

self.contents.draw_text(128, 64, 128, 32, "Graphics", 1)
self.contents.draw_text(128, 96, 128, 32, "Animations", 1)
self.contents.draw_text(128, 120, 128, 32, "Autotiles", 1)
self.contents.draw_text(128, 144, 128, 32, "Battlebacks", 1)
self.contents.draw_text(128, 168, 128, 32, "Battlers", 1)
self.contents.draw_text(128, 192, 128, 32, "Characters", 1)
self.contents.draw_text(128, 216, 128, 32, "Fogs", 1)
self.contents.draw_text(128, 240, 128, 32, "Gameovers", 1)
self.contents.draw_text(128, 264, 128, 32, "Icons", 1)
self.contents.draw_text(128, 288, 128, 32, "Panoramas", 1)
self.contents.draw_text(128, 312, 128, 32, "Pictures", 1)
self.contents.draw_text(128, 336, 128, 32, "Tilesets", 1)
self.contents.draw_text(128, 360, 128, 32, "Titles", 1)
self.contents.draw_text(128, 384, 128, 32, "Transitions", 1)
self.contents.draw_text(128, 408, 128, 32, "Windowskins", 1)

self.contents.draw_text(256, 64, 352, 32, " Rechercher aussi dans les scripts")

self.contents.draw_text(256, 96, 352, 32, " Afficher l'en-tête (Légende, etc...)")
self.contents.draw_text(256, 120, 352, 32, " Afficher les fichiers :")
self.contents.draw_text(256, 144, 352, 32, " - utilisés")
self.contents.draw_text(256, 168, 352, 32, " - utilisés en animation / chipset")
self.contents.draw_text(256, 192, 352, 32, " - utilisés en script")
self.contents.draw_text(256, 216, 352, 32, " - manquants")
self.contents.draw_text(256, 240, 352, 32, " - inutiles")
self.contents.draw_text(256, 264, 352, 32, " Afficher les statistiques")

self.contents.draw_text(256, 328, 352, 32, "Tout sélectionner", 1)
self.contents.draw_text(256, 352, 352, 32, "Tout désélectionner", 1)

self.contents.draw_text(256, 384, 352, 32, "Commencer l'analyse", 1)

draw_states
end

def draw_states
draw_state(0, 64, $scene.audio_scan)
draw_state(0, 96, $scene.bgm_scan)
draw_state(0, 120, $scene.bgs_scan)
draw_state(0, 144, $scene.me_scan)
draw_state(0, 168, $scene.se_scan)

draw_state(128, 64, $scene.graphics_scan)
draw_state(128, 96, $scene.animations_scan)
draw_state(128, 120, $scene.autotiles_scan)
draw_state(128, 144, $scene.battlebacks_scan)
draw_state(128, 168, $scene.battlers_scan)
draw_state(128, 192, $scene.characters_scan)
draw_state(128, 216, $scene.fogs_scan)
draw_state(128, 240, $scene.gameovers_scan)
draw_state(128, 264, $scene.icons_scan)
draw_state(128, 288, $scene.panoramas_scan)
draw_state(128, 312, $scene.pictures_scan)
draw_state(128, 336, $scene.tilesets_scan)
draw_state(128, 360, $scene.titles_scan)
draw_state(128, 384, $scene.transitions_scan)
draw_state(128, 408, $scene.windowskins_scan)

draw_state(256+8, 64, $scene.scripts_check)

draw_state(256+8, 96, $scene.head_write)
draw_state(256+8, 144, $scene.used_write)
draw_state(256+8, 168, $scene.used2_write)
draw_state(256+8, 192, $scene.used3_write)
draw_state(256+8, 216, $scene.missed_write)
draw_state(256+8, 240, $scene.useless_write)
draw_state(256+8, 264, $scene.statistics_write)
end

def draw_state(x, y, state)
if state == true
color = Color.new(34, 161, 34)
else
color = Color.new(128, 128, 128)
end
self.contents.fill_rect(x+3, y+11, 10, 10, Color.new(29, 82, 129))
self.contents.fill_rect(x+4, y+12, 8, 8, Color.new(255, 255, 255))
self.contents.fill_rect(x+5, y+13, 6, 6, color)
end

def phase=(phase)
@phase = phase
@phase %= 3
@index = 0
if @phase == 0
@item_max = 5
elsif @phase == 1
@item_max = 15
elsif @phase == 2
@item_max = 11
end
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
x = @phase * 128
y = @index == 0 ? 68 : @index*24+76
w = 120
if @phase == 2
x = 264
w = 344
y += 24 if @index > 1
if @index > 7
x = 348
y += 40
w = 172
end
y += 8 if @index > 9
end
self.cursor_rect.set(x, y, w, 24)
end

end


class Scene_Scan


attr_reader :audio_scan
attr_reader :bgm_scan
attr_reader :bgs_scan
attr_reader :me_scan
attr_reader :se_scan
attr_reader :graphics_scan
attr_reader :animations_scan
attr_reader :autotiles_scan
attr_reader :battlebacks_scan
attr_reader :battlers_scan
attr_reader :characters_scan
attr_reader :fogs_scan
attr_reader :gameovers_scan
attr_reader :icons_scan
attr_reader :panoramas_scan
attr_reader :pictures_scan
attr_reader :tilesets_scan
attr_reader :titles_scan
attr_reader :transitions_scan
attr_reader :windowskins_scan
attr_reader :scripts_check
attr_reader :head_write
attr_reader :used_write
attr_reader :used2_write
attr_reader :used3_write
attr_reader :missed_write
attr_reader :useless_write
attr_reader :statistics_write


def initialize
GC.disable

$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new

audio(true)
graphics(true)
@scripts_check = false
@head_write = true
@used_write = true
@used2_write = true
@used3_write = true
@missed_write = true
@useless_write = true
@statistics_write = true

@thread_start = false
@thread = Thread.new do
loop do
sleep
@scan_window.draw_scan_bar
@thread_start = true
while(@thread_start == true)
@scan_window.update_scan_bar
Graphics.update
sleep(0.02)
end
@scan_window.refresh
end
end
end

def audio(state)
@audio_scan = state
@bgm_scan = state
@bgs_scan = state
@me_scan = state
@se_scan = state
end

def graphics(state)
@graphics_scan = state
@animations_scan = state
@autotiles_scan = state
@battlebacks_scan = state
@battlers_scan = state
@characters_scan = state
@fogs_scan = state
@gameovers_scan = state
@icons_scan = state
@panoramas_scan = state
@pictures_scan = state
@tilesets_scan = state
@titles_scan = state
@transitions_scan = state
@windowskins_scan = state
end


def main
@scan_window = Window_Scan.new
Graphics.transition
loop do
update
Graphics.update
Input.update
end
end


def update
@scan_window.update
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@scan_window.phase -= 1
elsif Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@scan_window.phase += 1
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
index = @scan_window.index
case @scan_window.phase
when 0
audio(!@audio_scan) if index == 0
@bgm_scan = !@bgm_scan if index == 1
@bgs_scan = !@bgs_scan if index == 2
@me_scan = !@me_scan if index == 3
@se_scan = !@se_scan if index == 4
@audio_scan = (@bgm_scan || @bgs_scan || @me_scan || @se_scan)
when 1
graphics(!@graphics_scan) if index == 0
@animations_scan = !@animations_scan if index == 1
@autotiles_scan = !@autotiles_scan if index == 2
@battlebacks_scan = !@battlebacks_scan if index == 3
@battlers_scan = !@battlers_scan if index == 4
@characters_scan = !@characters_scan if index == 5
@fogs_scan = !@fogs_scan if index == 6
@gameovers_scan = !@gameovers_scan if index == 7
@icons_scan = !@icons_scan if index == 8
@panoramas_scan = !@panoramas_scan if index == 9
@pictures_scan = !@pictures_scan if index == 10
@tilesets_scan = !@tilesets_scan if index == 11
@titles_scan = !@titles_scan if index == 12
@transitions_scan = !@transitions_scan if index == 13
@windowskins_scan = !@windowskins_scan if index == 14
@graphics_scan = (@animations_scan || @autotiles_scan || @battlebacks_scan ||
@battlers_scan || @characters_scan || @fogs_scan ||
@gameovers_scan || @icons_scan || @panoramas_scan ||
@pictures_scan || @tilesets_scan || @titles_scan ||
@transitions_scan || @windowskins_scan)
when 2
@scripts_check = !@scripts_check if index == 0
@head_write = !@head_write if index == 1
@used_write = !@used_write if index == 2
@used2_write = !@used2_write if index == 3
@used3_write = !@used3_write if index == 4
@missed_write = !@missed_write if index == 5
@useless_write = !@useless_write if index == 6
@statistics_write = !@statistics_write if index == 7
if index == 8 or index == 9
state = (index == 8)
audio(state)
graphics(state)
@scripts_check = state
@head_write = state
@used_write = state
@used2_write = state
@used3_write = state
@missed_write = state
@useless_write = state
@statistics_write = state
end
start_scan if index == 10
end
@scan_window.draw_states
end
end


def start_scan
@thread.wakeup
initialize_arrays
scan_data
check_data
makefile
@thread_start = false
print(" L'analyse est terminé !\n",
" Le résultat se trouve dans le fichier\n",
"\"Scan.log\" dans le dossier de votre jeu.")
end


def initialize_arrays
@scan_bgm = []
@scan_bgs = []
@scan_me = []
@scan_se = []
@scan_animations = []
@scan_autotiles = []
@scan_battlebacks = []
@scan_battlers = []
@scan_characters = []
@scan_fogs = []
@scan_gameovers = []
@scan_icons = []
@scan_panoramas = []
@scan_pictures = []
@scan_tilesets = []
@scan_titles = []
@scan_transitions = []
@scan_windowskins = []

@game_bgm = []
@game_bgs = []
@game_me = []
@game_se = []
@game_animations = []
@game_autotiles = []
@game_battlebacks = []
@game_battlers = []
@game_characters = []
@game_fogs = []
@game_gameovers = []
@game_icons = []
@game_panoramas = []
@game_pictures = []
@game_tilesets = []
@game_titles = []
@game_transitions = []
@game_windowskins = []
@game_scripts = []

@animations_id_list = []
@tilesets_id_list = []
@game2_se = []
@game2_animations = []
@game2_autotiles = []
@game2_battlebacks = []
@game2_fogs = []
@game2_panoramas = []
@game2_tilesets = []
end


def scan_data
system("dir /A-D-S /B /S > Scan.tmp")
file = File.open("Scan.tmp")
filenames = file.readlines
file.close
path = File.expand_path("").gsub("/"){"\\"} + "\\"
for i in 0...filenames.size
filenames[i] = correct(filenames[i])
filenames[i][path] = ""
filenames[i][-1,1] = ""
if filenames[i][0, 6] == "Audio\\"
if @audio_scan == true
filenames[i][0, 6] = ""
if filenames[i][0, 4] == "BGM\\"
if @bgm_scan == true
filenames[i][0, 4] = ""
@scan_bgm.push(filenames[i])
end
elsif filenames[i][0, 4] == "BGS\\"
if @bgs_scan == true
filenames[i][0, 4] = ""
@scan_bgs.push(filenames[i])
end
elsif filenames[i][0, 3] == "ME\\"
if @me_scan == true
filenames[i][0, 3] = ""
@scan_me.push(filenames[i])
end
elsif filenames[i][0, 3] == "SE\\"
if @se_scan == true
filenames[i][0, 3] = ""
@scan_se.push(filenames[i])
end
end
end
elsif filenames[i][0, 9] == "Graphics\\"
if @graphics_scan == true
filenames[i][0, 9] = ""
if filenames[i][0, 11] == "Animations\\"
if @animations_scan == true
filenames[i][0, 11] = ""
@scan_animations.push(filenames[i])
end
elsif filenames[i][0, 10] == "Autotiles\\"
if @autotiles_scan == true
filenames[i][0, 10] = ""
@scan_autotiles.push(filenames[i])
end
elsif filenames[i][0, 12] == "Battlebacks\\"
if @battlebacks_scan == true
filenames[i][0, 12] = ""
@scan_battlebacks.push(filenames[i])
end
elsif filenames[i][0, 9] == "Battlers\\"
if @battlers_scan == true
filenames[i][0, 9] = ""
@scan_battlers.push(filenames[i])
end
elsif filenames[i][0, 11] == "Characters\\"
if @characters_scan == true
filenames[i][0, 11] = ""
@scan_characters.push(filenames[i])
end
elsif filenames[i][0, 5] == "Fogs\\"
if @fogs_scan == true
filenames[i][0, 5] = ""
@scan_fogs.push(filenames[i])
end
elsif filenames[i][0, 10] == "Gameovers\\"
if @gameovers_scan == true
filenames[i][0, 10] = ""
@scan_gameovers.push(filenames[i])
end
elsif filenames[i][0, 6] == "Icons\\"
if @icons_scan == true
filenames[i][0, 6] = ""
@scan_icons.push(filenames[i])
end
elsif filenames[i][0, 10] == "Panoramas\\"
if @panoramas_scan == true
filenames[i][0, 10] = ""
@scan_panoramas.push(filenames[i])
end
elsif filenames[i][0, 9] == "Pictures\\"
if @pictures_scan == true
filenames[i][0, 9] = ""
@scan_pictures.push(filenames[i])
end
elsif filenames[i][0, 9] == "Tilesets\\"
if @tilesets_scan == true
filenames[i][0, 9] = ""
@scan_tilesets.push(filenames[i])
end
elsif filenames[i][0, 7] == "Titles\\"
if @titles_scan == true
filenames[i][0, 7] = ""
@scan_titles.push(filenames[i])
end
elsif filenames[i][0, 12] == "Transitions\\"
if @transitions_scan == true
filenames[i][0, 12] = ""
@scan_transitions.push(filenames[i])
end
elsif filenames[i][0, 12] == "Windowskins\\"
if @windowskins_scan == true
filenames[i][0, 12] = ""
@scan_windowskins.push(filenames[i])
end
end
end
end
end
end

def correct(filename)
filename.gsub!(/\201/) {"ü"}
filename.gsub!(/\202/) {"é"}
filename.gsub!(/\203/) {"â"}
filename.gsub!(/\204/) {"ä"}
filename.gsub!(/\205/) {"à"}
filename.gsub!(/\207/) {"ç"}
filename.gsub!(/\210/) {"ê"}
filename.gsub!(/\211/) {"ë"}
filename.gsub!(/\212/) {"è"}
filename.gsub!(/\213/) {"ï"}
filename.gsub!(/\214/) {"î"}
filename.gsub!(/\215/) {"ì"}
filename.gsub!(/\216/) {"Ä"}
filename.gsub!(/\223/) {"ô"}
filename.gsub!(/\224/) {"ö"}
filename.gsub!(/\225/) {"ò"}
filename.gsub!(/\226/) {"û"}
filename.gsub!(/\227/) {"ù"}
filename.gsub!(/\230/) {"ÿ"}
filename.gsub!(/\231/) {"Ö"}
filename.gsub!(/\232/) {"Ü"}
filename.gsub!(/\234/) {"£"}
filename.gsub!(/\266/) {"Â"}
filename.gsub!(/\267/) {"À"}
filename.gsub!(/\306/) {"ã"}
filename.gsub!(/\307/) {"Ã"}
filename.gsub!(/\317/) {"¤"}
filename.gsub!(/\322/) {"Ê"}
filename.gsub!(/\323/) {"Ë"}
filename.gsub!(/\324/) {"È"}
filename.gsub!(/\327/) {"Î"}
filename.gsub!(/\330/) {"Ï"}
filename.gsub!(/\336/) {"Ì"}
filename.gsub!(/\342/) {"Ô"}
filename.gsub!(/\343/) {"Ò"}
filename.gsub!(/\344/) {"õ"}
filename.gsub!(/\345/) {"Õ"}
filename.gsub!(/\346/) {"µ"}
filename.gsub!(/\352/) {"Û"}
filename.gsub!(/\353/) {"Ù"}
filename.gsub!(/\365/) {"§"}
filename.gsub!(/\370/) {"°"}
filename.gsub!(/\371/) {"¨"}
filename.gsub!(/\375/) {"²"}
return filename
end


def check_data
check_scripts
check_maps
check_common_events
check_actors
check_skills
check_items
check_weapons
check_armors
check_enemies
check_troops
check_states
check_animations
check_tilesets
check_systems
end

def check_scripts
if @scripts_check == true
for i in 0...$RGSS_SCRIPTS.size
name = [$RGSS_SCRIPTS[i][3].downcase, "Scripts " + $RGSS_SCRIPTS[i][1]]
@game_scripts.push(name)
end
end
end

def check_maps
for map_id in 1..999
map_name = sprintf("Data/Map%03d.rxdata", map_id)
next if FileTest.exist?(map_name) == false
map = load_data(map_name)
@tilesets_id_list.push(map.tileset_id)
map_info = load_data("Data/MapInfos.rxdata")
map_name = map_info[map_id].name
name0 = "Map n° "+map_id.to_s+" "+map_name
if @audio_scan == true
if @bgm_scan == true and map.autoplay_bgm == true
name = [map.bgm.name, name0+" Musique automatique"]
@game_bgm.push(name)
end
if @bgs_scan == true and map.autoplay_bgs == true
name = [map.bgs.name, name0+" Fond sonore automatique"]
@game_bgs.push(name)
end
end
for map_event in map.events.values
for i in 0...map_event.pages.size
name1 = name0+" Evènement n° "+map_event.id.to_s+" Page n° "+(i+1).to_s
if @characters_scan == true
name = [map_event.pages[i].graphic.character_name, name1+" Apparence"]
@game_characters.push(name)
end
for j in 0...map_event.pages[i].list.size
name = name1+" Commande de l'évènement n° "+(j+1).to_s
check_event_command(map_event.pages[i].list[j], name)
end
for j in 0...map_event.pages[i].move_route.list.size
name = name1+" Déplacement de l'évènement n° "+(j+1).to_s
check_move_command(map_event.pages[i].move_route.list[j], name)
end
end
end
end
end

def check_common_events
for i in 1...$data_common_events.size
for j in 0...$data_common_events[i].list.size
name = "Evènement commun n° "+sprintf("%03d",i)+" Commande de l'évènement n° "+(j+1).to_s
check_event_command($data_common_events[i].list[j], name)
end
end
end

def check_event_command(event, name0)
code = event.code
@animations_id_list.push(event.parameters[1]) if code == 207
@animations_id_list.push(event.parameters[2]) if code == 337
if @scripts_check == true and (code == 355 or code == 655)
name = [event.parameters[0].downcase, name0]
@game_scripts.push(name)
end
if @audio_scan == true
if @bgm_scan == true and (code == 241 or code == 132)
name = [event.parameters[0].name, name0]
@game_bgm.push(name)
end
if @bgs_scan == true and code == 245
name = [event.parameters[0].name, name0]
@game_bgs.push(name)
end
if @me_scan == true and (code == 249 or code == 133)
name = [event.parameters[0].name, name0]
@game_me.push(name)
end
if @se_scan == true and code == 250
name = [event.parameters[0].name, name0]
@game_se.push(name)
end
end
if @graphics_scan == true
if @battlebacks_scan == true and code == 204
if event.parameters[0] == 2
name = [event.parameters[1], name0]
@game_battlebacks.push(name)
end
end
if @battlers_scan == true and code == 322
name = [event.parameters[3], name0]
@game_battlers.push(name)
end
if @characters_scan == true and code == 322
name = [event.parameters[1], name0]
@game_characters.push(name)
end
if @fogs_scan == true and code == 204
if event.parameters[0] == 1
name = [event.parameters[1], name0]
@game_fogs.push(name)
end
end
if @panoramas_scan == true and code == 204
if event.parameters[0] == 0
name = [event.parameters[1], name0]
@game_panoramas.push(name)
end
end
if @pictures_scan == true and code == 231
name = [event.parameters[1], name0]
@game_pictures.push(name)
end
if @transitions_scan == true and code == 222
name = [event.parameters[0], name0]
@game_transitions.push(name)
end
if @windowskins_scan == true and code == 131
name = [event.parameters[0], name0]
@game_windowskins.push(name)
end
end
check_move_command(event.parameters[0], name0) if code == 509
end

def check_move_command(event, name0)
code = event.code
if @scripts_check == true and code == 45
name = [event.parameters[0].downcase, name0]
@game_scripts.push(name)
end
if @se_scan == true and code == 44
name = [event.parameters[0].name, name0]
@game_se.push(name)
end
if @characters_scan == true and code == 41
name = [event.parameters[0], name0]
@game_characters.push(name)
end
end

def check_actors
if @graphics_scan == true
for i in 1...$data_actors.size
name0 = "Héros n° "+sprintf("%03d",i)
if @characters_scan == true
name = [$data_actors[i].character_name, name0+" Apparence"]
@game_characters.push(name)
end
if @battlers_scan == true
name = [$data_actors[i].battler_name, name0+" Apparence en combat"]
@game_battlers.push(name)
end
end
end
end

def check_skills
for i in 1...$data_skills.size
@animations_id_list.push($data_skills[i].animation1_id)
@animations_id_list.push($data_skills[i].animation2_id)
name0 = "Compétence n° "+sprintf("%03d",i)
if @se_scan == true
name = [$data_skills[i].menu_se.name, name0+" Effet sonore dans le menu"]
@game_se.push(name)
end
if @icons_scan == true
name = [$data_skills[i].icon_name, name0+" Icône"]
@game_icons.push(name)
end
end
end

def check_items
for i in 1...$data_items.size
@animations_id_list.push($data_items[i].animation1_id)
@animations_id_list.push($data_items[i].animation2_id)
name0 = "Objet n° "+sprintf("%03d",i)
if @se_scan == true
name = [$data_items[i].menu_se.name, name0+" Effet sonore dans le menu"]
@game_se.push(name)
end
if @icons_scan == true
name = [$data_items[i].icon_name, name0+" Icône"]
@game_icons.push(name)
end
end
end

def check_weapons
for i in 1...$data_weapons.size
@animations_id_list.push($data_weapons[i].animation1_id)
@animations_id_list.push($data_weapons[i].animation2_id)
if @icons_scan == true
name = [$data_weapons[i].icon_name, "Arme n° "+sprintf("%03d",i)+" Icône"]
@game_icons.push(name)
end
end
end

def check_armors
if @icons_scan == true
for i in 1...$data_armors.size
name = [$data_armors[i].icon_name, "Armure n° "+sprintf("%03d",i)+" Icône"]
@game_icons.push(name)
end
end
end

def check_enemies
for i in 1...$data_enemies.size
@animations_id_list.push($data_enemies[i].animation1_id)
@animations_id_list.push($data_enemies[i].animation2_id)
if @battlers_scan == true
name = [$data_enemies[i].battler_name, "Ennemi n° "+sprintf("%03d",i)+" Apparence"]
@game_battlers.push(name)
end
end
end

def check_troops
for i in 1...$data_troops.size
for j in 0...$data_troops[i].pages.size
for k in 0...$data_troops[i].pages[j].list.size
name = "Groupe de monstre n° "+sprintf("%03d",i)+" Evènement de combat Page n° "+(j+1).to_s+" Commande de l'évènement n° "+(k+1).to_s
check_event_command($data_troops[i].pages[j].list[k], name)
end
end
end
end

def check_states
for i in 1...$data_states.size
@animations_id_list.push($data_states[i].animation_id)
end
end

def check_animations
for i in 1...$data_animations.size
name0 = "Animation n° "+sprintf("%03d",i)
if @se_scan == true
for j in 0...$data_animations[i].timings.size
name = [$data_animations[i].timings[j].se.name, name0+" Effet sonore"]
if @animations_id_list.include?(i)
@game_se.push(name)
else
@game2_se.push(name)
end
end
end
if @animations_scan == true
name = [$data_animations[i].animation_name, name0+" Fichier d'animation"]
if @animations_id_list.include?(i)
@game_animations.push(name)
else
@game2_animations.push(name)
end
end
end
end

def check_tilesets
if @graphics_scan == true
for i in 1...$data_tilesets.size
name0 = "Chipset n° "+sprintf("%03d",i)
if @tilesets_scan == true
name = [$data_tilesets[i].tileset_name, name0+" Fichier du chipset"]
if @tilesets_id_list.include?(i)
@game_tilesets.push(name)
else
@game2_tilesets.push(name)
end
end
if @autotiles_scan == true
for j in 0...$data_tilesets[i].autotile_names.size
name = [$data_tilesets[i].autotile_names[j], name0+" Carreau auto-liable n° "+(j+1).to_s]
if @tilesets_id_list.include?(i)
@game_autotiles.push(name)
else
@game2_autotiles.push(name)
end
end
end
if @panoramas_scan == true
name = [$data_tilesets[i].panorama_name, name0+" Panorama"]
if @tilesets_id_list.include?(i)
@game_panoramas.push(name)
else
@game2_panoramas.push(name)
end
end
if @fogs_scan == true
name = [$data_tilesets[i].fog_name, name0+" Brouillard"]
if @tilesets_id_list.include?(i)
@game_fogs.push(name)
else
@game2_fogs.push(name)
end
end
if @battlebacks_scan == true
name = [$data_tilesets[i].battleback_name, name0+" Arrière plan des combats"]
if @tilesets_id_list.include?(i)
@game_battlebacks.push(name)
else
@game2_battlebacks.push(name)
end
end
end
end
end

def check_systems
if @audio_scan == true
name0 = "Système Musique"
if @bgm_scan == true
name = [$data_system.title_bgm.name, name0+" de l'écran titre"]
@game_bgm.push(name)
name = [$data_system.battle_bgm.name, name0+" des combats"]
@game_bgm.push(name)
end
if @me_scan == true
name = [$data_system.battle_end_me.name, name0+" de victoire"]
@game_me.push(name)
name = [$data_system.gameover_me.name, name0+" de gameover"]
@game_me.push(name)
end
name0 = "Système Effet sonore"
if @se_scan == true
name = [$data_system.cursor_se.name, name0+" du curseur"]
@game_se.push(name)
name = [$data_system.decision_se.name, name0+" de validation"]
@game_se.push(name)
name = [$data_system.cancel_se.name, name0+" d'annulation"]
@game_se.push(name)
name = [$data_system.buzzer_se.name, name0+" du buzzer"]
@game_se.push(name)
name = [$data_system.equip_se.name, name0+" d'équipement"]
@game_se.push(name)
name = [$data_system.shop_se.name, name0+" d'achat"]
@game_se.push(name)
name = [$data_system.save_se.name, name0+" de sauvegarde"]
@game_se.push(name)
name = [$data_system.load_se.name, name0+" de chargement"]
@game_se.push(name)
name = [$data_system.battle_start_se.name, name0+" de début de combat"]
@game_se.push(name)
name = [$data_system.escape_se.name, name0+" de fuite"]
@game_se.push(name)
name = [$data_system.actor_collapse_se.name, name0+" de mort d'un héros"]
@game_se.push(name)
name = [$data_system.enemy_collapse_se.name, name0+" de mort d'un ennemi"]
@game_se.push(name)
end
end
if @graphics_scan == true
if @battlers_scan == true
name = [$data_system.battler_name, "Système Apparence de la cible des animations"]
@game_battlers.push(name)
end
if @windowskins_scan == true
name = [$data_system.windowskin_name, "Système Apparence des fenêtres"]
@game_windowskins.push(name)
end
if @titles_scan == true
name = [$data_system.title_name, "Système Ecran titre"]
@game_titles.push(name)
end
if @gameovers_scan == true
name = [$data_system.gameover_name, "Système Ecran de gameover"]
@game_gameovers.push(name)
end
if @transitions_scan == true
name = [$data_system.battle_transition, "Système Transition vers les combats"]
@game_transitions.push(name)
end
end
end


def makefile
file = File.open("Scan.log", "w")
write_head(file) if @head_write == true
write_body(file) if (@used_write || @used2_write || @used3_write || @missed_write || @useless_write || @statistics_write) == true
file.close
File.delete("Scan.tmp")
end

def write_head(file)
file.write("Légende :\n\n")
file.write("\t- Fichiers manquants :\n")
file.write("\t\tCela correspond aux fichiers qui sont utilisés dans le jeu mais qui ne se trouvent pas dans le projet.\n")
file.write("\t\tJe tiens à préciser que les ressources sont recherchées uniquement dans le projet et pas dans les RTP.\n\n")
file.write("\t- Fichiers inutiles :\n")
file.write("\t\tCela correspond aux fichiers qui ne sont pas utilisés dans le jeu mais qui se trouvent quand même dans le projet.\n\n")
file.write("\t- Fichiers utilisés :\n")
file.write("\t\tCela correspond aux fichiers qui sont utilisés dans le jeu et qui se trouvent bien dans le projet.\n\n")
file.write("\t- Fichiers utilisés en animation :\n")
file.write("\t\tCela correspond aux fichiers qui sont utilisés dans le jeu mais uniquement dans des animations qui elles ne sont pas utilisées.\n")
file.write("\t\tLes fichiers présents dans le projet seront marqués d'un rond, les autres d'une croix.\n")
file.write("\t\tCe sont des ressources inutiles mais je les ai mise de côté au cas ou ce serait volontaire.\n")
file.write("\t\tSi c'est le cas les fichiers marqués d'une croix sont manquants.\n")
file.write("\t\tDans le cas contraire les fichiers marqués d'un rond sont inutiles.\n")
file.write("\t\t\tExemple :\tSoit une animation A.\n")
file.write("\t\t\t\t\tA est définie dans les animations mais n'est utilisée nulle part dans le jeu.\n")
file.write("\t\t\t\t\tLe fichier d'animation de A ainsi que les fichiers SE utilisés dans A seront alors considérés comme des fichiers utilisés en animation.\n")
file.write("\t\t\t\t\tA condition bien sûr qu'ils ne soient pas déjà dans les Fichiers utilisés.\n")
file.write("\t- Fichiers utilisés en chipset :\n")
file.write("\t\tCela correspond aux fichiers qui sont utilisés dans le jeu mais uniquement dans des chipsets qui eux ne sont pas utilisés.\n")
file.write("\t\tLe principe est le même que pour les fichiers utilisés en animation.\n\n")
file.write("\t- Fichiers utilisés en script :\n")
file.write("\t\tCela correspond aux fichiers qui sont utilisés uniquement dans les scripts.\n")
file.write("\t\tMais contrairement à tout le reste ce n'est pas fiable à 100%, les erreurs possibles sont décrites ci-dessous.\n")
file.write("\t\tMais ce n'est pas très grave car vous pourrez toujours aller vérifier vous même dans les scripts aux lignes indiqués.\n")
file.write("\t\tVous pourrez donc juger si c'est une ressource utilisée ou inutile.\n\n\n")
file.write("Erreurs possibles :\n\n")
file.write("\t- Dans les statistiques, la taille de l'espace libérable indiqué peut être inférieure à la réalité.\n")
file.write("\t Cela est dû au fait que ça n'arrive pas à lire la taille des fichiers avec des caractères spéciaux comme le é par exemple (Va savoir pourquoi).\n")
file.write("\t Si vous n'utilisez pas les scripts désactivez la recherche dans les scripts et il n'y aura plus aucune autre erreur possible.\n\n")
file.write("\t- Les fichiers se trouvants dans des dossiers différents de ceux d'origine ne seront pas détectés, par contre il n'y a aucun problème en ce qui concerne les sous-dossiers.\n\n")
file.write("\t- Les fichiers utilisés uniquement dans des scripts avec des noms composés tel que : nom_de_ma_musique = 'Audio' + i.to_s ne seront pas détectés.\n")
file.write("\t Les seuls fichiers qui seront détectés seront ceux écrits entre deux \" ou deux ' ou deux /.\n\n")
file.write("\t- L'utilisation d'une animation ne sera pas détecté si elle est faite dans un script.\n\n")
file.write("\t- Les fichiers utilisés uniquement dans des scripts ne seront pas considérés comme fichiers manquants même s'ils le sont.\n\n")
file.write("\t- Les fichiers avec des noms identiques seront confondus dans les scripts.\n")
file.write("\t\tExemple :\tUn fichier SE nommé 'Vache' est utilisé, entre autre, dans un script.\n")
file.write("\t\t\t\tUn fichier ME nommé 'Vache' lui aussi, n'est utilisé nulle part.\n")
file.write("\t\t\t\tEt bien les fichiers 'Vache' seront tous les deux considérés comme utilisés.\n")
file.write("\t\t\t\tDe même un fichier nommé 'Temps', quelle que soit son dossier, sera considéré comme utilisé parce que quelque part dans les scripts il y a écrit 'Temps'.\n")
file.write("\t\t\t\tPar contre si vous mettez les noms des répertoires et l'extension dans le nom du fichier, ce problème ne se pose pas.\n\n\n")
file.write("Crédits :\n\n")
file.write("\tCe script magnifique vous a été proposer par le fabuleux Zeus81 !\n")
file.write("\tSi vous cherchez d'autres scripts magnifiques, tous mes scripts sont disponibles sur www.rpgmaker.fr\n")">http://www.mediafire.com/?wjzhmzzjvgw[url]

[code]#=================================
# Ressources Scanner
# Script créé par Zeus81
#=================================
#
#
# Pour l'utiliser faire insérer un script et écrire :
# $scene = Scene_Scan.new
# Sinon vous pouvez aussi l'écrire en dessous de $scene = Scene_Title.new
# dans le Main pour qu'il se lance automatiquement au démarrage
# comme ça c'est plus rapide !
#
# Si il y a quelque chose que vous ne comprenez pas faites un scan en mettant
# juste "Afficher l'en-tête" et tout sera expliquer.

class Window_Scan < Window_Selectable

attr_reader :phase

def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Comic Sans MS"
self.phase = 0
viewport = Viewport.new(366, 406, 168, 20)
viewport.z = 9999
@sprite = Sprite.new(viewport)
@sprite.bitmap = Bitmap.new(40, 20)
for i in 0...20
@sprite.bitmap.fill_rect(i, 0, 40-2*i, 20, Color.new(0, 255, 0, 13*i))
end
@text = Sprite.new(viewport)
@text.bitmap = Bitmap.new(168, 20)
@text.bitmap.font.name = "Comic Sans MS"
@text.bitmap.font.size = 20
@text.bitmap.font.color = normal_color
@text.bitmap.draw_text(0, 0, 168, 20, "Analyse en cours", 1)
refresh
end

def update_scan_bar
@sprite.x += 1
@sprite.x = -40 if @sprite.x >= 168
end

def draw_scan_bar
@sprite.visible = true
@text.visible = true
self.contents.fill_rect(349, 389, 170, 22, Color.new(0, 0, 0))
end

def refresh
@sprite.visible = false
@text.visible = false
@sprite.x = -40
self.contents.clear
self.contents.fill_rect(0, 32, 608, 1, normal_color)
self.contents.fill_rect(256, 32, 1, 416, normal_color)
self.contents.fill_rect(256, 296, 352, 1, normal_color)

self.contents.font.size = 28
self.contents.font.color = knockout_color
self.contents.draw_text(0, 0, 608, 32, "Ressources Scanner", 1)

self.contents.font.size = 20
self.contents.font.color = crisis_color
self.contents.draw_text(0, 32, 256, 32, "Fichiers à analyser", 1)
self.contents.draw_text(256, 32, 352, 32, "Options de configuration", 1)

self.contents.font.color = normal_color
self.contents.draw_text(0, 64, 128, 32, "Audio", 1)
self.contents.draw_text(0, 96, 128, 32, "BGM", 1)
self.contents.draw_text(0, 120, 128, 32, "BGS", 1)
self.contents.draw_text(0, 144, 128, 32, "ME", 1)
self.contents.draw_text(0, 168, 128, 32, "SE", 1)

self.contents.draw_text(128, 64, 128, 32, "Graphics", 1)
self.contents.draw_text(128, 96, 128, 32, "Animations", 1)
self.contents.draw_text(128, 120, 128, 32, "Autotiles", 1)
self.contents.draw_text(128, 144, 128, 32, "Battlebacks", 1)
self.contents.draw_text(128, 168, 128, 32, "Battlers", 1)
self.contents.draw_text(128, 192, 128, 32, "Characters", 1)
self.contents.draw_text(128, 216, 128, 32, "Fogs", 1)
self.contents.draw_text(128, 240, 128, 32, "Gameovers", 1)
self.contents.draw_text(128, 264, 128, 32, "Icons", 1)
self.contents.draw_text(128, 288, 128, 32, "Panoramas", 1)
self.contents.draw_text(128, 312, 128, 32, "Pictures", 1)
self.contents.draw_text(128, 336, 128, 32, "Tilesets", 1)
self.contents.draw_text(128, 360, 128, 32, "Titles", 1)
self.contents.draw_text(128, 384, 128, 32, "Transitions", 1)
self.contents.draw_text(128, 408, 128, 32, "Windowskins", 1)

self.contents.draw_text(256, 64, 352, 32, " Rechercher aussi dans les scripts")

self.contents.draw_text(256, 96, 352, 32, " Afficher l'en-tête (Légende, etc...)")
self.contents.draw_text(256, 120, 352, 32, " Afficher les fichiers :")
self.contents.draw_text(256, 144, 352, 32, " - utilisés")
self.contents.draw_text(256, 168, 352, 32, " - utilisés en animation / chipset")
self.contents.draw_text(256, 192, 352, 32, " - utilisés en script")
self.contents.draw_text(256, 216, 352, 32, " - manquants")
self.contents.draw_text(256, 240, 352, 32, " - inutiles")
self.contents.draw_text(256, 264, 352, 32, " Afficher les statistiques")

self.contents.draw_text(256, 328, 352, 32, "Tout sélectionner", 1)
self.contents.draw_text(256, 352, 352, 32, "Tout désélectionner", 1)

self.contents.draw_text(256, 384, 352, 32, "Commencer l'analyse", 1)

draw_states
end

def draw_states
draw_state(0, 64, $scene.audio_scan)
draw_state(0, 96, $scene.bgm_scan)
draw_state(0, 120, $scene.bgs_scan)
draw_state(0, 144, $scene.me_scan)
draw_state(0, 168, $scene.se_scan)

draw_state(128, 64, $scene.graphics_scan)
draw_state(128, 96, $scene.animations_scan)
draw_state(128, 120, $scene.autotiles_scan)
draw_state(128, 144, $scene.battlebacks_scan)
draw_state(128, 168, $scene.battlers_scan)
draw_state(128, 192, $scene.characters_scan)
draw_state(128, 216, $scene.fogs_scan)
draw_state(128, 240, $scene.gameovers_scan)
draw_state(128, 264, $scene.icons_scan)
draw_state(128, 288, $scene.panoramas_scan)
draw_state(128, 312, $scene.pictures_scan)
draw_state(128, 336, $scene.tilesets_scan)
draw_state(128, 360, $scene.titles_scan)
draw_state(128, 384, $scene.transitions_scan)
draw_state(128, 408, $scene.windowskins_scan)

draw_state(256+8, 64, $scene.scripts_check)

draw_state(256+8, 96, $scene.head_write)
draw_state(256+8, 144, $scene.used_write)
draw_state(256+8, 168, $scene.used2_write)
draw_state(256+8, 192, $scene.used3_write)
draw_state(256+8, 216, $scene.missed_write)
draw_state(256+8, 240, $scene.useless_write)
draw_state(256+8, 264, $scene.statistics_write)
end

def draw_state(x, y, state)
if state == true
color = Color.new(34, 161, 34)
else
color = Color.new(128, 128, 128)
end
self.contents.fill_rect(x+3, y+11, 10, 10, Color.new(29, 82, 129))
self.contents.fill_rect(x+4, y+12, 8, 8, Color.new(255, 255, 255))
self.contents.fill_rect(x+5, y+13, 6, 6, color)
end

def phase=(phase)
@phase = phase
@phase %= 3
@index = 0
if @phase == 0
@item_max = 5
elsif @phase == 1
@item_max = 15
elsif @phase == 2
@item_max = 11
end
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
x = @phase * 128
y = @index == 0 ? 68 : @index*24+76
w = 120
if @phase == 2
x = 264
w = 344
y += 24 if @index > 1
if @index > 7
x = 348
y += 40
w = 172
end
y += 8 if @index > 9
end
self.cursor_rect.set(x, y, w, 24)
end

end


class Scene_Scan


attr_reader :audio_scan
attr_reader :bgm_scan
attr_reader :bgs_scan
attr_reader :me_scan
attr_reader :se_scan
attr_reader :graphics_scan
attr_reader :animations_scan
attr_reader :autotiles_scan
attr_reader :battlebacks_scan
attr_reader :battlers_scan
attr_reader :characters_scan
attr_reader :fogs_scan
attr_reader :gameovers_scan
attr_reader :icons_scan
attr_reader :panoramas_scan
attr_reader :pictures_scan
attr_reader :tilesets_scan
attr_reader :titles_scan
attr_reader :transitions_scan
attr_reader :windowskins_scan
attr_reader :scripts_check
attr_reader :head_write
attr_reader :used_write
attr_reader :used2_write
attr_reader :used3_write
attr_reader :missed_write
attr_reader :useless_write
attr_reader :statistics_write


def initialize
GC.disable

$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new

audio(true)
graphics(true)
@scripts_check = false
@head_write = true
@used_write = true
@used2_write = true
@used3_write = true
@missed_write = true
@useless_write = true
@statistics_write = true

@thread_start = false
@thread = Thread.new do
loop do
sleep
@scan_window.draw_scan_bar
@thread_start = true
while(@thread_start == true)
@scan_window.update_scan_bar
Graphics.update
sleep(0.02)
end
@scan_window.refresh
end
end
end

def audio(state)
@audio_scan = state
@bgm_scan = state
@bgs_scan = state
@me_scan = state
@se_scan = state
end

def graphics(state)
@graphics_scan = state
@animations_scan = state
@autotiles_scan = state
@battlebacks_scan = state
@battlers_scan = state
@characters_scan = state
@fogs_scan = state
@gameovers_scan = state
@icons_scan = state
@panoramas_scan = state
@pictures_scan = state
@tilesets_scan = state
@titles_scan = state
@transitions_scan = state
@windowskins_scan = state
end


def main
@scan_window = Window_Scan.new
Graphics.transition
loop do
update
Graphics.update
Input.update
end
end


def update
@scan_window.update
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@scan_window.phase -= 1
elsif Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@scan_window.phase += 1
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
index = @scan_window.index
case @scan_window.phase
when 0
audio(!@audio_scan) if index == 0
@bgm_scan = !@bgm_scan if index == 1
@bgs_scan = !@bgs_scan if index == 2
@me_scan = !@me_scan if index == 3
@se_scan = !@se_scan if index == 4
@audio_scan = (@bgm_scan || @bgs_scan || @me_scan || @se_scan)
when 1
graphics(!@graphics_scan) if index == 0
@animations_scan = !@animations_scan if index == 1
@autotiles_scan = !@autotiles_scan if index == 2
@battlebacks_scan = !@battlebacks_scan if index == 3
@battlers_scan = !@battlers_scan if index == 4
@characters_scan = !@characters_scan if index == 5
@fogs_scan = !@fogs_scan if index == 6
@gameovers_scan = !@gameovers_scan if index == 7
@icons_scan = !@icons_scan if index == 8
@panoramas_scan = !@panoramas_scan if index == 9
@pictures_scan = !@pictures_scan if index == 10
@tilesets_scan = !@tilesets_scan if index == 11
@titles_scan = !@titles_scan if index == 12
@transitions_scan = !@transitions_scan if index == 13
@windowskins_scan = !@windowskins_scan if index == 14
@graphics_scan = (@animations_scan || @autotiles_scan || @battlebacks_scan ||
@battlers_scan || @characters_scan || @fogs_scan ||
@gameovers_scan || @icons_scan || @panoramas_scan ||
@pictures_scan || @tilesets_scan || @titles_scan ||
@transitions_scan || @windowskins_scan)
when 2
@scripts_check = !@scripts_check if index == 0
@head_write = !@head_write if index == 1
@used_write = !@used_write if index == 2
@used2_write = !@used2_write if index == 3
@used3_write = !@used3_write if index == 4
@missed_write = !@missed_write if index == 5
@useless_write = !@useless_write if index == 6
@statistics_write = !@statistics_write if index == 7
if index == 8 or index == 9
state = (index == 8)
audio(state)
graphics(state)
@scripts_check = state
@head_write = state
@used_write = state
@used2_write = state
@used3_write = state
@missed_write = state
@useless_write = state
@statistics_write = state
end
start_scan if index == 10
end
@scan_window.draw_states
end
end


def start_scan
@thread.wakeup
initialize_arrays
scan_data
check_data
makefile
@thread_start = false
print(" L'analyse est terminé !\n",
" Le résultat se trouve dans le fichier\n",
"\"Scan.log\" dans le dossier de votre jeu.")
end


def initialize_arrays
@scan_bgm = []
@scan_bgs = []
@scan_me = []
@scan_se = []
@scan_animations = []
@scan_autotiles = []
@scan_battlebacks = []
@scan_battlers = []
@scan_characters = []
@scan_fogs = []
@scan_gameovers = []
@scan_icons = []
@scan_panoramas = []
@scan_pictures = []
@scan_tilesets = []
@scan_titles = []
@scan_transitions = []
@scan_windowskins = []

@game_bgm = []
@game_bgs = []
@game_me = []
@game_se = []
@game_animations = []
@game_autotiles = []
@game_battlebacks = []
@game_battlers = []
@game_characters = []
@game_fogs = []
@game_gameovers = []
@game_icons = []
@game_panoramas = []
@game_pictures = []
@game_tilesets = []
@game_titles = []
@game_transitions = []
@game_windowskins = []
@game_scripts = []

@animations_id_list = []
@tilesets_id_list = []
@game2_se = []
@game2_animations = []
@game2_autotiles = []
@game2_battlebacks = []
@game2_fogs = []
@game2_panoramas = []
@game2_tilesets = []
end


def scan_data
system("dir /A-D-S /B /S > Scan.tmp")
file = File.open("Scan.tmp")
filenames = file.readlines
file.close
path = File.expand_path("").gsub("/"){"\\"} + "\\"
for i in 0...filenames.size
filenames[i] = correct(filenames[i])
filenames[i][path] = ""
filenames[i][-1,1] = ""
if filenames[i][0, 6] == "Audio\\"
if @audio_scan == true
filenames[i][0, 6] = ""
if filenames[i][0, 4] == "BGM\\"
if @bgm_scan == true
filenames[i][0, 4] = ""
@scan_bgm.push(filenames[i])
end
elsif filenames[i][0, 4] == "BGS\\"
if @bgs_scan == true
filenames[i][0, 4] = ""
@scan_bgs.push(filenames[i])
end
elsif filenames[i][0, 3] == "ME\\"
if @me_scan == true
filenames[i][0, 3] = ""
@scan_me.push(filenames[i])
end
elsif filenames[i][0, 3] == "SE\\"
if @se_scan == true
filenames[i][0, 3] = ""
@scan_se.push(filenames[i])
end
end
end
elsif filenames[i][0, 9] == "Graphics\\"
if @graphics_scan == true
filenames[i][0, 9] = ""
if filenames[i][0, 11] == "Animations\\"
if @animations_scan == true
filenames[i][0, 11] = ""
@scan_animations.push(filenames[i])
end
elsif filenames[i][0, 10] == "Autotiles\\"
if @autotiles_scan == true
filenames[i][0, 10] = ""
@scan_autotiles.push(filenames[i])
end
elsif filenames[i][0, 12] == "Battlebacks\\"
if @battlebacks_scan == true
filenames[i][0, 12] = ""
@scan_battlebacks.push(filenames[i])
end
elsif filenames[i][0, 9] == "Battlers\\"
if @battlers_scan == true
filenames[i][0, 9] = ""
@scan_battlers.push(filenames[i])
end
elsif filenames[i][0, 11] == "Characters\\"
if @characters_scan == true
filenames[i][0, 11] = ""
@scan_characters.push(filenames[i])
end
elsif filenames[i][0, 5] == "Fogs\\"
if @fogs_scan == true
filenames[i][0, 5] = ""
@scan_fogs.push(filenames[i])
end
elsif filenames[i][0, 10] == "Gameovers\\"
if @gameovers_scan == true
filenames[i][0, 10] = ""
@scan_gameovers.push(filenames[i])
end
elsif filenames[i][0, 6] == "Icons\\"
if @icons_scan == true
filenames[i][0, 6] = ""
@scan_icons.push(filenames[i])
end
elsif filenames[i][0, 10] == "Panoramas\\"
if @panoramas_scan == true
filenames[i][0, 10] = ""
@scan_panoramas.push(filenames[i])
end
elsif filenames[i][0, 9] == "Pictures\\"
if @pictures_scan == true
filenames[i][0, 9] = ""
@scan_pictures.push(filenames[i])
end
elsif filenames[i][0, 9] == "Tilesets\\"
if @tilesets_scan == true
filenames[i][0, 9] = ""
@scan_tilesets.push(filenames[i])
end
elsif filenames[i][0, 7] == "Titles\\"
if @titles_scan == true
filenames[i][0, 7] = ""
@scan_titles.push(filenames[i])
end
elsif filenames[i][0, 12] == "Transitions\\"
if @transitions_scan == true
filenames[i][0, 12] = ""
@scan_transitions.push(filenames[i])
end
elsif filenames[i][0, 12] == "Windowskins\\"
if @windowskins_scan == true
filenames[i][0, 12] = ""
@scan_windowskins.push(filenames[i])
end
end
end
end
end
end

def correct(filename)
filename.gsub!(/\201/) {"ü"}
filename.gsub!(/\202/) {"é"}
filename.gsub!(/\203/) {"â"}
filename.gsub!(/\204/) {"ä"}
filename.gsub!(/\205/) {"à"}
filename.gsub!(/\207/) {"ç"}
filename.gsub!(/\210/) {"ê"}
filename.gsub!(/\211/) {"ë"}
filename.gsub!(/\212/) {"è"}
filename.gsub!(/\213/) {"ï"}
filename.gsub!(/\214/) {"î"}
filename.gsub!(/\215/) {"ì"}
filename.gsub!(/\216/) {"Ä"}
filename.gsub!(/\223/) {"ô"}
filename.gsub!(/\224/) {"ö"}
filename.gsub!(/\225/) {"ò"}
filename.gsub!(/\226/) {"û"}
filename.gsub!(/\227/) {"ù"}
filename.gsub!(/\230/) {"ÿ"}
filename.gsub!(/\231/) {"Ö"}
filename.gsub!(/\232/) {"Ü"}
filename.gsub!(/\234/) {"£"}
filename.gsub!(/\266/) {"Â"}
filename.gsub!(/\267/) {"À"}
filename.gsub!(/\306/) {"ã"}
filename.gsub!(/\307/) {"Ã"}
filename.gsub!(/\317/) {"¤"}
filename.gsub!(/\322/) {"Ê"}
filename.gsub!(/\323/) {"Ë"}
filename.gsub!(/\324/) {"È"}
filename.gsub!(/\327/) {"Î"}
filename.gsub!(/\330/) {"Ï"}
filename.gsub!(/\336/) {"Ì"}
filename.gsub!(/\342/) {"Ô"}
filename.gsub!(/\343/) {"Ò"}
filename.gsub!(/\344/) {"õ"}
filename.gsub!(/\345/) {"Õ"}
filename.gsub!(/\346/) {"µ"}
filename.gsub!(/\352/) {"Û"}
filename.gsub!(/\353/) {"Ù"}
filename.gsub!(/\365/) {"§"}
filename.gsub!(/\370/) {"°"}
filename.gsub!(/\371/) {"¨"}
filename.gsub!(/\375/) {"²"}
return filename
end


def check_data
check_scripts
check_maps
check_common_events
check_actors
check_skills
check_items
check_weapons
check_armors
check_enemies
check_troops
check_states
check_animations
check_tilesets
check_systems
end

def check_scripts
if @scripts_check == true
for i in 0...$RGSS_SCRIPTS.size
name = [$RGSS_SCRIPTS[i][3].downcase, "Scripts " + $RGSS_SCRIPTS[i][1]]
@game_scripts.push(name)
end
end
end

def check_maps
for map_id in 1..999
map_name = sprintf("Data/Map%03d.rxdata", map_id)
next if FileTest.exist?(map_name) == false
map = load_data(map_name)
@tilesets_id_list.push(map.tileset_id)
map_info = load_data("Data/MapInfos.rxdata")
map_name = map_info[map_id].name
name0 = "Map n° "+map_id.to_s+" "+map_name
if @audio_scan == true
if @bgm_scan == true and map.autoplay_bgm == true
name = [map.bgm.name, name0+" Musique automatique"]
@game_bgm.push(name)
end
if @bgs_scan == true and map.autoplay_bgs == true
name = [map.bgs.name, name0+" Fond sonore automatique"]
@game_bgs.push(name)
end
end
for map_event in map.events.values
for i in 0...map_event.pages.size
name1 = name0+" Evènement n° "+map_event.id.to_s+" Page n° "+(i+1).to_s
if @characters_scan == true
name = [map_event.pages[i].graphic.character_name, name1+" Apparence"]
@game_characters.push(name)
end
for j in 0...map_event.pages[i].list.size
name = name1+" Commande de l'évènement n° "+(j+1).to_s
check_event_command(map_event.pages[i].list[j], name)
end
for j in 0...map_event.pages[i].move_route.list.size
name = name1+" Déplacement de l'évènement n° "+(j+1).to_s
check_move_command(map_event.pages[i].move_route.list[j], name)
end
end
end
end
end

def check_common_events
for i in 1...$data_common_events.size
for j in 0...$data_common_events[i].list.size
name = "Evènement commun n° "+sprintf("%03d",i)+" Commande de l'évènement n° "+(j+1).to_s
check_event_command($data_common_events[i].list[j], name)
end
end
end

def check_event_command(event, name0)
code = event.code
@animations_id_list.push(event.parameters[1]) if code == 207
@animations_id_list.push(event.parameters[2]) if code == 337
if @scripts_check == true and (code == 355 or code == 655)
name = [event.parameters[0].downcase, name0]
@game_scripts.push(name)
end
if @audio_scan == true
if @bgm_scan == true and (code == 241 or code == 132)
name = [event.parameters[0].name, name0]
@game_bgm.push(name)
end
if @bgs_scan == true and code == 245
name = [event.parameters[0].name, name0]
@game_bgs.push(name)
end
if @me_scan == true and (code == 249 or code == 133)
name = [event.parameters[0].name, name0]
@game_me.push(name)
end
if @se_scan == true and code == 250
name = [event.parameters[0].name, name0]
@game_se.push(name)
end
end
if @graphics_scan == true
if @battlebacks_scan == true and code == 204
if event.parameters[0] == 2
name = [event.parameters[1], name0]
@game_battlebacks.push(name)
end
end
if @battlers_scan == true and code == 322
name = [event.parameters[3], name0]
@game_battlers.push(name)
end
if @characters_scan == true and code == 322
name = [event.parameters[1], name0]
@game_characters.push(name)
end
if @fogs_scan == true and code == 204
if event.parameters[0] == 1
name = [event.parameters[1], name0]
@game_fogs.push(name)
end
end
if @panoramas_scan == true and code == 204
if event.parameters[0] == 0
name = [event.parameters[1], name0]
@game_panoramas.push(name)
end
end
if @pictures_scan == true and code == 231
name = [event.parameters[1], name0]
@game_pictures.push(name)
end
if @transitions_scan == true and code == 222
name = [event.parameters[0], name0]
@game_transitions.push(name)
end
if @windowskins_scan == true and code == 131
name = [event.parameters[0], name0]
@game_windowskins.push(name)
end
end
check_move_command(event.parameters[0], name0) if code == 509
end

def check_move_command(event, name0)
code = event.code
if @scripts_check == true and code == 45
name = [event.parameters[0].downcase, name0]
@game_scripts.push(name)
end
if @se_scan == true and code == 44
name = [event.parameters[0].name, name0]
@game_se.push(name)
end
if @characters_scan == true and code == 41
name = [event.parameters[0], name0]
@game_characters.push(name)
end
end

def check_actors
if @graphics_scan == true
for i in 1...$data_actors.size
name0 = "Héros n° "+sprintf("%03d",i)
if @characters_scan == true
name = [$data_actors[i].character_name, name0+" Apparence"]
@game_characters.push(name)
end
if @battlers_scan == true
name = [$data_actors[i].battler_name, name0+" Apparence en combat"]
@game_battlers.push(name)
end
end
end
end

def check_skills
for i in 1...$data_skills.size
@animations_id_list.push($data_skills[i].animation1_id)
@animations_id_list.push($data_skills[i].animation2_id)
name0 = "Compétence n° "+sprintf("%03d",i)
if @se_scan == true
name = [$data_skills[i].menu_se.name, name0+" Effet sonore dans le menu"]
@game_se.push(name)
end
if @icons_scan == true
name = [$data_skills[i].icon_name, name0+" Icône"]
@game_icons.push(name)
end
end
end

def check_items
for i in 1...$data_items.size
@animations_id_list.push($data_items[i].animation1_id)
@animations_id_list.push($data_items[i].animation2_id)
name0 = "Objet n° "+sprintf("%03d",i)
if @se_scan == true
name = [$data_items[i].menu_se.name, name0+" Effet sonore dans le menu"]
@game_se.push(name)
end
if @icons_scan == true
name = [$data_items[i].icon_name, name0+" Icône"]
@game_icons.push(name)
end
end
end

def check_weapons
for i in 1...$data_weapons.size
@animations_id_list.push($data_weapons[i].animation1_id)
@animations_id_list.push($data_weapons[i].animation2_id)
if @icons_scan == true
name = [$data_weapons[i].icon_name, "Arme n° "+sprintf("%03d",i)+" Icône"]
@game_icons.push(name)
end
end
end

def check_armors
if @icons_scan == true
for i in 1...$data_armors.size
name = [$data_armors[i].icon_name, "Armure n° "+sprintf("%03d",i)+" Icône"]
@game_icons.push(name)
end
end
end

def check_enemies
for i in 1...$data_enemies.size
@animations_id_list.push($data_enemies[i].animation1_id)
@animations_id_list.push($data_enemies[i].animation2_id)
if @battlers_scan == true
name = [$data_enemies[i].battler_name, "Ennemi n° "+sprintf("%03d",i)+" Apparence"]
@game_battlers.push(name)
end
end
end

def check_troops
for i in 1...$data_troops.size
for j in 0...$data_troops[i].pages.size
for k in 0...$data_troops[i].pages[j].list.size
name = "Groupe de monstre n° "+sprintf("%03d",i)+" Evènement de combat Page n° "+(j+1).to_s+" Commande de l'évènement n° "+(k+1).to_s
check_event_command($data_troops[i].pages[j].list[k], name)
end
end
end
end

def check_states
for i in 1...$data_states.size
@animations_id_list.push($data_states[i].animation_id)
end
end

def check_animations
for i in 1...$data_animations.size
name0 = "Animation n° "+sprintf("%03d",i)
if @se_scan == true
for j in 0...$data_animations[i].timings.size
name = [$data_animations[i].timings[j].se.name, name0+" Effet sonore"]
if @animations_id_list.include?(i)
@game_se.push(name)
else
@game2_se.push(name)
end
end
end
if @animations_scan == true
name = [$data_animations[i].animation_name, name0+" Fichier d'animation"]
if @animations_id_list.include?(i)
@game_animations.push(name)
else
@game2_animations.push(name)
end
end
end
end

def check_tilesets
if @graphics_scan == true
for i in 1...$data_tilesets.size
name0 = "Chipset n° "+sprintf("%03d",i)
if @tilesets_scan == true
name = [$data_tilesets[i].tileset_name, name0+" Fichier du chipset"]
if @tilesets_id_list.include?(i)
@game_tilesets.push(name)
else
@game2_tilesets.push(name)
end
end
if @autotiles_scan == true
for j in 0...$data_tilesets[i].autotile_names.size
name = [$data_tilesets[i].autotile_names[j], name0+" Carreau auto-liable n° "+(j+1).to_s]
if @tilesets_id_list.include?(i)
@game_autotiles.push(name)
else
@game2_autotiles.push(name)
end
end
end
if @panoramas_scan == true
name = [$data_tilesets[i].panorama_name, name0+" Panorama"]
if @tilesets_id_list.include?(i)
@game_panoramas.push(name)
else
@game2_panoramas.push(name)
end
end
if @fogs_scan == true
name = [$data_tilesets[i].fog_name, name0+" Brouillard"]
if @tilesets_id_list.include?(i)
@game_fogs.push(name)
else
@game2_fogs.push(name)
end
end
if @battlebacks_scan == true
name = [$data_tilesets[i].battleback_name, name0+" Arrière plan des combats"]
if @tilesets_id_list.include?(i)
@game_battlebacks.push(name)
else
@game2_battlebacks.push(name)
end
end
end
end
end

def check_systems
if @audio_scan == true
name0 = "Système Musique"
if @bgm_scan == true
name = [$data_system.title_bgm.name, name0+" de l'écran titre"]
@game_bgm.push(name)
name = [$data_system.battle_bgm.name, name0+" des combats"]
@game_bgm.push(name)
end
if @me_scan == true
name = [$data_system.battle_end_me.name, name0+" de victoire"]
@game_me.push(name)
name = [$data_system.gameover_me.name, name0+" de gameover"]
@game_me.push(name)
end
name0 = "Système Effet sonore"
if @se_scan == true
name = [$data_system.cursor_se.name, name0+" du curseur"]
@game_se.push(name)
name = [$data_system.decision_se.name, name0+" de validation"]
@game_se.push(name)
name = [$data_system.cancel_se.name, name0+" d'annulation"]
@game_se.push(name)
name = [$data_system.buzzer_se.name, name0+" du buzzer"]
@game_se.push(name)
name = [$data_system.equip_se.name, name0+" d'équipement"]
@game_se.push(name)
name = [$data_system.shop_se.name, name0+" d'achat"]
@game_se.push(name)
name = [$data_system.save_se.name, name0+" de sauvegarde"]
@game_se.push(name)
name = [$data_system.load_se.name, name0+" de chargement"]
@game_se.push(name)
name = [$data_system.battle_start_se.name, name0+" de début de combat"]
@game_se.push(name)
name = [$data_system.escape_se.name, name0+" de fuite"]
@game_se.push(name)
name = [$data_system.actor_collapse_se.name, name0+" de mort d'un héros"]
@game_se.push(name)
name = [$data_system.enemy_collapse_se.name, name0+" de mort d'un ennemi"]
@game_se.push(name)
end
end
if @graphics_scan == true
if @battlers_scan == true
name = [$data_system.battler_name, "Système Apparence de la cible des animations"]
@game_battlers.push(name)
end
if @windowskins_scan == true
name = [$data_system.windowskin_name, "Système Apparence des fenêtres"]
@game_windowskins.push(name)
end
if @titles_scan == true
name = [$data_system.title_name, "Système Ecran titre"]
@game_titles.push(name)
end
if @gameovers_scan == true
name = [$data_system.gameover_name, "Système Ecran de gameover"]
@game_gameovers.push(name)
end
if @transitions_scan == true
name = [$data_system.battle_transition, "Système Transition vers les combats"]
@game_transitions.push(name)
end
end
end


def makefile
file = File.open("Scan.log", "w")
write_head(file) if @head_write == true
write_body(file) if (@used_write || @used2_write || @used3_write || @missed_write || @useless_write || @statistics_write) == true
file.close
File.delete("Scan.tmp")
end

def write_head(file)
file.write("Légende :\n\n")
file.write("\t- Fichiers manquants :\n")
file.write("\t\tCela correspond aux fichiers qui sont utilisés dans le jeu mais qui ne se trouvent pas dans le projet.\n")
file.write("\t\tJe tiens à préciser que les ressources sont recherchées uniquement dans le projet et pas dans les RTP.\n\n")
file.write("\t- Fichiers inutiles :\n")
file.write("\t\tCela correspond aux fichiers qui ne sont pas utilisés dans le jeu mais qui se trouvent quand même dans le projet.\n\n")
file.write("\t- Fichiers utilisés :\n")
file.write("\t\tCela correspond aux fichiers qui sont utilisés dans le jeu et qui se trouvent bien dans le projet.\n\n")
file.write("\t- Fichiers utilisés en animation :\n")
file.write("\t\tCela correspond aux fichiers qui sont utilisés dans le jeu mais uniquement dans des animations qui elles ne sont pas utilisées.\n")
file.write("\t\tLes fichiers présents dans le projet seront marqués d'un rond, les autres d'une croix.\n")
file.write("\t\tCe sont des ressources inutiles mais je les ai mise de côté au cas ou ce serait volontaire.\n")
file.write("\t\tSi c'est le cas les fichiers marqués d'une croix sont manquants.\n")
file.write("\t\tDans le cas contraire les fichiers marqués d'un rond sont inutiles.\n")
file.write("\t\t\tExemple :\tSoit une animation A.\n")
file.write("\t\t\t\t\tA est définie dans les animations mais n'est utilisée nulle part dans le jeu.\n")
file.write("\t\t\t\t\tLe fichier d'animation de A ainsi que les fichiers SE utilisés dans A seront alors considérés comme des fichiers utilisés en animation.\n")
file.write("\t\t\t\t\tA condition bien sûr qu'ils ne soient pas déjà dans les Fichiers utilisés.\n")
file.write("\t- Fichiers utilisés en chipset :\n")
file.write("\t\tCela correspond aux fichiers qui sont utilisés dans le jeu mais uniquement dans des chipsets qui eux ne sont pas utilisés.\n")
file.write("\t\tLe principe est le même que pour les fichiers utilisés en animation.\n\n")
file.write("\t- Fichiers utilisés en script :\n")
file.write("\t\tCela correspond aux fichiers qui sont utilisés uniquement dans les scripts.\n")
file.write("\t\tMais contrairement à tout le reste ce n'est pas fiable à 100%, les erreurs possibles sont décrites ci-dessous.\n")
file.write("\t\tMais ce n'est pas très grave car vous pourrez toujours aller vérifier vous même dans les scripts aux lignes indiqués.\n")
file.write("\t\tVous pourrez donc juger si c'est une ressource utilisée ou inutile.\n\n\n")
file.write("Erreurs possibles :\n\n")
file.write("\t- Dans les statistiques, la taille de l'espace libérable indiqué peut être inférieure à la réalité.\n")
file.write("\t Cela est dû au fait que ça n'arrive pas à lire la taille des fichiers avec des caractères spéciaux comme le é par exemple (Va savoir pourquoi).\n")
file.write("\t Si vous n'utilisez pas les scripts désactivez la recherche dans les scripts et il n'y aura plus aucune autre erreur possible.\n\n")
file.write("\t- Les fichiers se trouvants dans des dossiers différents de ceux d'origine ne seront pas détectés, par contre il n'y a aucun problème en ce qui concerne les sous-dossiers.\n\n")
file.write("\t- Les fichiers utilisés uniquement dans des scripts avec des noms composés tel que : nom_de_ma_musique = 'Audio' + i.to_s ne seront pas détectés.\n")
file.write("\t Les seuls fichiers qui seront détectés seront ceux écrits entre deux \" ou deux ' ou deux /.\n\n")
file.write("\t- L'utilisation d'une animation ne sera pas détecté si elle est faite dans un script.\n\n")
file.write("\t- Les fichiers utilisés uniquement dans des scripts ne seront pas considérés comme fichiers manquants même s'ils le sont.\n\n")
file.write("\t- Les fichiers avec des noms identiques seront confondus dans les scripts.\n")
file.write("\t\tExemple :\tUn fichier SE nommé 'Vache' est utilisé, entre autre, dans un script.\n")
file.write("\t\t\t\tUn fichier ME nommé 'Vache' lui aussi, n'est utilisé nulle part.\n")
file.write("\t\t\t\tEt bien les fichiers 'Vache' seront tous les deux considérés comme utilisés.\n")
file.write("\t\t\t\tDe même un fichier nommé 'Temps', quelle que soit son dossier, sera considéré comme utilisé parce que quelque part dans les scripts il y a écrit 'Temps'.\n")
file.write("\t\t\t\tPar contre si vous mettez les noms des répertoires et l'extension dans le nom du fichier, ce problème ne se pose pas.\n\n\n")
file.write("Crédits :\n\n")
file.write("\tCe script magnifique vous a été proposer par le fabuleux Zeus81 !\n")
file.write("\tSi vous cherchez d'autres scripts magnifiques, tous mes scripts sont disponibles sur [url=http://www.rpgmaker.fr\n)]www.rpgmaker.fr\n")
file.write("\tMes scripts :\n")
file.write("\t\tDéplacements améliorés\n")
file.write("\t\tRessource Scanner\n")
file.write("\t\tTrainées\n")
file.write("\t\tTremblement de l'écran amélioré\n")
file.write("\t\tWindow Config\n")
file.write("\t\tEt peut être prochainement sur vos écrans A-RPG Maker XP\n")
file.write("\tEt aussi si vous voulez voir à quoi ressemble le plus grand jeu de tous les temps créé par le plus grand génie de l'univers (c'est-à-dire mon jeu)\n")
file.write("\tTéléchargez : The Arch of Gladoria [url=http://www.megaupload.com/fr/?d=F7SPX5HP\n")]http://www.megaupload.com/fr/?d=F7SPX5HP\n")
file.write("\tSi vous voulez me faire un don d'argent pour me remercier, n'hésitez pas !!!\n")
file.write("\tVoilà ! Ma pub, tout à fait modeste, est terminée.\n\n\n\n")
end

def write_body(file)
file.write("\t\t\t\t- = RESULTAT DU SCAN = -\n\n\n")
statistics = []
if @audio_scan == true
file.write("Audio\n\n")
if @bgm_scan == true
file.write("\tBGM\n")
data = make_data(@scan_bgm, @game_bgm, [], "Audio\\BGM\\")
write_data(data, file)
statistics.push(["Audio\\BGM\\"]+data)
end
if @bgs_scan == true
file.write("\tBGS\n")
data = make_data(@scan_bgs, @game_bgs, [], "Audio\\BGS\\")
write_data(data, file)
statistics.push(["Audio\\BGS\\"]+data)
end
if @me_scan == true
file.write("\tME\n")
data = make_data(@scan_me, @game_me, [], "Audio\\ME\\")
write_data(data, file)
statistics.push(["Audio\\ME\\"]+data)
end
if @se_scan == true
file.write("\tSE\n")
data = make_data(@scan_se, @game_se, @game2_se, "Audio\\SE\\")
write_data(data, file)
statistics.push(["Audio\\SE\\"]+data)
end
file.write("\n")
end
if @graphics_scan == true
file.write("Graphics\n\n")
if @animations_scan == true
file.write("\tAnimations\n")
data = make_data(@scan_animations, @game_animations, @game2_animations, "Graphics\\Animations\\")
write_data(data, file)
statistics.push(["Graphics\\Animations\\"]+data)
end
if @autotiles_scan == true
file.write("\tAutotiles\n")
data = make_data(@scan_autotiles, @game_autotiles, @game2_autotiles, "Graphics\\Autotiles\\")
write_data(data, file)
statistics.push(["Graphics\\Autotiles\\"]+data)
end
if @battlebacks_scan == true
file.write("\tBattlebacks\n")
data = make_data(@scan_battlebacks, @game_battlebacks, @game2_battlebacks, "Graphics\\Battlebacks\\")
write_data(data, file)
statistics.push(["Graphics\\Battlebacks\\"]+data)
end
if @battlers_scan == true
file.write("\tBattlers\n")
data = make_data(@scan_battlers, @game_battlers, [], "Graphics\\Battlers\\")
write_data(data, file)
statistics.push(["Graphics\\Battlers\\"]+data)
end
if @characters_scan == true
file.write("\tCharacters\n")
data = make_data(@scan_characters, @game_characters, [], "Graphics\\Characters\\")
write_data(data, file)
statistics.push(["Graphics\\Characters\\"]+data)
end
if @fogs_scan == true
file.write("\tFogs\n")
data = make_data(@scan_fogs, @game_fogs, @game2_fogs, "Graphics\\Fogs\\")
write_data(data, file)
statistics.push(["Graphics\\Fogs\\"]+data)
end
if @gameovers_scan == true
file.write("\tGameovers\n")
data = make_data(@scan_gameovers, @game_gameovers, [], "Graphics\\Gameovers\\")
write_data(data, file)
statistics.push(["Graphics\\Gameovers\\"]+data)
end
if @icons_scan == true
file.write("\tIcons\n")
data = make_data(@scan_icons, @game_icons, [], "Graphics\\Icons\\")
write_data(data, file)
statistics.push(["Graphics\\Icons\\"]+data)
end
if @panoramas_scan == true
file.write("\tPanoramas\n")
data = make_data(@scan_panoramas, @game_panoramas, @game2_panoramas, "Graphics\\Panoramas\\")
write_data(data, file)
statistics.push(["Graphics\\Panoramas\\"]+data)
end
if @pictures_scan == true
file.write("\tPictures\n")
data = make_data(@scan_pictures, @game_pictures, [], "Graphics\\Pictures\\")
write_data(data, file)
statistics.push(["Graphics\\Pictures\\"]+data)
end
if @tilesets_scan == true
file.write("\tTilesets\n")
data = make_data(@scan_tilesets, @game_tilesets, @game2_tilesets, "Graphics\\Tilesets\\")
write_data(data, file)
statistics.push(["Graphics\\Tilesets\\"]+data)
end
if @titles_scan == true
file.write("\tTitles\n")
data = make_data(@scan_titles, @game_titles, [], "Graphics\\Titles\\")
write_data(data, file)
statistics.push(["Graphics\\Titles\\"]+data)
end
if @transitions_scan == true
file.write("\tTransitions\n")
data = make_data(@scan_transitions, @game_transitions, [], "Graphics\\Transitions\\")
write_data(data, file)
statistics.push(["Graphics\\Transitions\\"]+data)
end
if @windowskins_scan == true
file.write("\tWindowskins\n")
data = make_data(@scan_windowskins, @game_windowskins, [], "Graphics\\Windowskins\\")
write_data(data, file)
statistics.push(["Graphics\\Windowskins\\"]+data)
end
file.write("\n")
end
write_statistics(statistics, file) if @statistics_write == true
end

def make_data(scan_tab, game_tab, game2_tab, directory)
used = []
used2 = []
used3 = []
missed = []
useless = []
scan_tab.sort!
game_tab.sort!
game2_tab.sort!
directory.downcase!
for i in 0...scan_tab.size
if scan_tab[i] != "" and useless.include?(scan_tab[i]) == false
useless.push(scan_tab[i])
end
end
for i in 0...game_tab.size
if game_tab[i][0] != ""
state = true
for j in 0...missed.size
if missed[j][0] == game_tab[i][0]
missed[j].push(game_tab[i][1])
state = false
break
end
end
missed.push(game_tab[i]) if state == true
end
end
for i in 0...game2_tab.size
if game2_tab[i][0] != ""
state = true
for j in 0...used2.size
if used2[j][0] == "X "+game2_tab[i][0]
used2[j].push(game2_tab[i][1]) if used2[j].include?(game2_tab[i][1]) == false
state = false
break
end
end
if state == true
used2.push(["X "+game2_tab[i][0], game2_tab[i][1]])
end
end
end
for i in 0...useless.size
state = 0
if File.dirname(useless[i]) == "."
filename = File.basename(useless[i], ".*")
for j in 0...missed.size
if missed[j] != nil and missed[j][0] == filename
used.push(useless[i])
missed[j] = nil
state = 1
break
end
end
for j in 0...used2.size
if used2[j] != nil and used2[j][0] == "X "+filename
if state == 1
used2[j] = nil
else
used2[j][0] = "O "+useless[i]
state = 2
end
break
end
end
else
useless[i] = "\t"+useless[i]
end
if @scripts_check == true and state != 1
name = [useless[i]]
dirname = File.dirname(useless[i]).downcase.gsub("\t"){""}
basename = File.basename(useless[i], ".*").downcase
extname = File.extname(useless[i]).downcase
possible_filenames = {}
filename = basename+extname
possible_filenames[0] = "\""+filename+"\""
possible_filenames[1] = "'"+filename+"'"
possible_filenames[2] = "/"+filename+"/"
filename = basename
possible_filenames[3] = "\""+filename+"\""
possible_filenames[4] = "'"+filename+"'"
possible_filenames[5] = "/"+filename+"/"
if dirname != "."
filename = directory+dirname+"\\"+basename+extname
else
filename = directory+basename+extname
end
possible_filenames[6] = "\""+filename+"\""
possible_filenames[7] = "'"+filename+"'"
possible_filenames[8] = "/"+filename+"/"
if dirname != "."
filename = directory+dirname+"\\"+basename
else
filename = directory+basename
end
possible_filenames[9] = "\""+filename+"\""
possible_filenames[10] = "'"+filename+"'"
possible_filenames[11] = "/"+filename+"/"
for j in 6...12
possible_filenames[6+j] = possible_filenames[j].gsub("\\") {"/"}
end
possible_filenames[14] = possible_filenames[8].gsub("\\") {"\\/"}
possible_filenames[17] = possible_filenames[11].gsub("\\") {"\\/"}
if dirname != "."
filename = dirname+"\\"+basename+extname
possible_filenames[18] = "\""+filename+"\""
possible_filenames[19] = "'"+filename+"'"
possible_filenames[20] = "/"+filename+"/"
filename = dirname+"\\"+basename
possible_filenames[21] = "\""+filename+"\""
possible_filenames[22] = "'"+filename+"'"
possible_filenames[23] = "/"+filename+"/"
for j in 18...24
possible_filenames[18+j] = possible_filenames[j].gsub("\\") {"/"}
end
possible_filenames[26] = possible_filenames[20].gsub("\\") {"\\/"}
possible_filenames[29] = possible_filenames[23].gsub("\\") {"\\/"}
end
for j in 0... @game_scripts.size
game_script = @game_scripts[j][0]
if game_script[basename] != nil
find = false
for possible_filename in possible_filenames.values
if game_script[possible_filename] != nil
find = true
state = 3
break
end
end
if find == true
if game_script["\r\n"] != nil
file = File.open("Scan.tmp", "w+")
file.write(game_script)
file.pos = 0
lines = file.readlines("\r\n")
file.close
else
lines = [game_script]
end
if lines.size == 1
name.push(@game_scripts[j][1])
else
for k in 0...lines.size
for possible_filename in possible_filenames.values
if lines[k][possible_filename] != nil
name.push(@game_scripts[j][1]+" ligne n° "+(k+1).to_s)
break
end
end
end
end
end
end
end
used3.push(name) if state == 3
end
useless[i] = nil if state != 0
end
used.compact!
used2.compact!
used3.compact!
missed.compact!
useless.compact!
used.sort!
used2.sort!
used3.sort!
missed.sort!
useless.sort!
used.each{|i| i.gsub!("\t"){""}}
used2.each{|i| i[0].gsub!("\t"){""}}
used3.each{|i| i[0].gsub!("\t"){""}}
missed.each{|i| i[0].gsub!("\t"){""}}
useless.each{|i| i.gsub!("\t"){""}}
data = [used, used2, used3, missed, useless]
return data
end

def write_data(data, file)
if @used_write == true
file.write("\n\t\tFichiers utilisés :\n")
if data[0].size == 0
file.write("\t\t\t Aucun\n")
else
for i in 0...data[0].size
file.write("\t\t\t " + data[0][i] + "\n")
end
end
end
if @used2_write == true
if data[1].size != 0
file.write("\n\t\tFichiers utilisés en animation / chipset :\n")
for i in 0...data[1].size
name = "\t\t\t " + data[1][i][0] + "\t\tEmplacements :"
for j in 1...data[1][i].size
name += "\t" + data[1][i][j]
end
file.write(name + "\n")
end
end
end
if @used3_write == true
if data[2].size != 0
file.write("\n\t\tFichiers utilisés en script :\n")
for i in 0...data[2].size
name = "\t\t\t " + data[2][i][0] + "\t\tEmplacements :"
for j in 1...data[2][i].size
name += "\t" + data[2][i][j]
end
file.write(name + "\n")
end
end
end
if @missed_write == true
file.write("\n\t\tFichiers manquants :\n")
if data[3].size == 0
file.write("\t\t\t Aucun\n")
else
for i in 0...data[3].size
name = "\t\t\t " + data[3][i][0] + "\t\tEmplacements :"
for j in 1...data[3][i].size
name += "\t" + data[3][i][j]
end
file.write(name + "\n")
end
end
end
if @useless_write == true
file.write("\n\t\tFichiers inutiles :\n")
if data[4].size == 0
file.write("\t\t\t Aucun\n")
else
for i in 0...data[4].size
file.write("\t\t\t " + data[4][i] + "\n")
end
end
end
file.write("\n")
end

def write_statistics(statistics, file)
used = []
used2 = []
used3 = []
missed = []
useless = []
useless_bytes = 0
for i in 0...statistics.size
used += statistics[i][1]
used2 += statistics[i][2]
used3 += statistics[i][3]
missed += statistics[i][4]
useless += statistics[i][5]
for j in 0...statistics[i][5].size
filename = statistics[i][0]+statistics[i][5][j]
useless_bytes += FileTest.size(filename) if FileTest.exist?(filename) == true
end
end
if useless_bytes >= 1000
useless_bytes /= 1024.0
if useless_bytes >= 1000
useless_bytes /= 1024.0
useless_bytes = useless_bytes.round.to_s + " Mega Octets"
else
useless_bytes = useless_bytes.round.to_s + " Kilo Octets"
end
else
useless_bytes = useless_bytes.round.to_s + " Octets"
end
file.write("Statistiques\n\n")
file.write("\tFichiers utilisés : "+used.size.to_s+"\n")
file.write("\tFichiers utilisés en animation / chipset : "+used2.size.to_s+"\n")
file.write("\tFichiers utilisés en script : "+used3.size.to_s+"\n")
file.write("\tFichiers manquants : "+missed.size.to_s+"\n")
file.write("\tFichiers inutiles : "+useless.size.to_s+"\n")
file.write("\tEspace libérable en supprimant les fichiers inutiles : "+useless_bytes)
end


end
[/code]
Back to top
Visit poster’s website
Publicité






PostPosted: Fri 30 Oct - 23:20 (2009)    Post subject: Publicité

PublicitéSupprimer les publicités ?
Back to top
Ace Attorney Man
Guest





PostPosted: Sat 31 Oct - 00:07 (2009)    Post subject: [Script] Scan de ressources

Bug ligne 1067 au lancement du jeu, aucun rapport de log
Code:
      file.write("\tTéléchargez : The Arch of Gladoria   http://www.megaupload.com/fr/?d=F7SPX5HP\n")
Back to top
Angi-MK
Membre


Joined: 29 Oct 2008
Posts: 2,303
Localisation: Québec
Masculin

PostPosted: Sat 31 Oct - 01:26 (2009)    Post subject: [Script] Scan de ressources

Hein ?
Je ne vois pas pourquoi ça bug ?!
Back to top
Visit poster’s website
PiVa
Guest





PostPosted: Sat 31 Oct - 22:33 (2009)    Post subject: [Script] Scan de ressources

Tu as essayé de supprimer cette ligne ?
Back to top
Angi-MK
Membre


Joined: 29 Oct 2008
Posts: 2,303
Localisation: Québec
Masculin

PostPosted: Sat 31 Oct - 22:41 (2009)    Post subject: [Script] Scan de ressources

Chez moi il marche parfaitement
Ps: tu as pris le script ou tu as télécharger le texte ?
Back to top
Visit poster’s website
Ace Attorney Man
Guest





PostPosted: Sat 31 Oct - 22:43 (2009)    Post subject: [Script] Scan de ressources

Angi-MK wrote:

Chez moi il marche parfaitement
Ps: tu as pris le script ou tu as télécharger le texte ?
J'ai copier/coller le texte
Back to top
Van Pokamon
Membre


Joined: 04 May 2009
Posts: 1,145
Soeur de Charles Pokamon
Localisation: Localisation Anonyme
Féminin
ID Steam: Daikenzo
Nintendo Network: Daikenzo / Daikenko

PostPosted: Sun 22 Nov - 11:05 (2009)    Post subject: [Script] Scan de ressources

aussi, le script non dans le lien contiens des smileys.
Back to top
Skype
Ace Attorney Man
Guest





PostPosted: Sun 22 Nov - 11:08 (2009)    Post subject: [Script] Scan de ressources

Est-ce normal que je ne puisse plus télécharger le script ?
Back to top
Van Pokamon
Membre


Joined: 04 May 2009
Posts: 1,145
Soeur de Charles Pokamon
Localisation: Localisation Anonyme
Féminin
ID Steam: Daikenzo
Nintendo Network: Daikenzo / Daikenko

PostPosted: Sun 22 Nov - 11:12 (2009)    Post subject: [Script] Scan de ressources

cela veut dire qu'il n'est plus dispo ...
tente de prendre le script du texte, mais en citation.
puis désactive les smileys.
Back to top
Skype
Ace Attorney Man
Guest





PostPosted: Sun 22 Nov - 11:14 (2009)    Post subject: [Script] Scan de ressources

Ouais mais nan, je vais rien prendre plutôt Yeux motorisés .
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pokémon Script Project Forum Index -> Game Making -> Ressources techniques -> Scripts All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  

Index | Free forum | Free support forum | Free forums directory | Report a violation | Cookies | Charte | Conditions générales d'utilisation
Powered by phpBB © 2001, 2005 phpBB Group
Thème par Thomas et l'équipe de la refonte PSP 2012 (version 1.0)