Seiruki - Categorize Item Scene Mod

Status
Not open for further replies.

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,333
Reaction score
483
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
173
Reaction score
62
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,333
Reaction score
483
First Language
English
Primarily Uses
RMVXA
Undefined method <<
 

KK20

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

Roninator2

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

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
173
Reaction score
62
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,333
Reaction score
483
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
13,111
Reaction score
13,612
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 Posts

Latest Profile Posts

Not easy to find DS resources, is it? I need to make a good compilation thread linking to all the artists that do DS...
Spent a whole evening planning Stats, Animations, Abilities of 24 different weapons.. Only to realize I was just Bloating the Game. In the end i decided to stick with only 6.
Haven’t gotten over a mentor’s promotion. He deserves it, but he was the first person to be nice to me at work. It’s been hard for me to let him go.
So its confirmed MZ will have tile size locked at 48x48. So thats extremely lame. Still probably going to get it for the assets but Im gonna pout the whole time.
A friend used to ask why I don't colorize most of my drawings? The answer: I'm colorblind.

Forum statistics

Threads
99,341
Messages
964,310
Members
130,945
Latest member
studiojap
Top