Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 SortData
#1
SortData
XP + 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! Grinning

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 RMXP

Code:
# * SortData XP * #
#   Scripter : Kyonides Arkanthes
#   2023-12-21

module Vocab
  NEW_GAME = "New Game"
  CONTINUE = "Continue"
  SHUTDOWN = "Shutdown"
  EXTRACT_NAMES = "Extract Names"
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)
    @commands = NAMES.map {|name| name.capitalize }
    super(wx, wy, 208, @commands.size * 32 + 32)
    @item_max = @commands.size
    @width = self.width - 32
    self.contents = Bitmap.new(@width, @commands.size * 32)
    @item_max.times {|n| draw_item(n) }
    self.index = 0
  end

  def draw_item(n)
    contents.draw_text(4, n * 32, @width, 32, @commands[n])
  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 main
    if $BTEST
      battle_test
      return
    end
    load_database
    $game_system = Game_System.new
    make_backdrop
    make_command_window
    setup_audio
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    terminate
  end

  def load_database
    $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")
  end

  def make_backdrop
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
  end

  def make_command_window
    options = [Vocab::NEW_GAME, Vocab::CONTINUE]
    options += [Vocab::SHUTDOWN, Vocab::EXTRACT_NAMES]
    @command_window = Window_Command.new(172, options)
    @command_window.x = (640 - @command_window.width) / 2
    @command_window.y = 258
    @continue_enabled = Dir["Save*.rxdata"]
    @command_window.index = 1
    if @continue_enabled
      @command_window.index = 1
    else
      @command_window.disable_item(1)
    end
  end

  def setup_audio
    $game_system.bgm_play($data_system.title_bgm)
    Audio.me_stop
    Audio.bgs_stop
  end

  def update
    kyon_sort_data_scn_ttl_up
    if Input.trigger?(Input::C) and @command_window.index == 3
      $game_system.se_play($data_system.decision_se)
      $scene = SortDataScene.new
    end
  end

  def terminate
    @command_window.dispose
    @sprite.bitmap.dispose
    @sprite.dispose
  end
end

class SortDataScene
  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 = RPG::Cache.title($data_system.title_name)
    @help_window = Window_Help.new
    @help_window.set_text(HEADING_START)
    @command_window = CommandWindow.new((640 - 200) / 2, 80)
  end

  def main
    start
    Graphics.transition
    while @stage
      Graphics.update
      Input.update
      update
    end
    Graphics.freeze
    terminate
  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)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Title.new
      return @stage = nil
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @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

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! Tongue sticking out
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#2
Script Ported to RMXP and RMVX!

Even if the original version for RMVX ACE was crafted keeping a certain flying bird's needs in mind, I've decided that I had to port it to the other 2 RGSS-based engines as well. Laughing

You know me very well. I just had some spare time to burn online so I simply preferred to invest it in these 2 ports just because. Tongue sticking out
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#3
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).

Several Snapshots


Attached Files
.jpg   sortdata_ace01.jpg (Size: 88.53 KB / Downloads: 5)
.jpg   sortdata_ace02.jpg (Size: 113.84 KB / Downloads: 5)
.jpg   sortdata_vx01.jpg (Size: 66.46 KB / Downloads: 5)
.jpg   sortdata_vx02.jpg (Size: 82.45 KB / Downloads: 5)
.jpg   sortdata_xp01.jpg (Size: 78.3 KB / Downloads: 5)
.jpg   sortdata_xp02.jpg (Size: 89.3 KB / Downloads: 5)
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }




Users browsing this thread: