Skill/Item List based on Learn/Obtain order

Basically this very short snippet allows you to show the skill and item list based on the order that you learned the skills (obtained items) instead of the default which uses the database ID to determine sort order.

Script:

Spoiler
class Game_Actor < Game_Battler  def skills    (@skills | added_skills).collect {|id| $data_skills[id] }  endendclass Game_Party < Game_Unitdef items    @items.keys.collect {|id| $data_items[id] }  end def weapons    @weapons.keys.collect {|id| $data_weapons[id] }  end   def armors    @armors.keys.collect {|id| $data_armors[id] }  endend
 

Notes:

 

Obviously really easy to do, so it's free for anyone. I just posted it since I think I saw someone asking about this some time ago and some people might need it.
I like cool little scripts like this. This kind of script is perfect for me, because I cannot get a proper order that I like for items and skills.
Hello,

I'm trying to use this script with XP and it does not function. I'm assuming this was written for VX/Ace, and was wondering if there was an RMXP equivalent you know of? I would really like to order skills this way, and I haven't been able to find anyone else with a script that does this.
Where do you put this? It isnt working for me (crashes when starting game)
Fixed script format, credit Adiktuzmiko.
Code:
class Game_Actor < Game_Battler
  def skills
    (@skills | added_skills).collect {|id| $data_skills[id] }
  end
end
class Game_Party < Game_Unit
  def items
    @items.keys.collect {|id| $data_items[id] }
  end
  def weapons
    @weapons.keys.collect {|id| $data_weapons[id] }
  end
  def armors
    @armors.keys.collect {|id| $data_armors[id] }
  end
end


Reverse order
Code:
class Game_Actor < Game_Battler
  def skills
    (@skills | added_skills).collect {|id| $data_skills[id] }
  end
end
class Game_Party < Game_Unit
  def items
    @items.keys.collect {|id| $data_items[id] }.reverse!
  end
  def weapons
    @weapons.keys.collect {|id| $data_weapons[id] }
  end
  def armors
    @armors.keys.collect {|id| $data_armors[id] }
  end
end
Thanks.. forgot I had a script like this xD
I have a issue :
Script 'Game_Interpreter' line 450: TypeError occurred.
can't convert String into integer

What can I do for this ? Do I have to change anything ?
(I use Fomar0153's Multiple Inventories)

Original thread: https://forums.rpgmakerweb.com/threads/skill-item-list-based-on-learn-obtain-order.19050/