SortData XP
#1
SortData XP

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.

The Script

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


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 }


Messages In This Thread
SortData XP - by kyonides - 12-21-2023, 08:36 PM
RE: SortData - by kyonides - 12-22-2023, 05:03 AM
RE: SortData - by kyonides - 12-30-2023, 04:02 AM



Users browsing this thread: 1 Guest(s)