Seiruki - Categorize Item Scene Mod

Status
Not open for further replies.

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,226
Reaction score
456
First Language
English
Primarily Uses
RMVXA
https://www.rpgmakercentral.com/topic/661-vxa-categorize-item-scene/

I've been working on figuring out how to change this script to help another member on another forum.
TheoAllen has helped me to figure out some of the problem, but I haven't been able to finish it.
I did make some progress, but my knowledge of ruby is certainly low.

Essentially the request was to hide item categories if there were no items for that specific category.

The code given by Theoallen which works for the default categories is
Code:
CategoryConditions = {
:item => lambda { !$game_party.items.empty? && $game_party.items.any? {|item| !item.key_item? }},
:weapon => lambda { !$game_party.weapons.empty? },
:armor => lambda { !$game_party.armors.empty? },
:key_item => lambda { !$game_party.items.empty? && $game_party.items.any? {|item| item.key_item? }},
:all_item => lambda { !$game_party.all_items.empty? },
}
for the make command section
Code:
 alias icat_make_command_list make_command_list
   def make_command_list
  ICAT::VISIBLE_CATEGORY_INDEX.each { |symbol, label|
    add_command(label, symbol) if ICAT::CategoryConditions[symbol].call
  }
 end
From here there are two problems,

The custom categories that can be added to any item, weapon or armor
and the help description. The help text doesn't line up when categories are removed.

I tried this for custom categories but it doesn't really work, again lack of knowledge.
Code:
:potion => lambda { !$game_party.all_items.empty? && $game_party.all_items.any? {|item| item.find_category } },
:ammunition => lambda { !$game_party.all_items.empty? && $game_party.all_items.any? {|item| item.find_category } },
linking to this section i added in under baseitem
Code:
 def find_category
  self.note.split(/[\r\n]+/).each { |line|
    if line =~ ICAT::Regexp::BaseItem::CATEGORY
    c = ICAT::CATEGORY_IDENTIFIER.key($1)
    return c if c != nil
    end
  }
 end
I did try using item_category in BaseItem, but the categories show up when an item is available but not for that category.

Thanks for any advice.

**edit...

I just got the custom categories to work.
Code:
:potion => lambda { $game_party.all_items.any? {|item| item.find_category == :potion} },
:ammunition => lambda { $game_party.all_items.any? {|item| item.find_category == :ammunition} },
Now if someone can advise with the help text indexing.
 
Last edited:

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
150
Reaction score
57
First Language
English
Primarily Uses
RMXP
Change the configuration for the descriptions to match VISIBLE_CATEGORY_INDEX:
Code:
CATEGORY_DESCRIPTION = {
  #:item => "Viewing basic items.",
  :weapon => "Viewing attack-type items for use in battles.",
  :armor => "Viewing head, body, arm and leg equipment.",
  :key_item => "Viewing important items.",
  :all_item => "Viewing all items.",
  :potion => "Viewing potions.",
  :ammunition => "Viewing ammunition.",
}
And replace the methods inside class ICAT_WindowItemCategory with these:
Code:
  def initialize
    @category_list = []
    super
    self.z = 1000
    self.index = 0
  end

  def update_help
    @help_window.set_text(ICAT::CATEGORY_DESCRIPTION[@category_list[self.index]])
  end

  alias icat_make_command_list make_command_list
  def make_command_list
    @category_list.clear
    ICAT::VISIBLE_CATEGORY_INDEX.each do |symbol, label|
      add_command(label, symbol)
      @category_list << symbol
    end
  end
Untested
 
Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,226
Reaction score
456
First Language
English
Primarily Uses
RMVXA
Undefined method <<
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
150
Reaction score
57
First Language
English
Primarily Uses
RMXP
In the initialize method, move @category_list above super
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,226
Reaction score
456
First Language
English
Primarily Uses
RMVXA
Cannot convert Symbol to integer
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
150
Reaction score
57
First Language
English
Primarily Uses
RMXP
Did you not change CATEGORY_DESCRIPTION to a hash (and left it as an array)? Notice the curly braces in my post.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,226
Reaction score
456
First Language
English
Primarily Uses
RMVXA
I just thought of that and changed it to try it out. then refreshed the thread and saw your reply.
It fixed the error. But I think there is still an issue. doing some testing now.

Yep, there was a problem. It was adding the category even if there were no items.
I added in the condition for the previous add command check and it works
Code:
    @category_list << symbol if ICAT::CategoryConditions[symbol].call
Script mod complete.
https://www.rpgmakercentral.com/topic/42160-categorize-item-scene/
 
Last edited:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
12,961
Reaction score
13,317
First Language
English
Primarily Uses
RMVXA

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Managed to find a way to hang a bed cover over my window. So no more being toasted alive in the afternoon!:kaoswt2:
So, uh, has anyone tried buying any resources from KokoroReflections? Because I've been looking for a 'buy' button on the site for like 10 minutes now and can't find one.
Any also thought it's too cringy to put the word "and you" in your credit as a special thanks?
Cause that's what I thought...
Everyone in the US right now: Please stay safe.
Symphony Celestia: Prophecy of the Falling Stars RPG Maker music pack WIP. Symphony Celestia is a new series that focuses on symphonic and orchestrated music to tell a story. Each story will include compositions that make up that story from beginning to end. Themes include: Battles, adventures, character themes, etc. Below is a video preview to the first story.

Forum statistics

Threads
97,980
Messages
948,322
Members
129,245
Latest member
Tanoukun
Top