Discord

Preparing your files

Please wait until the download is ready.

Luka's Scripting Utilities

Luka's Scripting Utilities

by Luka S.J.

A pack full of various scripting utilities to ease your development!

v4.1.135,194
Download144 KB

PBS Compiler

LUTS::Compiler is a schema-driven compiler that turns PBS text files into
serialized .dat game data at load time — the same pattern Essentials uses for
its own data, but reusable for a plugin's custom PBS. It only runs in debug
mode (when there is no packaged Game.rgssad archive), and it recompiles
incrementally.

LUTS::Compiler.compile(
  path:     "PBS/my_data",
  schema:   MyData,
  file_ext: "myextension"
)

API

  • LUTS::Compiler.compile(path:, schema:, file_ext:, force: false) compile every PBS .txt file in path against schema into serialized data files. force: true forces a full recompile.
  • LUTS::Compiler.compile_files(path) the unique base filenames in a PBS directory (collapsing name.txt and name_packN.txt into a single entry)
  • LUTS::Compiler.compile_data(path, schema:, const:) compile a single PBS file against a schema constant and return the parsed hash

When it recompiles

Compilation is skipped entirely unless $DEBUG is on and the path exists, and
no game archive is present. Within that, it recompiles when:

  • the compiled data file does not yet exist, or
  • you hold Input::CTRL during load (or pass force: true), or
  • any PBS source file is newer than the compiled data file.

PBS format it understands

  • Section headers: [TYPE], [TYPE, NAME], or [TYPE, NAME, VERSION] (CSV-parsed)
  • Properties: KEY = value, type-cast through the schema
  • Subsections: an all-caps SUBSECTION_NAME block terminated by END
  • Coordinate shorthand: a property ending in XY / XYZ expands into separate _x, _y, _z entries
  • "Pack" files (name_packN.txt) merge into their base file

The schema is a module/class carrying a LABEL constant (for log output) and a
nested ClassMethods::SCHEMA describing each property as [type, …] (or
:any for free parsing). POKEMON and TRAINERS ids are auto-filled when
omitted. Progress and failures are reported through LUTS::Logger.