Game System
This section covers general game logic, utilities, events, and timers.
Core Utilities
Booktasy.init()
User-Defined. You must define this function in your .lua file. It acts as the entry point/setup function called when the game starts or restarts.
Booktasy.rnd(min, max)
Returns a random integer between min and max. If only min is provided, returns between 1 and min.
Booktasy.save(var_name)
Marks a global variable name to be included in the save file.
Usage: Booktasy.save("PLAYER_HEALTH")
Booktasy.end_game(message)
Sets the game state to Game Over and prints the message wrapped in a System tag #[S].
Event & Timer System
Booktasy.add_event(event)
Adds an event object to the active checking loop.
Booktasy.check_events()
Iterates through all active events. If an event's condition() returns true, its action() is executed. One-shot events are removed automatically.
Booktasy.add_timer(name, duration, action, is_looping)
Creates a countdown timer.
Parameters:
duration(int) — Number of turns before the action fires.action(function) — The code to run when time is up.is_looping(boolean) — Iftrue, the timer resets todurationafter firing.
Booktasy.remove_timer(name)
Manually removes a timer by name.
Booktasy.update_timers()
Decrements all active timers by 1. Called automatically by ProcessCommand.