#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Data Logger by ForeverZer0
# Version 1.0
# Data: 5.19.2010
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
# Simply creates text documents that contain all the data in your database.
# Makes it a little easier to set up large databases in other scripts, such
# as Blizzard's Equap Skills, etc. when you want to view your database and the
# script editor at the same time. I don't know what else that it could be used
# for...
#
# Instructions:
#
# Create an event with this script call: Data_Logger.write_all
#
# Files will be created and saved in your game folder.
# Logs the following:
# - Weapons
# - Armors
# - Skills
# - Items
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
module Data_Logger
def self.write_all
self.write_weapon_data
self.write_armor_data
self.write_skill_data
self.write_item_data
end
def self.write_data(data = [[]], title = 'Game Data')
f = File.open(title + '.txt', 'w')
time = Time.now.strftime("%b-%d-%Y, %I:%M:%S")
f.write("Created with Zer0 Data Logger on #{time}\n\n")
f.write("\r\n>>>>> #{title} <<<<<\r\n\r\n")
data.each_index {|i|
f.write("\n")
data[i].each_index {|j|
f.write("#{data[i][j]}\n")}}
f.close
print("Text Document '#{title}' successfully created!")
end
def self.write_skill_data
data = []
(1...$data_skills.size).each {|i|
s = $data_skills[i]
name = 'Name: ' + (s.name == nil ? '' : s.name)
id = 'ID: ' + i.to_s
description = 'Description: ' + (s.description == nil ? '' : s.description)
sc_words = ['None', 'One Enemy', 'All Enemies', 'One Ally', 'All Allies',
'One Ally - HP 0', 'All Allies - HP 0', 'User']
scope = 'Scope: ' + sc_words[s.scope]
oc_words = ['Always', 'Only in Battle', 'Only in Menu', 'Never']
occasion = 'Occasion: ' + oc_words[s.occasion]
sp_cost = 'SP Cost: ' + (s.sp_cost == nil ? '' : s.sp_cost.to_s)
power = 'Power: ' + (s.power == nil ? '' : s.power.to_s)
elem = 'Element: '
if s.element_set != nil
e_names = []
s.element_set.each_index {|i|
if s.element_set[i] != 0
e_names.push($data_system.elements[s.element_set[i]])
end
}
case e_names.size
when 0 then text = 'None'
else
text = ''
e_names.each_index {|i| text += (e_names[i] += ' ')}
end
elem += text
end
stp = 'State(+): '
if s.plus_state_set != nil
s_names = []
s.plus_state_set.each_index {|i|
if s.plus_state_set[i] != 0
s_names.push($data_states[s.plus_state_set[i]].name)
end
}
case s_names.size
when 0 then text = 'None'
else
text = ''
s_names.each_index {|i| text += (s_names[i] += ' ')}
end
stp += text
end
stm = 'State(-): '
if s.minus_state_set != nil
s_names = []
s.minus_state_set.each_index {|i|
if s.minus_state_set[i] != 0
s_names.push($data_states[s.minus_state_set[i]].name)
end
}
case s_names.size
when 0 then text = 'None'
else
text = ''
s_names.each_index {|i| text += (s_names[i] += ' ')}
end
stm += text
end
array = [name,description,id,scope,occasion,sp_cost,power,elem,stp,stm]
data.push(array)
}
self.write_data(data, 'Skills')
end
def self.write_weapon_data
data = []
(1...$data_weapons.size).each {|i|
w = $data_weapons[i]
name = 'Name: ' + (w.name == nil ? '' : w.name)
id = 'ID: ' + i.to_s
desc = 'Description: ' + (w.description == nil ? '' : w.description)
price = 'Price: ' + (w.price == nil ? '' : w.price.to_s)
atk = 'Attack: ' + (w.atk == nil ? '' : w.atk.to_s)
pdef = 'PDef: ' + (w.pdef == nil ? '' : w.pdef.to_s)
mdef = 'MDef: ' + (w.mdef == nil ? '' : w.mdef.to_s)
str = 'Str+: ' + (w.str_plus == nil ? '' : w.str_plus.to_s)
dex = 'Dex+: ' + (w.dex_plus == nil ? '' : w.dex_plus.to_s)
agi = 'Agi+: ' + (w.agi_plus == nil ? '' : w.agi_plus.to_s)
int = 'Int+: ' + (w.int_plus == nil ? '' : w.int_plus.to_s)
elem = 'Element: '
if w.element_set != nil
e_names = []
w.element_set.each_index {|i|
e_names.push($data_system.elements[w.element_set[i]])}
case e_names.size
when 0 then text = 'None'
else
text = ''
e_names.each_index {|i| text += (e_names[i] += ' ')}
end
elem += text
end
stp = 'State(+): '
if w.plus_state_set != nil
s_names = []
w.plus_state_set.each_index {|i|
s_names.push($data_states[w.plus_state_set[i]].name)}
case s_names.size
when 0 then text = 'None'
else
text = ''
s_names.each_index {|i| text += (s_names[i] += ' ')}
end
stp += text
end
stm = 'State(-): '
if w.minus_state_set != nil
s_names = []
w.minus_state_set.each_index {|i|
s_names.push($data_states[w.minus_state_set[i]].name)}
case s_names.size
when 0 then text = 'None'
else
text = ''
s_names.each_index {|i| text += (s_names[i] += ' ')}
end
stm += text
end
array = [name,desc,id,price,atk,pdef,mdef,str,dex,agi,int,elem,stp,stm]
data.push(array)
}
self.write_data(data, 'Weapons')
end
def self.write_armor_data
data = []
(1...$data_armors.size).each {|i|
a = $data_armors[i]
name = 'Name: ' + (a.name == nil ? '' : a.name)
id = 'ID: ' + i.to_s
t_words = [$data_system.words.armor1, $data_system.words.armor2,
$data_system.words.armor3, $data_system.words.armor4]
type = 'Type: ' + t_words[a.kind]
desc = 'Description: ' + (a.description == nil ? '' : a.description)
price = 'Price: ' + (a.price == nil ? '' : a.price.to_s)
if a.auto_state_id != nil && a.auto_state_id != 0
as = 'Auto-State: ' + $data_states[a.auto_state_id].name
else
as = 'Auto-State: '+ 'None'
end
pdef = 'PDef: ' + (a.pdef == nil ? '' : a.pdef.to_s)
mdef = 'MDef: ' + (a.mdef == nil ? '' : a.mdef.to_s)
eva = 'Eva: ' + (a.eva == nil ? '' : a.eva.to_s)
str = 'Str+: ' + (a.str_plus == nil ? '' : a.str_plus.to_s)
dex = 'Dex+: ' + (a.dex_plus == nil ? '' : a.dex_plus.to_s)
agi = 'Agi+: ' + (a.agi_plus == nil ? '' : a.agi_plus.to_s)
int = 'Int+: ' + (a.int_plus == nil ? '' : a.int_plus.to_s)
ge = 'Guard-Elem: '
if a.guard_element_set != nil
e_names = []
a.guard_element_set.each_index {|i|
e_names.push($data_system.elements[a.guard_element_set[i]])}
case e_names.size
when 0 then text = 'None'
else
text = ''
e_names.each_index {|i| text += (e_names[i] += ' ')}
end
ge += text
end
gs = 'Guard-State: '
if a.guard_state_set != nil
s_names = []
a.guard_state_set.each_index {|i|
s_names.push($data_states[a.guard_state_set[i]].name)}
case s_names.size
when 0 then text = 'None'
else
text = ''
s_names.each_index {|i| text += (s_names[i] += ' ')}
end
gs += text
end
array = [name,desc,id,type,price,as,pdef,mdef,eva,str,dex,agi,int,ge,gs]
data.push(array)
}
self.write_data(data, 'Armors')
end
def self.write_item_data
data = []
(1...$data_items.size).each {|j|
i = $data_items[j]
name = 'Name: ' + (i.name == nil ? '' : i.name)
id = 'ID: ' + j.to_s
desc = 'Description: ' + (i.description == nil ? '' : i.description)
sc_words = ['None', 'One Enemy', 'All Enemies', 'One Ally', 'All Allies',
'One Ally - HP 0', 'All Allies - HP 0', 'User']
scope = 'Scope: ' + sc_words[i.scope]
oc_words = ['Always', 'Only in Battle', 'Only in Menu', 'Never']
occ = 'Occasion: ' + oc_words[i.occasion]
price = 'Price: ' + (i.price == nil ? '' : i.price.to_s)
cons = 'Consumable: ' + (i.consumable == true ? 'Yes' : 'No')
array = [name,id,desc,scope,occ,price,cons]
data.push(array)
}
self.write_data(data, 'Items')
end
end