SortData VX + ACE - kyonides -  10-28-2024
 
 
SortData VX + ACE 
 
by Kyonides 
 
Introduction 
 
Do you need to get a list of item or skill names? 
Do you want to get them sorted out to see if you're missing anything important there? 
Then this temporary scriptlet is right for you!    
 
If you find out that there's a new option in the title menu's command window, then that's what you need to pick there! 
 
Then you'll be able to find lots of options that will let you save 2 separate TXT files in your game's root directory. 
 
Open them and you'll be able to get the list of names of any DB present in the VX ACE DB window and a sorted list of such items or skills or common events. 
 
FAQ 
 
What you need to do is to paste it on a new script section in the Materials group. 
 
If you have any backtrace script in place, make sure this scriptlet is placed ABOVE that backtrace script. 
 
Script for RMVX 
 
Code: # * SortData VX * # 
#   Scripter : Kyonides Arkanthes 
#   2023-12-21 
 
class CommandWindow < Window_Selectable 
  NAMES = %w{actors classes skills items weapons armors enemies troops} 
  NAMES += %w{states animations common\ events} 
  def initialize(wx, wy) 
    @commands = NAMES.map {|name| name.capitalize } 
    super(wx, wy, 208, @commands.size * WLH + 32) 
    @item_max = @commands.size 
    refresh 
    self.index = 0 
  end 
 
  def refresh 
    create_contents 
    @item_max.times {|n| draw_item(n) } 
  end 
 
  def draw_item(index) 
    contents.draw_text(item_rect(index), @commands[index]) 
  end 
 
  def fetch_list 
    case @index 
    when 0 
      $data_actors 
    when 1 
      $data_classes 
    when 2 
      $data_skills 
    when 3 
      $data_items 
    when 4 
      $data_weapons 
    when 5 
      $data_armors 
    when 6 
      $data_enemies 
    when 7 
      $data_troops 
    when 8 
      $data_states 
    when 9 
      $data_animations 
    when 10 
      $data_common_events 
    end 
  end 
 
  def filename 
    NAMES[@index] 
  end 
end 
 
class Scene_Title 
  alias :kyon_sort_data_scn_ttl_up :update 
  def create_command_window 
    options = [Vocab.new_game, Vocab.continue, Vocab.shutdown] 
    options << "Extract Names" 
    @command_window = Window_Command.new(172, options) 
    @command_window.x = (544 - @command_window.width) / 2 
    @command_window.y = 258 
    if @continue_enabled 
      @command_window.index = 1 
    else 
      @command_window.draw_item(1, false) 
    end 
    @command_window.openness = 0 
    @command_window.open 
  end 
 
  def update 
    kyon_sort_data_scn_ttl_up 
    if Input.trigger?(Input::C) and @command_window.index == 3 
      Sound.play_decision 
      $scene = SortDataScene.new 
    end 
  end 
end 
 
class SortDataScene < Scene_Base 
  HEADING_START = "Choose the type of data to be sorted next" 
  HEADING_PROCESS = "Processing data..." 
  def start 
    @stage = :main 
    @timer = 0 
    @sprite = Sprite.new 
    @sprite.bitmap = Cache.system("Title") 
    @help_window = Window_Help.new 
    @help_window.set_text(HEADING_START) 
    cwx = (Graphics.width - 200) / 2 
    @command_window = CommandWindow.new(cwx, 80) 
  end 
 
  def update 
    case @stage 
    when :main 
      update_selection 
    when :timer 
      update_timer 
    end 
  end 
 
  def update_selection 
    @command_window.update 
    if Input.trigger?(Input::B) 
      Sound.play_cancel 
      $scene = Scene_Title.new 
      return 
    elsif Input.trigger?(Input::C) 
      Sound.play_decision 
      @help_window.set_text(HEADING_PROCESS) 
      @timer = 20 
      @stage = :timer 
      list = @command_window.fetch_list 
      list = list[1..-1].map{|o| o.name } 
      sorted_list = list.sort 
      name = @command_window.filename 
      File.open("normal list #{name}.txt", "w") {|f| f.puts list } 
      File.open("sorted list #{name}.txt", "w") {|f| f.puts sorted_list } 
    end 
  end 
 
  def update_timer 
    Graphics.update 
    @timer -= 1 
    return if @timer > 0 
    @help_window.set_text(HEADING_START) 
    @stage = :main 
  end 
 
  def terminate 
    @command_window.dispose 
    @help_window.dispose 
    @sprite.bitmap.dispose 
    @sprite.dispose 
  end 
end
  
Script for RMVX ACE 
 
Code: # * SortData ACE * # 
#   Scripter : Kyonides Arkanthes 
#   2023-06-14 
 
class Window_TitleCommand 
  alias :kyon_sort_data_win_ttl_comm_mk_comm_list :make_command_list 
  def make_command_list 
    kyon_sort_data_win_ttl_comm_mk_comm_list 
    add_command("Extract Names", :sort) 
  end 
end 
 
class CommandWindow < Window_Selectable 
  NAMES = %w{actors classes skills items weapons armors enemies troops} 
  NAMES += %w{states animations common\ events} 
  def initialize(wx, wy) 
    clear_command_list 
    make_command_list 
    super(wx, wy, 208, window_height) 
    refresh 
    select(0) 
    activate 
  end 
 
  def clear_command_list 
    @list = [] 
  end 
 
  def make_command_list 
    @list = NAMES.dup 
    @list.map!{|name| name.capitalize } 
  end 
 
  def visible_line_number 
    10 
  end 
 
  def window_height 
    fitting_height(item_max) 
  end 
 
  def item_max 
    @list.size 
  end 
 
  def draw_item(index) 
    draw_text(item_rect_for_text(index), @list[index]) 
  end 
 
  def process_handling() end 
 
  def fetch_list 
    case @index 
    when 0 
      $data_actors 
    when 1 
      $data_classes 
    when 2 
      $data_skills 
    when 3 
      $data_items 
    when 4 
      $data_weapons 
    when 5 
      $data_armors 
    when 6 
      $data_enemies 
    when 7 
      $data_troops 
    when 8 
      $data_states 
    when 9 
      $data_animations 
    when 10 
      $data_common_events 
    end 
  end 
 
  def filename 
    NAMES[@index] 
  end 
end 
 
class Scene_Title 
  alias :kyon_sort_data_scn_ttl_ccw :create_command_window 
  def create_command_window 
    kyon_sort_data_scn_ttl_ccw 
    @command_window.set_handler(:sort, method(:command_sort)) 
  end 
 
  def command_sort 
    close_command_window 
    fadeout_all 
    SceneManager.call(SortDataScene) 
  end 
end 
 
class SortDataScene < Scene_Base 
  HEADING_START = "Choose the type of data to be sorted next" 
  HEADING_PROCESS = "Processing data..." 
  def start 
    @stage = :main 
    @timer = 0 
    @help_window = Window_Help.new(1) 
    @help_window.set_text(HEADING_START) 
    cwx = (Graphics.width - 200) / 2 
    @command_window = CommandWindow.new(cwx, 80) 
  end 
 
  def update_basic 
    case @stage 
    when :main 
      super 
      update_selection 
    when :timer 
      update_timer 
    end 
  end 
 
  def update_selection 
    if Input.trigger?(:B) 
      Sound.play_cancel 
      SceneManager.return 
      return 
    elsif Input.trigger?(:C) 
      Sound.play_ok 
      @help_window.set_text(HEADING_PROCESS) 
      @timer = 20 
      @stage = :timer 
      list = @command_window.fetch_list 
      list = list[1..-1].map{|o| o.name } 
      sorted_list = list.sort 
      name = @command_window.filename 
      File.open("normal list #{name}.txt", "w") {|f| f.puts list } 
      File.open("sorted list #{name}.txt", "w") {|f| f.puts sorted_list } 
    end 
  end 
 
  def update_timer 
    Graphics.update 
    @timer -= 1 
    return if @timer > 0 
    @help_window.set_text(HEADING_START) 
    @stage = :main 
  end 
 
  def terminate 
    Graphics.freeze 
    dispose_all_windows 
  end 
end
  
 
Terms & Conditions 
 
Free for use in ANY game project. 
This script is not intended to be distributed as an integral part of your game. 
Remove it once you no longer need it. 
Due credit is optional for the script can be removed at any time. 
That's it!  
 
 
 
RE: SortData VX + ACE - kyonides -  10-28-2024
 
 
A New Script Update Has Arrived! 
 
From now on you can download a working demo featuring the same basic functionality plus 2 brand new features. 
 
Now you can read the list of items or weapons or skills or anything else on screen. 
Besides you can now sort the list by ID or Name or Cost (Price). 
 
 
 
 
 |