RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Catalogue Script v 1.4

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Catalogue Script
Version: 1.4
Author: modern algebra
Date: August 11, 2007

Version History


  • v. 1.4: Made it more compatible by restoring some of the script cleanliness that was lost in the upgrade from 1.3 to 1.3b
  • v. 1.3b: Fixed fatal error. You MUST replace v. 1.3
  • v. 1.3: Added an information screen about the item. Now, you can select an item and see a breakdown of what it does. As well, added icons (major bug, please upgrade to 1.3b)
  • v. 1.2: Various little design changes and aesthetic stuff. Included Ordering Tax option
  • v. 1.1: Increased it's functionality by allowing the option of ordering items from the catalogue. (not released)
  • v. 1.0: Made the basic screen. Viewable catalogue of all items collected

Description


This script allows you to set up groups of items, and then it will give you a log of all the items in that group that the party has encountered. You can have an infinite number of groups. It also allows you to order items from a catalogue at user-specified locations. As well, it gives detailed onfo on all items you have collected.

Features

  • Easily customizable groups containing any number of items, weapons, armors, or all three
  • Unlimited number of groups
  • Displays all the items in that group that have been encountered so far, as well as the price in a store
  • Has a ratio in the corner between the items encountered and total items in a group
  • Can set up an event which allows you to order items from a specified catalogue
  • Can attach an ordering tax on ordering from the catalogue of whatever you desire
  • Shows all the stats and descriptions of each and every item through a window accessible when you are not ordering.

Screenshots


]

It Stretches!


Script


Code: [Select]
===============================================================================
# Catalogue Script
# Version: 1.4
# Author: modern algebra
# Date: July 10, 2007
#------------------------------------------------------------------------------
# Description: Allows you to have a log of all items collected and not yet
# collected.
#------------------------------------------------------------------------------
# Instructions: This script allows you to set up groups of items (items, weapons,
#               and/or armors. All types can be contained within a single group)
#               and allows you to view which of the items in that group have
#               been in your party's possession. By default, there are three
#               groups: items, weapons, armors. But you can change these and add
#               more very easily. To use, call this in a script:
#
#                    $scene = Scene_Catalogue.new (X)
#
#               where X is the group number. I'd suggest this script to be used
#               as items which call common events which have that $scene thing
#               in them. By default, it exits to the item menu. Instructions on
#               how to configure the group are at line 31
#------------------------------------------------------------------------------             
# You can also use this as a method of ordering, like from a real catalogue.
# Basically, it brings up your item log, and you can choose any of the items to
# buy. This can be useful for an Animal Crossing Game for example, but I think
# it can be useful for many types of games. In order to use this feature, use
# this call script:
#
#   $scene = Scene_Catalogue.new (X,Y)
#
# where X is the group number and Y is the ordering tax coefficient. I.e., Y is
# a number, and whatever you make that number it will multiply the price by it.
# For example, if Y = 1.15, then there will be 15% ordering tax. I.e. if an item
# costs 50 Gold in a store, then it would cost 58 Gold to order it from the
# catalogue.
#===============================================================================
#===============================================================================
# Game_Party: Aliases the gain XXX methods in order to turn the fact that you
# encountered the items on, as well as sets up the basic catalogue data
#===============================================================================
class Game_Party
 
  attr_reader   :encountered_items
  attr_reader   :catalogue
 
  alias add_encounter_items_array initialize
  def initialize
    add_encounter_items_array
    @catalogue = []
    #===========================================================================
    # CONFIGURABLE AREA
    #---------------------------------------------------------------------------
    # To make a group, make an array, and place each item you wish to have in
    # that group inside the array. Example:
    #
    # @catalogue.push (["Fish",[$data_items[1], $data_items[3], $data_items[32]]])
    # @catalogue.push (["Gold Items",[$data_armors[5], $data_weapons[3]]])
    #
    # That would make two groups. The first group would be called "Fish" and
    # have item 1, item 3, and item 32 in it, and the second group would be
    # called "Gold Items" and include armor 5 and weapon 3 in it.
    # By default, there are three categories, items, weapons and armors.
    #---------------------------------------------------------------------------
    # The basic set up:
    # @catalogue.push (["name", [<array of items included in the group>]])
    #
    # You can set up as many groups as you like.
    #
    # If you know how, you can also put them on the same line, like this:
    # @catalogue = [["Items",$data_items],["Weapons",$data_weapons],["Armors", $data_armors]]
    # but to keep it simple, follow the instructions. In default, items group is
    # 0, weapons group is 1, armors group is 2, and if you add another group
    # underneath, it would be 3, and so on. So, $scene = Scene_Catalogue.new (0)
    # would bring up the items log, etc...
    #===========================================================================
    @catalogue.push (["Item",$data_items.compact])
    @catalogue.push (["Weapon",$data_weapons.compact])
    @catalogue.push (["Armor", $data_armors.compact])
    @catalogue.push (["Key", $data_items[23,3]])
    #===========================================================================
    # END CONFIGURABLE AREA
    #===========================================================================
    @encountered_items = []
    for i in 0...3
      @encountered_items[i] = []
    end
    for i in $data_system.party_members
      actor = $data_actors[i]
      gain_weapon (actor.weapon_id,0)
      gain_armor (actor.armor1_id,0)
      gain_armor (actor.armor2_id,0)
      gain_armor (actor.armor3_id,0)
      gain_armor (actor.armor4_id,0)
    end
  end
 
  alias modify_encountered_items gain_item
  def gain_item (item_id, n)
    modify_encountered_items (item_id, n)
    if n >= 0
      for i in 0...@catalogue.size
        if @catalogue[i][1].include? ($data_items[item_id])
          @encountered_items[0][item_id] = true
        end
      end
    end
  end
 
  alias modify_encountered_weapons gain_weapon
  def gain_weapon (weapon_id, n)
    modify_encountered_weapons (weapon_id, n)
    if n >= 0
      for i in 0...@catalogue.size
        if @catalogue[i][1].include? ($data_weapons[weapon_id])
          @encountered_items[1][weapon_id] = true
        end
      end
    end
  end
 
  alias modify_encountered_armors gain_armor
  def gain_armor(armor_id, n)
    modify_encountered_armors (armor_id, n)
    if n >= 0
      for i in 0...@catalogue.size
        if @catalogue[i][1].include? ($data_armors[armor_id])
          @encountered_items[2][armor_id] = true
        end
      end
    end
  end
end 
#===============================================================================
# Draws the information screen
#===============================================================================
class Window_ItemInfo < Window_Base
 
  def initialize
    super (24, 24, 592,432)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.z = 500
    self.visible = false
  end

  def quick_write_text (x,y,text)
    tw = (self.contents.text_size(text)).width
    if tw > 95
      tw = 95
    end
    self.contents.draw_text (x-tw,y,tw+5,32,text)
  end
 
  def refresh (item)
    self.contents.clear
    case item
    when RPG::Item
      type = 0
      type_name = "Item"
    when RPG::Weapon
      type = 1
      type_name = "Weapon"
    when RPG::Armor
      type = 2
      type_name = "Armour"
    end
    self.contents.blt (93,64,RPG::Cache.icon(item.icon_name),Rect.new(0,0,24,24))
    self.contents.font.color = system_color
    self.contents.draw_text (4,96,80,32, "Type:")
    if type != 0
      self.contents.draw_text (4,128,87,32, "Equippable by:")
    end
    self.contents.draw_text (240,40,120,32,"Description:")
    quick_write_text (320,210,"Stats:")
    self.contents.draw_text (65,252,100,32,"Price:")
    if type == 1
      self.contents.draw_text (65,284,100,32,$data_system.words.atk+":")
    elsif type == 2
      self.contents.draw_text (65,284,100,32,"Evasion:")
    end
    if type != 0
      self.contents.draw_text (65,316,100,32,$data_system.words.pdef+":")
      self.contents.draw_text (65,348,100,32,$data_system.words.mdef+":")
      self.contents.draw_text (305,252,100,32,$data_system.words.str+":")
      self.contents.draw_text (305,284,100,32,$data_system.words.agi+":")
      self.contents.draw_text (305,316,100,32,$data_system.words.dex+":")
      self.contents.draw_text (305,348,100,32,$data_system.words.int+":")
    else
      self.contents.draw_text (65,284,100,32,"Occasion:")
      self.contents.draw_text (65,316,80,32,"Scope:")
      self.contents.draw_text (65,348,80,32,"Usage:")
      self.contents.draw_text (305,254,80,32,$data_system.words.hp+" Gain:")
      self.contents.draw_text (305,286,80,32,$data_system.words.sp+" Gain:")
      words = ["","Max "+$data_system.words.hp+":","Max "+$data_system.words.hp+":",
              $data_system.words.str+":", $data_system.words.agi+":",
              $data_system.words.dex+":", $data_system.words.int+":"]
      self.contents.draw_text (305,318,100,32,words[item.parameter_type])
    end
    self.contents.fill_rect (1,33,559,1,Color.new(-150,-150,-255,255))
    self.contents.fill_rect (0,34,559,1,Color.new(-255,-255,-255,255))
    self.contents.fill_rect (0,1,1,398,Color.new(-150,-150,-255,255))
    self.contents.fill_rect (1,1,1,398,Color.new(-255,-255,-255,255))
    self.contents.fill_rect (559,1,1,398,Color.new(-150,-150,-255,255))
    self.contents.fill_rect (558,1,1,398,Color.new(-255,-255,-255,255))
    self.contents.font.color = normal_color
    quick_write_text (320,0,item.name)
    quick_write_text (190,96,type_name)
    quick_write_text (285,252,item.price.to_s)
    if type == 1
      quick_write_text (285,284,item.atk.to_s)
    elsif type == 2
      quick_write_text (285,284,item.eva.to_s)
    end
    if type != 0
      quick_write_text (290,316,item.pdef.to_s)
      quick_write_text (290,348,item.mdef.to_s)
      sign = positive_num?(item.str_plus)
      quick_write_text (500,252,sign+item.str_plus.to_s)
      sign = positive_num?(item.agi_plus)
      quick_write_text (500,284,sign+item.agi_plus.to_s)
      sign = positive_num?(item.dex_plus)
      quick_write_text (500,316,sign+item.dex_plus.to_s)
      sign = positive_num?(item.int_plus)
      quick_write_text (500,348,sign+item.int_plus.to_s)
    else
      words = ["Always","In Battle","Out of Battle","Never"]
      quick_write_text (285,284,words[item.occasion])
      words = ["N/A", "One Enemy", "All Enemies", "One Ally", "All Allies",
               "One Felled Ally", "All Felled Allies", "The User"]
      quick_write_text (285,316,words[item.scope])
      if item.consumable; quick_write_text (285,348,"One Use")
      else; quick_write_text (285,348,"Unlimited Uses")
      end
      if item.recover_hp == 0 && item.recover_hp_rate == 0
        hp_recovery_string = "N/A"
      elsif item.recover_hp_rate != 0 && item.recover_hp_rate != 0
        hp_recovery_string = item.recover_hp_rate.to_s+"% + "+item.recover_hp.to_s
      elsif item.recover_hp != 0
        hp_recovery_string = item.recover_hp.to_s
      else
        hp_recovery_string = item.recover_hp_rate.to_s
      end
      quick_write_text (500,254,hp_recovery_string)
      if item.recover_sp == 0 && item.recover_sp_rate == 0
        sp_recovery_string = "N/A"
      elsif item.recover_sp_rate != 0 && item.recover_sp_rate != 0
        sp_recovery_string = item.recover_sp_rate.to_s+"% + "+item.recover_sp.to_s
      elsif item.recover_sp != 0
        sp_recovery_string = item.recover_sp.to_s
      else
        sp_recovery_string = item.recover_sp_rate.to_s
      end
      quick_write_text (500,286,sp_recovery_string)
      if item.parameter_type != 0
        quick_write_text (500,318,"+"+item.parameter_points.to_s)
      end
    end
    if type != 0
      equip_classes = []
      substring = ""
      for i in 1...$data_classes.size
        e_class = $data_classes[i]
        string = ""
        if type == 1
          test = e_class.weapon_set
        elsif type == 2
          test = e_class.armor_set
        end
        if test.include? (item.id)
          if e_class.name.size <= 4
            string = e_class.name.dup
          else
            string += e_class.name[0,1]
            for i in 1...e_class.name.size
              substring = e_class.name[i,1]
              if substring !="a"&&substring !="e"&&substring !="i"&&substring !="o"&&substring != "u"
                string +=substring
              end
            end
            if string.size > 4
              string = string[0,2]+string[string.size-2,2]
            end
          end
          equip_classes.push (string.upcase!)
        end
      end
      if equip_classes.nitems == 0
        quick_write_text (160,296,"N/A")
      else
        line_length = 0
        line_number = 0
        for i in 0...equip_classes.size
          if i != equip_classes.size - 1
            tw = (self.contents.text_size(equip_classes[i]+", ")).width
            self.contents.draw_text (90+line_length,128+line_number,tw,32,equip_classes[i]+", ")
          else
            tw = (self.contents.text_size(equip_classes[i])).width
            self.contents.draw_text (90+line_length,128+line_number,tw,32,equip_classes[i])
          end
          line_length += tw
          if line_length > 75
            line_number +=32
            line_length = -80
          end
        end
        self.contents.fill_rect (209,202,350,1,Color.new(-255,-255,-255,255))
        self.contents.fill_rect (210,201,350,1,Color.new(-150,-150,-255,255))
        if line_number > 64
          self.contents.fill_rect (209,34,1,220,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (210,33,1,220,Color.new(-150,-150,-255,255))
          self.contents.fill_rect (0,254,209,1,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (1,253,209,1,Color.new(-150,-150,-255,255))
        elsif line_number > 32
          self.contents.fill_rect (209,34,1,120+line_number,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (210,33,1,120+line_number,Color.new(-150,-150,-255,255))
          self.contents.fill_rect (209,120+line_number,1,82-line_number,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (210,120+line_number,1,82-line_number,Color.new(-150,-150,-255,255))
          self.contents.fill_rect (0,154+line_number,209,1,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (1,153+line_number,209,1,Color.new(-150,-150,-255,255))
        else
          self.contents.fill_rect (209,34,1,168,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (210,33,1,168,Color.new(-150,-150,-255,255))
          self.contents.fill_rect (0,202,209,1,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (1,201,209,1,Color.new(-150,-150,-255,255))
        end
      end
    end
    if item.is_a? (RPG::Item)
      self.contents.fill_rect (209,34,1,170,Color.new(-255,-255,-255,255))
      self.contents.fill_rect (210,33,1,170,Color.new(-150,-150,-255,255))
      self.contents.fill_rect (0,202,559,1,Color.new(-255,-255,-255,255))
      self.contents.fill_rect (1,201,559,1,Color.new(-150,-150,-255,255))
    end
    desc = item.description
    line = []
    ts = desc.size
    line_index = 0
    limit = 0
    loop do
      line[line_index] = desc[limit, 40]
      for i in 1...40
        if line[line_index][-i,1] == " " || limit + (40-i) >= desc.size
          limit += (41-i)
          ts -= 40-i
          line_index +=1
          break
        else
          line[line_index][-i,1] = " "
        end
      end
      if ts <= 0
        break
      end
    end 
    line.compact!
    for i in 0...line.size
      self.contents.draw_text (220, 28*i + 76, 350,32, line[i])
    end
  end
 
  def positive_num? (num)
    if num > 0
      return "+"
    else
      return ""
    end
  end
end
#===============================================================================
# This window displays the ratio of collected items to total items
#===============================================================================
class Window_TotalItemsRatio < Window_Base
 
  def initialize (group_number)
    super (400,0,240,64)
    self.contents = Bitmap.new (width-32, height-32)
    @total = $game_party.catalogue[group_number][1].size
    @current = 0
    for i in 0...@total
      item = $game_party.catalogue[group_number][1][i]
      case item
      when RPG::Item; type = 0
      when RPG::Weapon; type = 1
      when RPG::Armor; type = 2
      end
      if $game_party.encountered_items[type][item.id] == true
        @current += 1
      end
    end
    if @current == @total
      self.contents.font.color = system_color
    end
    tw = (self.contents.text_size(@current.to_s + " / " + @total.to_s)).width
    self.contents.draw_text (104 - (tw/2),0,tw,32,@current.to_s + " / " + @total.to_s)
  end
end
#===============================================================================
# This window displays all collected items
#===============================================================================
class Window_Catalogue < Window_Selectable
 
  def initialize (group, price_multiplier = nil)
    super (0,128,640,352)
    @column_max = 2
    @group = $game_party.catalogue[group][1]
    @group_number = group
    @price_multiplier = price_multiplier
    refresh
  end
 
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Check inventory for new additions
    for i in 0...@group.size
      case @group[i]
      when RPG::Item; type = 0
      when RPG::Weapon; type = 1
      when RPG::Armor; type = 2
      end
      if $game_party.encountered_items[type][@group[i].id] == true
        @data.push (@group[i])
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(@data[i], i)
      end
    end
  end
 
  def draw_item (item, index)
    if @price_multiplier != nil
      if $game_party.gold >= (item.price * @price_multiplier)
        self.contents.font.color = normal_color
        self.contents.draw_text ((320*(index%2))+30,(index/2)*32,200,32,item.name)
      else
        self.contents.font.color = disabled_color
        self.contents.draw_text ((320*(index%2))+30,(index/2)*32,200,32,item.name)
      end
      if item.price != 0
        tw = self.contents.text_size ((item.price * @price_multiplier).to_i.to_s)
        self.contents.draw_text (270 + (326*(index%2))-tw.width ,(index/2)*32,tw.width,32,(item.price * @price_multiplier).to_i.to_s)
      else
        tw = self.contents.text_size ("N/A")
        self.contents.draw_text (270 + (326*(index%2))-tw.width ,(index/2)*32,tw.width+10,32,"N/A")
      end
    else
      self.contents.draw_text ((320*(index%2))+30,(index/2)*32,200,32,item.name)
      if item.price != 0
        tw = self.contents.text_size (item.price.to_s)
        self.contents.draw_text (270 + (326*(index%2))-tw.width ,(index/2)*32,tw.width,32,item.price.to_s)
      else
        tw = self.contents.text_size ("N/A")
        self.contents.draw_text (270 + (326*(index%2))-tw.width ,(index/2)*32,tw.width+10,32,"N/A")
      end
    end
    self.contents.blt((320*(index%2)),(index/2)*32+4,RPG::Cache.icon(item.icon_name),Rect.new(0,0,24,24))
  end
 
  def item
    return @data[self.index]
  end
end
#===============================================================================
# This window shows how many of that type of item you possess
#===============================================================================
class Window_CurrentlyPossessed < Window_Base
 
  def initialize
    super (0,416,300,64)
    self.contents = Bitmap.new(width-32,height-32)
  end
 
  def refresh (item)
    self.contents.clear
    case item
    when RPG::Item
      quantity = $game_party.item_number (item.id)
    when RPG::Weapon
      quantity = $game_party.weapon_number (item.id)
      for actor in $game_party.actors
        if item.id == actor.weapon_id
          quantity += 1
        end
      end
    when RPG::Armor
      quantity = $game_party.armor_number (item.id)
      for actor in $game_party.actors
        if item.id == actor.armor1_id || item.id == actor.armor2_id || item.id == actor.armor3_id || item.id == actor.armor4_id
          quantity += 1
        end
      end
    end
    self.contents.font.color = system_color
    self.contents.draw_text (0, 4,300,22,"Currently Possessed:")
    self.contents.font.color = normal_color
    ts = (self.contents.text_size(quantity.to_s)).width
    self.contents.draw_text (268 - ts, 4,ts,22,quantity.to_s)
  end
end
#===============================================================================
# This window shows the price of the item with ordering tax
#===============================================================================
class Window_TotalPrice < Window_Base
 
  def initialize (price_multiplier)
    super (300,416,180,64)
    @price_multiplier = price_multiplier
    self.contents = Bitmap.new(width-32,height-32)
  end
 
  def refresh (item)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text (0,4,100,32,"Ordering Tax:")
    if item.price > 0
      ts = (self.contents.text_size (((100*@price_multiplier)-100).to_i.to_s+"%")).width
      ts2 = (self.contents.text_size (((100*@price_multiplier)-100).to_i.to_s)).width
      self.contents.draw_text (148-ts+ts2,4,ts-ts2,32,"%")
      self.contents.font.color = normal_color
      self.contents.draw_text (146-ts,4,ts,32,((100*@price_multiplier)-100).to_i.to_s)
    else
      ts = (self.contents.text_size ("N/A")).width
      self.contents.font.color = normal_color
      self.contents.draw_text (146-ts,4,ts+10,32,"N/A")
    end
  end
end
#===============================================================================
# This window displays the name of the group being viewed
#===============================================================================
class Window_CatalogueName < Window_Base
  def initialize (group)
    super (0,0,400,64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @group = $game_party.catalogue[group][0]
    self.contents.font.color = system_color
    ts = self.contents.text_size (@group + " Log")
    self.contents.draw_text (184 - 0.5*ts.width,0,ts.width,32,@group + " Log")
  end
end
#===============================================================================
# The main processing of the script
#===============================================================================
class Scene_Catalogue
 
  def initialize (group_number, price_multiplier = nil)
    @group_number = group_number
    @price_multiplier = price_multiplier
  end
 
  def main
    @name_window = Window_CatalogueName.new (@group_number)
    @help_window = Window_Help.new
    @help_window.y = 64
    if @price_multiplier!=nil
      @catalogue_window = Window_Catalogue.new (@group_number,@price_multiplier)
      @catalogue_window.height = 288
      @possession_window = Window_CurrentlyPossessed.new
      @possession_window.refresh (@catalogue_window.item)
      @gold_window = Window_Gold.new
      @gold_window.y = 416
      @gold_window.x = 480
      @totalprice_window = Window_TotalPrice.new (@price_multiplier)
      @totalprice_window.refresh (@catalogue_window.item)
      # Make quantity input window
      @number_window = Window_ShopNumber.new
      @number_window.active = false
      @number_window.visible = false
      @number_window.z = 500
      @number_window.x = 136
    else
      @catalogue_window = Window_Catalogue.new (@group_number)
      @itemdata_window = Window_ItemInfo.new
    end
    @catalogue_window.active = true
    @catalogue_window.index = 0
    @ratio_window = Window_TotalItemsRatio.new (@group_number)
    @help_window.set_text (@catalogue_window.item == nil ? "" : @catalogue_window.item.description)
    @help_window.update
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    if @price_multiplier != nil
      @number_window.dispose
      @possession_window.dispose
      @gold_window.dispose
      @totalprice_window.dispose
    else
      @itemdata_window.dispose
    end
    @ratio_window.dispose
    @catalogue_window.dispose
    @help_window.dispose
    @name_window.dispose
  end
 
  def update
    if @price_multiplier == nil && @itemdata_window.visible
      update_iteminfo
    elsif @catalogue_window.active
      catalogue_update
    elsif @number_window.active
      number_update
    end
  end
 
  def update_iteminfo
    if Input.trigger? (Input::B)
      $game_system.se_play($data_system.cancel_se)
      @itemdata_window.visible = false
      @catalogue_window.active = true
    end
  end
 
  def number_update
    @number_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Set quantity input window to inactive / invisible
      @number_window.active = false
      @number_window.visible = false
      @catalogue_window.active = true
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play shop SE
      $game_system.se_play($data_system.shop_se)
      # Set quantity input window to inactive / invisible
      @number_window.active = false
      @number_window.visible = false
      $game_party.lose_gold((@number_window.number * @item.price * @price_multiplier).to_i)
      case @item
      when RPG::Item
        $game_party.gain_item(@item.id, @number_window.number)
      when RPG::Weapon
        $game_party.gain_weapon(@item.id, @number_window.number)
      when RPG::Armor
        $game_party.gain_armor(@item.id, @number_window.number)
      end
      # Refresh each window
      @gold_window.refresh
      @possession_window.refresh (@item)
      @catalogue_window.refresh
      @catalogue_window.active = true
    end
  end
 
  def catalogue_update
    previous_item = @catalogue_window.item
    @catalogue_window.update
    if @catalogue_window.item != previous_item
      @help_window.set_text (@catalogue_window.item == nil ? "" : @catalogue_window.item.description)
      @help_window.update
      if @price_multiplier != nil
        @possession_window.refresh (@catalogue_window.item)
        @totalprice_window.refresh (@catalogue_window.item)
      end
    end
    if Input.trigger?(Input::C)
      if @price_multiplier != nil
        @item = @catalogue_window.item
        # If item is invalid, or price is higher than money possessed, or price = 0
        if @item == nil || @item.price <= 0 || $game_party.gold < (@item.price*@price_multiplier).to_i
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Get items in possession count
        case @item
        when RPG::Item
          number = $game_party.item_number(@item.id)
        when RPG::Weapon
          number = $game_party.weapon_number(@item.id)
        when RPG::Armor
          number = $game_party.armor_number(@item.id)
        end
        # If 99 items are already in possession
        if number == 99
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Calculate maximum amount possible to buy
        max = (@item.price * @price_multiplier).to_i == 0 ? 99 : $game_party.gold / (@item.price * @price_multiplier).to_i
        max = [max, 99 - number].min
        # Change windows to quantity input mode
        @catalogue_window.active = false
        @number_window.set(@item, max, (@item.price * @price_multiplier).to_i)
        @number_window.active = true
        @number_window.visible = true
      else
        @itemdata_window.refresh (@catalogue_window.item)
        @catalogue_window.active = false
        @itemdata_window.visible = true
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      if @price_multiplier == nil
        $scene = Scene_Item.new
      else
        $scene = Scene_Map.new
      end
      return
    end
  end
end   

Credit


  • modern algebra

Thanks

  • zzzdude, for the request

Support

I am willing to rectify any incompatibility issues and fix any bugs. Unless it is a very interesting request, I will not add major features to this upon one user's request, though if many people want it I will do it. I will provide support for this script here at rmrk and at rmrevolution.rmrk.net. If this script is posted elsewhere (other then rmrk, rmrevolution, chaosproject, and RPG RPG Revolution), I am not aware of it and as such, am not able to provide support.  On that note, please don’t steal my script.

Known Compatibility Issues

It will not work with any script which overwrites Window_Gold or Window_ShopNumber
It will not initialize for old savefiles.
This ought to be compatible with SDK. No guarantees once they release the version that separates Window_Gold into nine methods ^_^ (just kidding)

Demo


See Attached

« Last Edit: August 12, 2007, 04:06:01 AM by modern algebra »

*
Rep:
Level 102
2014 Biggest Narcissist Award2014 Biggest Forum Potato2014 Best Non-RM Creator2013 Best IRC Chatterbox2013 Best Game Creator (Non-RM)Participant - GIAW 112012 Best IRC Chatterbox2012 Best Use Of Avatar and Signature space2012 Funniest Member2012 Most Successful TrollSecret Santa 2012 ParticipantProject of the Month winner for November 2009For being a noted contributor to the RMRK Wiki2010 Most Successful Troll2010 Biggest Forum Couch Potato2010 Best IRC Chatterbox
This sounds great. This would be useful for an Animal Crossing game.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Thanks  ;D

Anyway, I am now posting v. 1.2. I decided to make it so that at user-specified areas you can order items from the catalogue. i.e. buy any item that you've previously owned in whichever group you specify. You can also set a tax for ordering it  :police:

EDIT:

Did it up under the guidelines of the new template. I think it looks good  :lol:

« Last Edit: July 13, 2007, 08:10:22 PM by modern algebra »

*******
Rep:
Level 90
Returned from the dead.
This looks really sweet :D +rep to you matey :P
Sincerely,
Your conscience.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
*

Updated to Version 1.3. Now you can view detailed information on any item. As well, icons are shown now, and I fixed a major source of incompatibility between other item scripts. It should work with most any script now.
« Last Edit: July 23, 2007, 02:22:48 AM by modern algebra »

**
Rep:
Level 87
RIP w-hat the fork
wow, thanks!
Sorry for leaving, my laptop broke, had to send it in while I was visiting california, long stupid ordeal with compaq, internet got disconnected, loads of other crap.

I am ganna use this script, EXTREMELY useful.
Huge sig is huuuuge.

**
Rep:
Level 87
RIP w-hat the fork
how do I give rep    :P
Huge sig is huuuuge.

**
Rep:
Level 87
"Cogito ergo sum"
i downloaded the demo but there's a problem with both the demo and when i fixed it up in my game, i can't equip any weapons or armours or accesories, and the ones that i have equipped, one i un-equip them, they disappear

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Odd, you're right, I think it must have happened when I modified soe of the script for v. 1.3

I'll fix it soon and post a new script/demo


Okay, the new script that is up should work. It is incompatible with other scripts which modify gain_item, gain_weapon, and gain_armor methods of Game_Party. I will fix that soon. I think the problem occured because I improperly aliased those methods. So, to fix it quick, I just overwrote them, but I will post a better version when I have time.
« Last Edit: August 06, 2007, 05:21:58 PM by modern algebra »

**
Rep:
Level 87
RIP w-hat the fork
Hmmm...
Say I want a group with items # 37-47, 1-5, etc.
Would I have to go and make [$data_items[37] [$data_items[38]... all the way through 47? or is there a shortcut...
Huge sig is huuuuge.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Shortcut:

$data_items[X,Y]

where X is the id of the first item in the database, and Y is the amount of items after that you want to include. Examples:

$data_items[37,11] returns items 37-47
$data_items[1,5] returns items 1-5

Also, make sure you have v. 1.3b


**
Rep:
Level 87
RIP w-hat the fork
yea, I do.
Know Y, does that count the first number as well?
So it is 37 AND  all the numbers after it?
Huge sig is huuuuge.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
yes, it counts 37

**
Rep:
Level 87
"Cogito ergo sum"
i want to make a log that included selected ID of weapons and also some Armor IDs (accessories), reason for this is that some of the accessories whihc you can equip are added parts for some weapons, how would i go out this, would i have to combine [$data_weapons[IDs]] and [$data_armors[IDs]] in the same pair ()

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Like this:

[$data_armors[ID], $data_weapons[ID], etc...]


**
Rep:
Level 87
"Cogito ergo sum"
if you plan to make another version of this script, i got some suggestions

1. have the script make it so that it shows a complete list of weapons, items & armors but as black icons and can not be read and when you do get that item, weapon or armor, it shows up so you can see what weapons you have got and what ones your missing, good for gamers who like colecting every item in the game

2. a catalogue that lists monsters and their stats
        EDIT: the ones you encounter, thanks zzzdude, i forgot to add that

you don't have to do any of these, their just ideas
« Last Edit: August 10, 2007, 11:00:20 AM by Memor-X »

**
Rep:
Level 87
RIP w-hat the fork
How about monsters you encounter, because then a boss battle would be to predictable.
Huge sig is huuuuge.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Just modified the code to improve the compatibility. My quick fix for v. 1.3b was to overwrite some methods, so if you want to replace 1.3b with 1.4, you can. You don't need to though, as the only thing I changed was compatibility and I made a small edit to the way the Equippable Classes are drawn and I removed the name/price labels. However, if you are not experiencing a compatibility issue, then it isn't necessary to upgrade. If you do upgrade, remember to retain your groups and copy them into the new script.

And I'll make a special version for you which draws all items. but disables the ones you haven't encountered.

As for the bestiary, maybe, we'll see.

EDIT:

Here is your version, Memor-X

Code: [Select]
#===============================================================================
# Catalogue Script
# Version: 1.4 Memor-X Edition
# Author: modern algebra
# Date: July 10, 2007
#------------------------------------------------------------------------------
# Description: Allows you to have a log of all items collected and not yet
# collected.
#------------------------------------------------------------------------------
# Instructions: This script allows you to set up groups of items (items, weapons,
#               and/or armors. All types can be contained within a single group)
#               and allows you to view which of the items in that group have
#               been in your party's possession. By default, there are three
#               groups: items, weapons, armors. But you can change these and add
#               more very easily. To use, call this in a script:
#
#                    $scene = Scene_Catalogue.new (X)
#
#               where X is the group number. I'd suggest this script to be used
#               as items which call common events which have that $scene thing
#               in them. By default, it exits to the item menu. Instructions on
#               how to configure the group are at line 31
#------------------------------------------------------------------------------             
# You can also use this as a method of ordering, like from a real catalogue.
# Basically, it brings up your item log, and you can choose any of the items to
# buy. This can be useful for an Animal Crossing Game for example, but I think
# it can be useful for many types of games. In order to use this feature, use
# this call script:
#
#   $scene = Scene_Catalogue.new (X,Y)
#
# where X is the group number and Y is the ordering tax coefficient. I.e., Y is
# a number, and whatever you make that number it will multiply the price by it.
# For example, if Y = 1.15, then there will be 15% ordering tax. I.e. if an item
# costs 50 Gold in a store, then it would cost 58 Gold to order it from the
# catalogue.
#===============================================================================
class Scene_Title
 
  alias catalogue_groups command_new_game
  def command_new_game
    catalogue_groups
    $catalogue = []
    $encountered_items = []
    #===========================================================================
    # CONFIGURABLE AREA
    #---------------------------------------------------------------------------
    # To make a group, make an array, and place each item you wish to have in
    # that group inside the array. Example:
    #
    # $catalogue.push (["Fish",[$data_items[1], $data_items[3], $data_items[32]]])
    # $catalogue.push (["Gold Items",[$data_armors[5], $data_weapons[3]]])
    #
    # That would make two groups. The first group would be called "Fish" and
    # have item 1, item 3, and item 32 in it, and the second group would be
    # called "Gold Items" and include armor 5 and weapon 3 in it.
    # By default, there are three categories, items, weapons and armors.
    #---------------------------------------------------------------------------
    # The basic set up:
    # $catalogue.push (["name", [<array of items included in the group>]])
    #
    # You can set up as many groups as you like.
    #
    # If you know how, you can also put them on the same line, like this:
    # $catalogue = [["Items",$data_items],["Weapons",$data_weapons],["Armors", $data_armors]]
    # but to keep it simple, follow the instructions. In default, items group is
    # 0, weapons group is 1, armors group is 2, and if you add another group
    # underneath, it would be 3, and so on. So, $scene = Scene_Catalogue.new (0)
    # would bring up the items log, etc...
    #===========================================================================
    $catalogue.push (["Item",$data_items.compact])
    $catalogue.push (["Weapon",$data_weapons.compact])
    $catalogue.push (["Armor", $data_armors.compact])
    #===========================================================================
    # END CONFIGURABLE AREA
    #===========================================================================
    for i in 0...$catalogue.size
      $encountered_items[i] = []
      for j in 0...$catalogue[i][1].size
        $encountered_items[i][j] = false
      end
    end
    for i in $data_system.party_members
      actor = $data_actors[i]
      $game_party.gain_weapon (actor.weapon_id,0)
      $game_party.gain_armor (actor.armor1_id,0)
      $game_party.gain_armor (actor.armor2_id,0)
      $game_party.gain_armor (actor.armor3_id,0)
      $game_party.gain_armor (actor.armor4_id,0)
    end
  end
end
#===============================================================================
# Aliases the gain XXX methods in order to turn the fact that you encountered
# the items on
#===============================================================================
class Game_Party
 
  alias modify_encountered_items gain_item
  def gain_item (item_id, n)
    modify_encountered_items (item_id, n)
    if n >= 0
      for i in 0...$catalogue.size
        if $catalogue[i][1].include? ($data_items[item_id])
          $encountered_items[i][$catalogue[i][1].index($data_items[item_id])] = true
        end
      end
    end
  end
 
  alias modify_encountered_weapons gain_weapon
  def gain_weapon (weapon_id, n)
    modify_encountered_weapons (weapon_id, n)
    if n >= 0
      for i in 0...$catalogue.size
        if $catalogue[i][1].include? ($data_weapons[weapon_id])
          $encountered_items[i][$catalogue[i][1].index($data_weapons[weapon_id])] = true
        end
      end
    end
  end
 
  alias modify_encountered_armors gain_armor
  def gain_armor(armor_id, n)
    modify_encountered_armors (armor_id, n)
    if n >= 0
      for i in 0...$catalogue.size
        if $catalogue[i][1].include? ($data_armors[armor_id])
          $encountered_items[i][$catalogue[i][1].index($data_armors[armor_id])] = true
        end
      end
    end
  end
end 
#===============================================================================
# Draws the information screen
#===============================================================================
class Window_ItemInfo < Window_Base
 
  def initialize
    super (24, 24, 592,432)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.z = 500
    self.visible = false
  end

  def quick_write_text (x,y,text)
    tw = (self.contents.text_size(text)).width
    if tw > 95
      tw = 95
    end
    self.contents.draw_text (x-tw,y,tw+5,32,text)
  end
 
  def refresh (item)
    self.contents.clear
    case item
    when RPG::Item
      type = 0
      type_name = "Item"
    when RPG::Weapon
      type = 1
      type_name = "Weapon"
    when RPG::Armor
      type = 2
      type_name = "Armour"
    end
    self.contents.blt (93,64,RPG::Cache.icon(item.icon_name),Rect.new(0,0,24,24))
    self.contents.font.color = system_color
    self.contents.draw_text (4,96,80,32, "Type:")
    if type != 0
      self.contents.draw_text (4,128,87,32, "Equippable by:")
    end
    self.contents.draw_text (240,40,120,32,"Description:")
    quick_write_text (320,210,"Stats:")
    self.contents.draw_text (65,252,100,32,"Price:")
    if type == 1
      self.contents.draw_text (65,284,100,32,$data_system.words.atk+":")
    elsif type == 2
      self.contents.draw_text (65,284,100,32,"Evasion:")
    end
    if type != 0
      self.contents.draw_text (65,316,100,32,$data_system.words.pdef+":")
      self.contents.draw_text (65,348,100,32,$data_system.words.mdef+":")
      self.contents.draw_text (305,252,100,32,$data_system.words.str+":")
      self.contents.draw_text (305,284,100,32,$data_system.words.agi+":")
      self.contents.draw_text (305,316,100,32,$data_system.words.dex+":")
      self.contents.draw_text (305,348,100,32,$data_system.words.int+":")
    else
      self.contents.draw_text (65,284,100,32,"Occasion:")
      self.contents.draw_text (65,316,80,32,"Scope:")
      self.contents.draw_text (65,348,80,32,"Usage:")
      self.contents.draw_text (305,254,80,32,$data_system.words.hp+" Gain:")
      self.contents.draw_text (305,286,80,32,$data_system.words.sp+" Gain:")
      words = ["","Max "+$data_system.words.hp+":","Max "+$data_system.words.hp+":",
              $data_system.words.str+":", $data_system.words.agi+":",
              $data_system.words.dex+":", $data_system.words.int+":"]
      self.contents.draw_text (305,318,100,32,words[item.parameter_type])
    end
    self.contents.fill_rect (1,33,559,1,Color.new(-150,-150,-255,255))
    self.contents.fill_rect (0,34,559,1,Color.new(-255,-255,-255,255))
    self.contents.fill_rect (0,1,1,398,Color.new(-150,-150,-255,255))
    self.contents.fill_rect (1,1,1,398,Color.new(-255,-255,-255,255))
    self.contents.fill_rect (559,1,1,398,Color.new(-150,-150,-255,255))
    self.contents.fill_rect (558,1,1,398,Color.new(-255,-255,-255,255))
    self.contents.font.color = normal_color
    quick_write_text (320,0,item.name)
    quick_write_text (190,96,type_name)
    quick_write_text (285,252,item.price.to_s)
    if type == 1
      quick_write_text (285,284,item.atk.to_s)
    elsif type == 2
      quick_write_text (285,284,item.eva.to_s)
    end
    if type != 0
      quick_write_text (290,316,item.pdef.to_s)
      quick_write_text (290,348,item.mdef.to_s)
      sign = positive_num?(item.str_plus)
      quick_write_text (500,252,sign+item.str_plus.to_s)
      sign = positive_num?(item.agi_plus)
      quick_write_text (500,284,sign+item.agi_plus.to_s)
      sign = positive_num?(item.dex_plus)
      quick_write_text (500,316,sign+item.dex_plus.to_s)
      sign = positive_num?(item.int_plus)
      quick_write_text (500,348,sign+item.int_plus.to_s)
    else
      words = ["Always","In Battle","Out of Battle","Never"]
      quick_write_text (285,284,words[item.occasion])
      words = ["N/A", "One Enemy", "All Enemies", "One Ally", "All Allies",
               "One Felled Ally", "All Felled Allies", "The User"]
      quick_write_text (285,316,words[item.scope])
      if item.consumable; quick_write_text (285,348,"One Use")
      else; quick_write_text (285,348,"Unlimited Uses")
      end
      if item.recover_hp == 0 && item.recover_hp_rate == 0
        hp_recovery_string = "N/A"
      elsif item.recover_hp_rate != 0 && item.recover_hp_rate != 0
        hp_recovery_string = item.recover_hp_rate.to_s+"% + "+item.recover_hp.to_s
      elsif item.recover_hp != 0
        hp_recovery_string = item.recover_hp.to_s
      else
        hp_recovery_string = item.recover_hp_rate.to_s
      end
      quick_write_text (500,254,hp_recovery_string)
      if item.recover_sp == 0 && item.recover_sp_rate == 0
        sp_recovery_string = "N/A"
      elsif item.recover_sp_rate != 0 && item.recover_sp_rate != 0
        sp_recovery_string = item.recover_sp_rate.to_s+"% + "+item.recover_sp.to_s
      elsif item.recover_sp != 0
        sp_recovery_string = item.recover_sp.to_s
      else
        sp_recovery_string = item.recover_sp_rate.to_s
      end
      quick_write_text (500,286,sp_recovery_string)
      if item.parameter_type != 0
        quick_write_text (500,318,"+"+item.parameter_points.to_s)
      end
    end
    if type != 0
      equip_classes = []
      substring = ""
      for i in 1...$data_classes.size
        e_class = $data_classes[i]
        string = ""
        if type == 1
          test = e_class.weapon_set
        elsif type == 2
          test = e_class.armor_set
        end
        if test.include? (item.id)
          if e_class.name.size <= 4
            string = e_class.name.dup
          else
            string += e_class.name[0,1]
            for i in 1...e_class.name.size
              substring = e_class.name[i,1]
              if substring !="a"&&substring !="e"&&substring !="i"&&substring !="o"&&substring != "u"
                string +=substring
              end
            end
            if string.size > 4
              string = string[0,2]+string[string.size-2,2]
            end
          end
          equip_classes.push (string.upcase!)
        end
      end
      if equip_classes.nitems == 0
        quick_write_text (160,296,"N/A")
      else
        line_length = 0
        line_number = 0
        for i in 0...equip_classes.size
          if i != equip_classes.size - 1
            tw = (self.contents.text_size(equip_classes[i]+", ")).width
            self.contents.draw_text (90+line_length,128+line_number,tw,32,equip_classes[i]+", ")
          else
            tw = (self.contents.text_size(equip_classes[i])).width
            self.contents.draw_text (90+line_length,128+line_number,tw,32,equip_classes[i])
          end
          line_length += tw
          if line_length > 75
            line_number +=32
            line_length = -80
          end
        end
        self.contents.fill_rect (209,202,350,1,Color.new(-255,-255,-255,255))
        self.contents.fill_rect (210,201,350,1,Color.new(-150,-150,-255,255))
        if line_number > 64
          self.contents.fill_rect (209,34,1,220,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (210,33,1,220,Color.new(-150,-150,-255,255))
          self.contents.fill_rect (0,254,209,1,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (1,253,209,1,Color.new(-150,-150,-255,255))
        elsif line_number > 32
          self.contents.fill_rect (209,34,1,120+line_number,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (210,33,1,120+line_number,Color.new(-150,-150,-255,255))
          self.contents.fill_rect (209,120+line_number,1,82-line_number,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (210,120+line_number,1,82-line_number,Color.new(-150,-150,-255,255))
          self.contents.fill_rect (0,154+line_number,209,1,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (1,153+line_number,209,1,Color.new(-150,-150,-255,255))
        else
          self.contents.fill_rect (209,34,1,168,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (210,33,1,168,Color.new(-150,-150,-255,255))
          self.contents.fill_rect (0,202,209,1,Color.new(-255,-255,-255,255))
          self.contents.fill_rect (1,201,209,1,Color.new(-150,-150,-255,255))
        end
      end
    end
    if item.is_a? (RPG::Item)
      self.contents.fill_rect (209,34,1,170,Color.new(-255,-255,-255,255))
      self.contents.fill_rect (210,33,1,170,Color.new(-150,-150,-255,255))
      self.contents.fill_rect (0,202,559,1,Color.new(-255,-255,-255,255))
      self.contents.fill_rect (1,201,559,1,Color.new(-150,-150,-255,255))
    end
    desc = item.description
    line = []
    ts = desc.size
    line_index = 0
    limit = 0
    loop do
      line[line_index] = desc[limit, 40]
      for i in 1...40
        if line[line_index][-i,1] == " " || limit + (40-i) >= desc.size
          limit += (41-i)
          ts -= 40-i
          line_index +=1
          break
        else
          line[line_index][-i,1] = " "
        end
      end
      if ts <= 0
        break
      end
    end 
    line.compact!
    for i in 0...line.size
      self.contents.draw_text (220, 28*i + 76, 350,32, line[i])
    end
  end
 
  def positive_num? (num)
    if num > 0
      return "+"
    else
      return ""
    end
  end
end
#===============================================================================
# This window displays the ratio of collected items to total items
#===============================================================================
class Window_TotalItemsRatio < Window_Base
 
  def initialize (group_number)
    super (400,0,240,64)
    self.contents = Bitmap.new (width-32, height-32)
    @total = $catalogue[group_number][1].size
    @current = 0
    for i in 0...@total
      if $encountered_items[group_number][i] == true
        @current += 1
      end
    end
    if @current == @total
      self.contents.font.color = system_color
    end
    tw = (self.contents.text_size(@current.to_s + " / " + @total.to_s)).width
    self.contents.draw_text (104 - (tw/2),0,tw,32,@current.to_s + " / " + @total.to_s)
  end
end
#===============================================================================
# This window displays all collected items
#===============================================================================
class Window_Catalogue < Window_Selectable
 
  def initialize (group, price_multiplier = nil)
    super (0,128,640,352)
    @column_max = 2
    @group = $catalogue[group][1]
    @group_number = group
    @price_multiplier = price_multiplier
    refresh
  end
 
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Check inventory for new additions
    for i in 0...@group.size
      if @price_multiplier != nil
        if $encountered_items[@group_number][i] == true
          @data.push (@group[i])
        end
      else
        @data.push (@group[i])
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(@data[i], i)
      end
    end
  end
 
  def draw_item (item, index)
    if @price_multiplier != nil
      if $game_party.gold >= (item.price * @price_multiplier)
        self.contents.font.color = normal_color
        self.contents.draw_text ((320*(index%2))+30,(index/2)*32,200,32,item.name)
      else
        self.contents.font.color = disabled_color
        self.contents.draw_text ((320*(index%2))+30,(index/2)*32,200,32,item.name)
      end
      if item.price != 0
        tw = self.contents.text_size ((item.price * @price_multiplier).to_i.to_s)
        self.contents.draw_text (270 + (326*(index%2))-tw.width ,(index/2)*32,tw.width,32,(item.price * @price_multiplier).to_i.to_s)
      else
        tw = self.contents.text_size ("N/A")
        self.contents.draw_text (270 + (326*(index%2))-tw.width ,(index/2)*32,tw.width+10,32,"N/A")
      end
    else
      if $encountered_items[@group_number][index] == true
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      self.contents.draw_text ((320*(index%2))+30,(index/2)*32,200,32,item.name)
      if item.price != 0
        tw = self.contents.text_size (item.price.to_s)
        self.contents.draw_text (270 + (326*(index%2))-tw.width ,(index/2)*32,tw.width,32,item.price.to_s)
      else
        tw = self.contents.text_size ("N/A")
        self.contents.draw_text (270 + (326*(index%2))-tw.width ,(index/2)*32,tw.width+10,32,"N/A")
      end
    end
    self.contents.blt((320*(index%2)),(index/2)*32+4,RPG::Cache.icon(item.icon_name),Rect.new(0,0,24,24))
  end
 
  def item
    return @data[self.index]
  end
end
#===============================================================================
# This window shows how many of that type of item you possess
#===============================================================================
class Window_CurrentlyPossessed < Window_Base
 
  def initialize
    super (0,416,300,64)
    self.contents = Bitmap.new(width-32,height-32)
  end
 
  def refresh (item)
    self.contents.clear
    case item
    when RPG::Item
      quantity = $game_party.item_number (item.id)
    when RPG::Weapon
      quantity = $game_party.weapon_number (item.id)
      for actor in $game_party.actors
        if item.id == actor.weapon_id
          quantity += 1
        end
      end
    when RPG::Armor
      quantity = $game_party.armor_number (item.id)
      for actor in $game_party.actors
        if item.id == actor.armor1_id || item.id == actor.armor2_id || item.id == actor.armor3_id || item.id == actor.armor4_id
          quantity += 1
        end
      end
    end
    self.contents.font.color = system_color
    self.contents.draw_text (0, 4,300,22,"Currently Possessed:")
    self.contents.font.color = normal_color
    ts = (self.contents.text_size(quantity.to_s)).width
    self.contents.draw_text (268 - ts, 4,ts,22,quantity.to_s)
  end
end
#===============================================================================
# This window shows the price of the item with ordering tax
#===============================================================================
class Window_TotalPrice < Window_Base
 
  def initialize (price_multiplier)
    super (300,416,180,64)
    @price_multiplier = price_multiplier
    self.contents = Bitmap.new(width-32,height-32)
  end
 
  def refresh (item)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text (0,4,100,32,"Ordering Tax:")
    if item.price > 0
      ts = (self.contents.text_size (((100*@price_multiplier)-100).to_i.to_s+"%")).width
      ts2 = (self.contents.text_size (((100*@price_multiplier)-100).to_i.to_s)).width
      self.contents.draw_text (148-ts+ts2,4,ts-ts2,32,"%")
      self.contents.font.color = normal_color
      self.contents.draw_text (146-ts,4,ts,32,((100*@price_multiplier)-100).to_i.to_s)
    else
      ts = (self.contents.text_size ("N/A")).width
      self.contents.font.color = normal_color
      self.contents.draw_text (146-ts,4,ts+10,32,"N/A")
    end
  end
end
#===============================================================================
# This window displays the name of the group being viewed
#===============================================================================
class Window_CatalogueName < Window_Base
  def initialize (group)
    super (0,0,400,64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @group = $catalogue[group][0]
    self.contents.font.color = system_color
    ts = self.contents.text_size (@group + " Log")
    self.contents.draw_text (184 - 0.5*ts.width,0,ts.width,32,@group + " Log")
  end
end
#===============================================================================
# The main processing of the script
#===============================================================================
class Scene_Catalogue
 
  def initialize (group_number, price_multiplier = nil)
    @group_number = group_number
    @price_multiplier = price_multiplier
  end
 
  def main
    @name_window = Window_CatalogueName.new (@group_number)
    @help_window = Window_Help.new
    @help_window.y = 64
    if @price_multiplier!=nil
      @catalogue_window = Window_Catalogue.new (@group_number,@price_multiplier)
      @catalogue_window.height = 288
      @possession_window = Window_CurrentlyPossessed.new
      @possession_window.refresh (@catalogue_window.item)
      @gold_window = Window_Gold.new
      @gold_window.y = 416
      @gold_window.x = 480
      @totalprice_window = Window_TotalPrice.new (@price_multiplier)
      @totalprice_window.refresh (@catalogue_window.item)
      # Make quantity input window
      @number_window = Window_ShopNumber.new
      @number_window.active = false
      @number_window.visible = false
      @number_window.z = 500
      @number_window.x = 136
    else
      @catalogue_window = Window_Catalogue.new (@group_number)
      @itemdata_window = Window_ItemInfo.new
    end
    @catalogue_window.active = true
    @catalogue_window.index = 0
    @ratio_window = Window_TotalItemsRatio.new (@group_number)
    @help_window.set_text (@catalogue_window.item == nil ? "" : @catalogue_window.item.description)
    @help_window.update
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    if @price_multiplier != nil
      @number_window.dispose
      @possession_window.dispose
      @gold_window.dispose
      @totalprice_window.dispose
    else
      @itemdata_window.dispose
    end
    @ratio_window.dispose
    @catalogue_window.dispose
    @help_window.dispose
    @name_window.dispose
  end
 
  def update
    if @price_multiplier == nil && @itemdata_window.visible
      update_iteminfo
    elsif @catalogue_window.active
      catalogue_update
    elsif @number_window.active
      number_update
    end
  end
 
  def update_iteminfo
    if Input.trigger? (Input::B)
      $game_system.se_play($data_system.cancel_se)
      @itemdata_window.visible = false
      @catalogue_window.active = true
    end
  end
 
  def number_update
    @number_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Set quantity input window to inactive / invisible
      @number_window.active = false
      @number_window.visible = false
      @catalogue_window.active = true
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play shop SE
      $game_system.se_play($data_system.shop_se)
      # Set quantity input window to inactive / invisible
      @number_window.active = false
      @number_window.visible = false
      $game_party.lose_gold((@number_window.number * @item.price * @price_multiplier).to_i)
      case @item
      when RPG::Item
        $game_party.gain_item(@item.id, @number_window.number)
      when RPG::Weapon
        $game_party.gain_weapon(@item.id, @number_window.number)
      when RPG::Armor
        $game_party.gain_armor(@item.id, @number_window.number)
      end
      # Refresh each window
      @gold_window.refresh
      @possession_window.refresh (@item)
      @catalogue_window.active = true
    end
  end
 
  def catalogue_update
    previous_item = @catalogue_window.item
    @catalogue_window.update
    if @catalogue_window.item != previous_item
      @help_window.set_text (@catalogue_window.item == nil ? "" : @catalogue_window.item.description)
      @help_window.update
      if @price_multiplier != nil
        @possession_window.refresh (@catalogue_window.item)
        @totalprice_window.refresh (@catalogue_window.item)
      end
    end
    if Input.trigger?(Input::C)
      if @price_multiplier != nil
        @item = @catalogue_window.item
        # If item is invalid, or price is higher than money possessed, or price = 0
        if @item == nil || @item.price <= 0 || $game_party.gold < (@item.price*@price_multiplier).to_i
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Get items in possession count
        case @item
        when RPG::Item
          number = $game_party.item_number(@item.id)
        when RPG::Weapon
          number = $game_party.weapon_number(@item.id)
        when RPG::Armor
          number = $game_party.armor_number(@item.id)
        end
        # If 99 items are already in possession
        if number == 99
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Calculate maximum amount possible to buy
        max = (@item.price * @price_multiplier).to_i == 0 ? 99 : $game_party.gold / (@item.price * @price_multiplier).to_i
        max = [max, 99 - number].min
        # Change windows to quantity input mode
        @catalogue_window.active = false
        @number_window.set(@item, max, (@item.price * @price_multiplier).to_i)
        @number_window.active = true
        @number_window.visible = true
      else
        @itemdata_window.refresh (@catalogue_window.item)
        @catalogue_window.active = false
        @itemdata_window.visible = true
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      if @price_multiplier == nil
        $scene = Scene_Item.new
      else
        $scene = Scene_Map.new
      end
      return
    end
  end
end   

I haven't really tested it, but it ought to work. And:
Quote
If you do upgrade, remember to retain your groups and copy them into the new script.

« Last Edit: August 11, 2007, 05:37:23 AM by modern algebra »

**
Rep:
Level 87
"Cogito ergo sum"
thanks modern algebra, you'll be remembered for this

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Alright, I've been working on a version 2.0 for this, and the purpose of my update is to allow easy integration for any type of catalogue information you might desire. What this means is that you can make groups which hold monsters, or skills, or whatever other type of data you might want to make catalogues for and use the catalogue interface to get to that information (Naturally, to make your own groups you would need to be a scripter, but I am willing to make groups for you if you cannot). Considering this, I wanted to know what you guys felt of this design for the bestiary data:

This is of a large battler, as I wanted to test the size translation



I will probably make some sort of analyze skill effect to go along with it, and only display information if the creature has been analyzed. However, what do you guys think of the info I show? Should I show all the specific stats? Should I show EXP and Gold somewhere? Should I shrink large battlers so that they do not take up so much space? Should I do something with the icons to make it more clear what elements the creature is strong or weak against? Should I get rid of the letters and just have the opacity show that?

I appreciate any comments. Also, it looks like the window is not centred, but it is, my windowblinds just cuts stuff.

*
Communication begins with understanding
Rep:
Level 89
Project of the Month winner for October 2007
Instead of having the monsters battler in the backround, I would suggest making a new window, with a smaller version of the monsters battler inside. Having the battler in the backround, makes it harder for some people to read the white text if the text cross the battler.(Or black, wich depends on wich colour you have on the text :)), but that's just what I think.

Other from that, it sounds like a nice edition to the script.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Well, most monsters wouldn't have so large a battler. I don't like the idea of a new window, assuming that by that you mean a window that you call if you want to see the battler (I am assuming that simply because having another window visible at the same time doesn't rectify the problem). However, I could shrink large battlers when they expand over the text. I'll post what that looks like in a bit. Alternately, I could make the battler semi-transparent, more so then it already is.

The shrunken battler looks like this:



And the low opacity like this:



Naturally, I wouldn't do either unless the battler is wide and expands over the text
« Last Edit: October 11, 2007, 10:35:46 PM by modern algebra »

********
Shadow Knight
Rep:
Level 91
Ruin that brick wall!
Project of the Month winner for October 2008
Very nice addition to the script, modern algebra!
But I think a better design is a split-screen.

One contains the monsters' stats, while the other the pic and description. :)
Be kind, everyone you meet is fighting a hard battle.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
A picture of what you mean? I don't really see how it would accomodate large battlers to split screen it. Maybe I just don't get what you mean  :-\
Show me a picture.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Also, what do you guys think of this:



Should I just leave icons out of the bestiary? They can look pretty crappy resized like that. If you think I should, which looks better? THe one aabove or: