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.
[resolved] compatibility issue with two inventory scipts

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 81
hey,
i´m using modern algebras limited inventory script and the KGC_CategorizeItem script
the scipts work fine, but if i use them simultaneously the game crashes when accessing the item menu.
Error massage:         

Script ´Item Categorization´ line 358: NoMethodError occured.
undefined method ´update´ for nil:NilClass

i would be super happy if someone could tell me which line to edit, to make it work.

rofl1337

whole Categorize script:
Spoiler for:
Code: [Select]
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/    ?            Item Categorization - KGC_CategorizeItem             ? VX ?
#_/    ?                  Last update : 2008/04/10                            ?
#_/    ?                Translated by Mr. Anonymous                           ?
#_/-----------------------------------------------------------------------------
#_/  Adds a function to the Items screen which allows the player to display
#_/  items by catagory.
#_/  To assign a category to an item, you must add <category IDENTIFIER> to the
#_/  notes on the specified item.
#_/  EX. A Potion would be listed as <category Goods> and a Sword would be
#_/  listed as <category Weapons>, provided you use the default terminology.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

$data_system = load_data("Data/System.rvdata") if $data_system == nil

#==============================================================================#
#                             ? Customization ?                                #         
#==============================================================================#

module KGC
module CategorizeItem
  #                  ? Automatically Catagorize Items ?
  ENABLE_AUTO_CATEGORIZE = true
 
  #                   ? Duplicate Category Entries. ?
  #  Set to false, items can have multiple categories.
  #  Set to true, items will be classified under the last tag (In the item
  #  database "Notes")
  NOT_ALLOW_DUPLICATE = false

  #                      ? Category Identifier ?
  #  Arrange names in order to identify a category with the category identifier.
  #  These are the default item catagories translated for future reference.
  #  "Goods", "Combat", "Weapons", "Shields", "Helmets", "Armor",
  #  "Accessories", "Valuables", "Special Items", "All Items"
  CATEGORY_IDENTIFIER = [
    "Goods",          # Consumable items (potion)
    "Weapons",        # Weapons
    "Stuff",          # Shields
    "Hats",           # Head Gear / Helmets
    "Coats",          # Body Gear / Armor
    "Accessory",    # Accessories / Rings, Necklaces, etc
    "Special",        # AKA Plot Devices. Special keys, etc.
    "All",            # All Items
  ]
 
  #                   ? Default Catagory Display ?
  #  Not hard to figure this one out.
  ITEM_DEFAULT_CATEGORY = "Goods"

  #                   ? Item Screen Category Name ?
  #  Shows what current category is selected in the item description window.
  #  Must be arranged in the same order as CATAGORY_IDENTIFIER.
  CATEGORY_NAME = [
    "Goods",
    Vocab.weapon,                # Weapons
    Vocab.armor1,                # Shields
    "#{Vocab.armor2}",           # Head Gear
    "#{Vocab.armor3}",           # Body Gear
    Vocab.armor4,                # Accessories
    "Special",
    "All",
  ]

  #                       ? Descriptive Text ?
  #  Must be arranged in the same order as CATAGORY_IDENTIFIER
  CATEGORY_DESCRIPTION = [
    "Viewing #{Vocab.item}.",
    "Viewing #{Vocab.weapon}.",
    "Viewing #{Vocab.armor1}.",
    "Viewing #{Vocab.armor2}.",
    "Viewing #{Vocab.armor3}.",
    "Viewing #{Vocab.armor4}.",
    "Viewing Special #{Vocab.item}.",
    "Viewing All #{Vocab.item}.",
  ]

  # ? Coordinates of item description window. [ x, y ]
  CATEGORY_WINDOW_POSITION  = [1, 48]
  # ? Number of rows in the item description window.
  CATEGORY_WINDOW_COLUMNS   = 10
  # ? Item description window column line width.
  CATEGORY_WINDOW_COL_WIDTH = 50
  # ? item description window column spacer width.
  CATEGORY_WINDOW_COL_SPACE = 1
end
end

#------------------------------------------------------------------------------#

$imported = {} if $imported == nil
$imported["CategorizeItem"] = true

module KGC::CategorizeItem
  #                        ? Item Index ?
  ITEM_DEFAULT_CATEGORY_INDEX = CATEGORY_IDENTIFIER.index(ITEM_DEFAULT_CATEGORY)

  #                     ? Reserved Category Index ?
  #  To be honest I'm not entirely sure what this affects.
  RESERVED_CATEGORY_INDEX = {
    "All Items"     => CATEGORY_IDENTIFIER.index("All Items"),
    "Valuables"   => CATEGORY_IDENTIFIER.index("Valuables"),
    "Weapons"     => CATEGORY_IDENTIFIER.index("Weapons"),
    "Gear"     => CATEGORY_IDENTIFIER.index("Gear"),
    "Shields"       => CATEGORY_IDENTIFIER.index("Shields"),
    "Helmets"   => CATEGORY_IDENTIFIER.index("Helmets"),
    "Armor" => CATEGORY_IDENTIFIER.index("Armor"),
    "Accessories"   => CATEGORY_IDENTIFIER.index("Accessories")
  }
 
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#  Unless you know what you're doing, it's best not to alter anything beyond  #
#  this point, as this only affects the tags used for "Notes" in database.    #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#  Whatever word(s) are after the separator ( | ) in the following lines are
#   what are used to determine what is searched for in the "Notes" section.

  # Regular Expression Definition
  module Regexp
    # Base Item Module
    module BaseItem
      # Category tag string
      CATEGORY = /^<(?:CATEGORY|classification|category?)[ ]*(.*)>/i
    end
  end
end

#==============================================================================
# ? RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  def create_categorize_item_cache
    if @__item_category == nil || !KGC::CategorizeItem::ENABLE_AUTO_CATEGORIZE
      @__item_category = []
    else
      @__item_category.compact!
    end

    self.note.split(/[\r\n]+/).each { |line|
      if line =~ KGC::CategorizeItem::Regexp::BaseItem::CATEGORY
        # ????
        c = KGC::CategorizeItem::CATEGORY_IDENTIFIER.index($1)
        @__item_category << c if c != nil
      end
    }
    if @__item_category.empty?
      @__item_category << KGC::CategorizeItem::ITEM_DEFAULT_CATEGORY_INDEX
    elsif KGC::CategorizeItem::NOT_ALLOW_DUPLICATE
      # ??????????????
      @__item_category = [@__item_category.pop]
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def item_category
    create_categorize_item_cache if @__item_category == nil
    return @__item_category
  end
end

#==================================End Class===================================#

#==============================================================================
# ? RPG::UsableItem
#==============================================================================

class RPG::UsableItem < RPG::BaseItem
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  def create_categorize_item_cache
    @__item_category = []
    if self.price == 0
      @__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Valuables"]
    end
    super
  end
end

#==================================End Class===================================#

#==============================================================================
# ? RPG::Weapon
#==============================================================================

class RPG::Weapon < RPG::BaseItem
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  def create_categorize_item_cache
    @__item_category = []
    @__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Weapon"]
    super
  end
end

#==================================End Class===================================#

#==============================================================================
# ? RPG::Armor
#==============================================================================

class RPG::Armor < RPG::BaseItem
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  def create_categorize_item_cache
    @__item_category = []
    @__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Armor"]
    type = nil
    case self.kind
    when 0
      type = "Shields"
    when 1
      type = "Head Gear"
    when 2
      type = "Body Gear"
    when 3
      type = "Accessories"
    end
    if type != nil
      @__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX[type]
    end
    super
  end
end

#==================================End Class===================================#

#==============================================================================
# ? Window_Item
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  attr_reader   :category                 # ????
  #--------------------------------------------------------------------------
  # ? ?????????
  #     x      : ?????? X ??
  #     y      : ?????? Y ??
  #     width  : ???????
  #     height : ????????
  #--------------------------------------------------------------------------
  alias initialize_KGC_CategorizeItem initialize
  def initialize(x, y, width, height)
    @category = 0

    initialize_KGC_CategorizeItem(x, y, width, height)
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def category=(value)
    @category = value
    refresh
  end
  #--------------------------------------------------------------------------
  # ? ????????????????
  #     item : ????
  #--------------------------------------------------------------------------
  alias include_KGC_CategorizeItem? include?
  def include?(item)
    return false if item == nil

    # ?????????????
    if @category == KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["All Items"]
      return true
    end

    result = include_KGC_CategorizeItem?(item)

    unless result
      # ?????????????
      if $imported["UsableEquipment"] && $game_party.item_can_use?(item)
        result = true
      end
    end
    # ?????????????
    unless $game_temp.in_battle
      result &= (item.item_category.include?(@category))
    end

    return result
  end
end

#==================================End Class===================================#

#==============================================================================
# ? Window_ItemCategory
#------------------------------------------------------------------------------
# ?????????????????????????
#==============================================================================

class Window_ItemCategory < Window_Command
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def initialize
    cols = KGC::CategorizeItem::CATEGORY_WINDOW_COLUMNS
    width = KGC::CategorizeItem::CATEGORY_WINDOW_COL_WIDTH * cols + 32
    width += (cols - 1) * KGC::CategorizeItem::CATEGORY_WINDOW_COL_SPACE
    commands = KGC::CategorizeItem::CATEGORY_NAME
    super(width, commands, cols, 0,
      KGC::CategorizeItem::CATEGORY_WINDOW_COL_SPACE)
    self.x = KGC::CategorizeItem::CATEGORY_WINDOW_POSITION[0]
    self.y = KGC::CategorizeItem::CATEGORY_WINDOW_POSITION[1]
    self.z = 1000
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(KGC::CategorizeItem::CATEGORY_DESCRIPTION[self.index])
  end
end

#==================================End Class===================================#

#==============================================================================
# ? Scene_Item
#==============================================================================

class Scene_Item < Scene_Base
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  alias start_KGC_CategorizeItem start
  def start
    start_KGC_CategorizeItem

    @category_window = Window_ItemCategory.new
    @category_window.help_window = @help_window
    show_category_window
  end
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  alias terminate_KGC_CategorizeItem terminate
  def terminate
    terminate_KGC_CategorizeItem

    @category_window.dispose
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  alias update_KGC_CategorizeItem update
  def update
    @category_window.update

    update_KGC_CategorizeItem

    if @category_window.active
      update_category_selection
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def update_category_selection
    unless @category_activated
      @category_activated = true
      return
    end

    # ?????????
    if @last_category_index != @category_window.index
      @item_window.category = @category_window.index
      @item_window.refresh
      @last_category_index = @category_window.index
    end

    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      hide_category_window
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  alias update_item_selection_KGC_CategorizeItem update_item_selection
  def update_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      show_category_window
      return
    end

    update_item_selection_KGC_CategorizeItem
  end
  #--------------------------------------------------------------------------
  # ? ????????????
  #--------------------------------------------------------------------------
  def show_category_window
    @category_window.open
    @category_window.active = true
    @item_window.active = false
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #--------------------------------------------------------------------------
  def hide_category_window
    @category_activated = false
    @category_window.close
    @category_window.active = false
    @item_window.active = true
    # ???????????????????
    if @item_window.index >= @item_window.item_max
      @item_window.index = [@item_window.item_max - 1, 0].max
    end
  end
end

#==================================End Class===================================#

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/  The original untranslated version of this script can be found here:
# http://f44.aaa.livedoor.jp/~ytomy/tkool/rpgtech/php/tech.php?tool=VX&cat=tech_vx/item&tech=categorize_item
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
« Last Edit: May 06, 2010, 05:45:30 PM by rofl1337 »


***
Rep:
Level 81
i edited the three parts of the script and placed the limited inventory script below the kgc-script.
sadly the error still occurs.
its even the same error massage.
any ideas what i did wrong?
sincerly
rofl1337

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
I don't know - it's not my fix and I never tested it. Try putting the KGC script below the Limited Inventory though - his post sort of makes the order ambiguous since he says put Limited Inventory below KGC but then says discard that.

***
Rep:
Level 81
you brought sunshine and happyness into my heart - it worked.

***
EXECUTED WEEBLING?
Rep:
Level 81
Im still here.. hahahahahaha
You Might Want To Put [Resolved] At The Begining Of Your Title So People Know You Do Not Need Help :D



By The Way Don't Forget To Checkout My New Game Heres The Link >>http://rmrk.net/index.php/topic,38332.msg447657.html#msg447657<<
Hey if you need anything just ask.