Sort items/skills script?

So here's the mistake.
1690036345396.png

1. the backtrace needs to be at the bottom.
2. the main needs to be commented out or removed.
So here's the mistake.
View attachment 270290
1. the backtrace needs to be at the bottom.
2. the main needs to be commented out or removed.
Why does main need to be commented out or removed? That is a default script.
Why does main need to be commented out or removed? That is a default script.
Because Backtrace changes how the main call works.
@Trihan Your script crashes my game every time a new item is added to my inventory

Here is a backtrace.

Can you please fix? thanks.
Here is a backtrace.

Can you please fix? thanks.
Based on that I would change the script to this.
Ruby:
class Window_ItemList < Window_Selectable
  def make_item_list
    @data = $game_party.all_items.select {|item| include?(item) }
    @data.sort! { |a, b| a.name <=> b.name }
    @data.push(nil) if include?(nil)
  end
end

class Window_SkillList < Window_Selectable
  def make_item_list
    @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
    @data.sort! { |a, b| a.name <=> b.name }
    @data.push(nil) if include?(nil)
  end
end
That seemed to fix it, at least for the sword dropped from the boss

Thank you.

Why was that change necessary?
Why was that change necessary?
Nil was added to the data before it was sorted.
And as you saw with the error, can't find name for nil.
Nil was added to the data before it was sorted.
And as you saw with the error, can't find name for nil.
Ah, cheers for fixing that bud. I never thought about the nil element.

Original thread: https://forums.rpgmakerweb.com/threads/sort-items-skills-script.159373/