alle finden es toll, aber keiner hat es getestet.
PS: du kannst kein terminate machen,
das ist kein Scene
dazu fehlt noch eine main, und eine update(wobei letztere nicht muss)
auserdem würd ich das auch deswegen nicht in die $scene laden.
hier hab ich es mal gefixt und verbessert.
#==============================================================================
# ** [ERZVX] Search (20. Mai 2008 10:23)
#------------------------------------------------------------------------------
# Durchsucht "Show Text"-ECs in Events und Common Events nach Wörter.
#==============================================================================
class Search
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(*args)
# Laden
args.uniq!
args.flatten!
data_map = {}
map = [2]
map.each { |nr| data_map[nr] = load_data("Data/Map#{"0"*(3-nr.to_s.size)+nr.to_s}.rvdata") }
data_mapinfos = load_data('Data/MapInfos.rvdata')
data_common_events = load_data('Data/CommonEvents.rvdata')
# Erstelle Logfile
log, logged_ev, logged_ce = File.open('Search Results.txt', 'w'), {}, {}
log.puts('#=============================================================')
log.puts('# ** Events')
log.puts('#=============================================================')
# Durchsuche Events
data_map.each_key { |map_id|
data_map[map_id].events.each_value { |event|
event.pages.each_index { |page_id|
event.pages[page_id].list.each { |list|
# Nach Text suchen
unless args.nil?
args.each { |word|
unless list.parameters[0].nil?
if list.code == 401 && list.parameters[0].include?(word)
# Schreibe Ergebnisse in die Logfile
unless logged_ev['args' + word]
log.puts('#-------------------------------------------------------')
log.puts('# * Word: ' + word)
log.puts('#-------------------------------------------------------')
logged_ev['args' + word] = true
end
log.puts("Map Name:\t#{data_mapinfos[map_id].name}")
log.puts("Event ID:\t\t#{event.id}")
log.puts("Page:\t\t#{page_id}\n")
end
end
}
end
}
}
}
}
# Durchsuche Common Events
log.puts('#=============================================================')
log.puts('# ** Common Events')
log.puts('#=============================================================')
data_common_events.each { |event|
unless event.nil?
event.list.each { |list|
# Nach Text suchen
unless args.nil?
args.each { |word|
unless list.parameters[0].nil?
if list.code == 401 && list.parameters[0].include?(word)
# Schreibe Ergebnisse in die Logfile
unless logged_ce['args' + word]
log.puts('#-------------------------------------------------------')
log.puts('# * Word: ' + word)
log.puts('#-------------------------------------------------------')
logged_ce['args' + word] = true
end
log.puts("Common Event ID:\t#{event.id}")
end
end
}
end
}
end
}
p "finisch"
end
end