Item (Dictionairy) Encyclopedy Script v1.4
by: GoldenShadow
Requested by: Anaxim
Thanks to: Makeamidget and Dark Akiko
Aug 14 2005
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
[Warning=GoldenShadow]There's a demo for this. Scroll to the end of this post.[/Warning]
You probably have seen another script like this, but here's my version.
It's not only for items, but weapons and armors/shields/etc too.
Just switch windows.
If you don't want that, remove lines for the Y button.
I won't explain anything here. View the demo for full information.
It's not encrypted so, as you would expect from a demo, you can view the stuff..
Have fun.
Here's the script for the people who rather not download the demo.
Chances are, there are bugs. Contact me if there are any.
Note: Press S to switch between item lists: Item, Armors, Etc.
Note: Press A to see % info
def refresh
self.contents.clear
@total = $data_items.size
@now = 0
case $item_dict.show_type
when 0
for i in 0...$item_dict.dict_items.size
if $item_dict.dict_items[i] == true
@now += 1
end
end
when 1
for i in 0...$item_dict.dict_weapons.size
if $item_dict.dict_weapons[i] == true
@now += 1
end
end
when 2
for i in 0...$item_dict.dict_armors.size
if $item_dict.dict_armors[i] == true
@now += 1
end
end
end
@amount = (@total / 100) * @now
self.contents.draw_text(4, 0, self.width - 40, 32, "Objects achieved: #{@amount}% (#{@now}/#{@total})")
end
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
case $item_dict.show_type
when 0
@data = []
for i in 1...$data_items.size
if $item_dict.dict_items[i] == true
@data.push($data_items[i])
else
@data.push("???")
end
end
when 1
@data = []
for i in 1...$data_weapons.size
if $item_dict.dict_wpns[i] == true
@data.push($data_weapons[i])
else
@data.push("???")
end
end
when 2
@data = []
for i in 1...$data_armors.size
if $item_dict.dict_armr[i] == true
@data.push($data_armors[i])
else
@data.push("???")
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
self.contents.font.color = normal_color
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
if item != "???"
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
else
self.contents.draw_text(x + 28, y, 212, 32, "???", 0)
end
end
def update_help
if self.item == "???"
@help_window.set_text("Item not yet acquired or found.")
else
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
end
class Scene_ItemDict
def main
@help_window = Window_Help.new
@item_window = Window_ItemList.new
@item_window.active = true
@status_window = Window_ItemStat.new($data_items[@item_window.item.id])
@item_window.help_window = @help_window
@achieve_window = Window_ItemAchieve.new
@achieve_window.active = false
@achieve_window.visible = false
@achieve_window.x = 320 - @achieve_window.width / 2
@achieve_window.y = 240 - @achieve_window.width / 2
@achieve_window.z = 9999
Graphics.transition # transing it, so it updates
loop do
Graphics.update
Input.update
update # updating the stuff, see def update
if $scene != self
break
end
end
Graphics.freeze # when closing, freeze it all first
@help_window.dispose
@status_window.dispose
@item_window.dispose
@achieve_window.dispose
end
def update
@help_window.update
@status_window.update
@item_window.update
@achieve_window.update
case $item_dict.show_type
when 0
@type = $data_items[@item_window.item.id]
when 1
@type = $data_weapons[@item_window.item.id]
when 2
@type = $data_armors[@item_window.item.id]
end
if @active_id != @item_window.item.id
@status_window.dispose
@status_window = Window_ItemStat.new(@type)
@status_window.refresh
@active_id = @item_window.item.id
end
if @achieve_window.active
update_achieve
return
end
if @item_window.active
update_command
return
end
end
def update_command
if Input.trigger?(Input::B)
$scene = Scene_Map.new # previous scene, change to whatever you want
elsif Input.trigger?(Input::Y)
if $item_dict.show_type == 2
$item_dict.show_type = 0
else
$item_dict.show_type += 1
end
@item_window.dispose
@item_window = Window_ItemList.new
@item_window.help_window = @help_window
@active_id = 0
elsif Input.trigger?(Input::X)
@item_window.active = false
@achieve_window.active = true
@achieve_window.visible = true
end
end
def update_achieve
if Input.trigger?(Input::B)
@achieve_window.visible =false
@achieve_window.active = false
@item_window.active = true
end
end
end
# thanks to makeamidget for this little thingy here
class Interpreter
alias dict_command_126 command_126
alias dict_command_127 command_127
alias dict_command_128 command_128
def command_126
dict_command_126
$item_dict.add_item(@parameters[0], 0)
end
def command_127
dict_command_127
$item_dict.add_item(@parameters[0], 1)
end
def command_128
dict_command_128
$item_dict.add_item(@parameters[0], 2)
end
end
# FINAL UPDATE: 16th August @ 1:06 CET