BattleScript API Reference
Complete reference documentation for all BattleScript functions, methods, and APIs. Use the table of contents below to navigate to specific sections.
USEFUL INFO: BattleScript refers to the programming language used to write scripts for BattleCore devices. BattleCore is the hardware and firmware inside the laser tag devices.
NOTE: The BattleScript Core Language (BCL) and the standard libraries documented here reflect the current compiler. The BattleCore Device API (battlecore::) is provided by the device firmware and continues to evolve, so the exact set of available functions may change between firmware versions.
For updates on development or to follow discussions, please join our Facebook group.
Table of Contents
Core Language (BCL)
The BattleScript language syntax and keywords
Standard Library (std::)
Built-in libraries available globally in every script (no import required)
BattleCore Device API (battlecore::)
Control the BattleCore hardware and game state from your script
Quick Topic Pages
Focused guides to common language features
BattleScript.io HTTP REST API
Programmatically create, read and update files on the BattleScript.io code sharing platform
Getting Started with the API
The BattleScript API is divided into several categories:
- Core Language (BCL) - Fundamental language features like variables, functions, timers, enums, interfaces, protocols, and the state/module/event model. The core language is the same across all BattleScript platforms and encompasses the syntax, semantics, and keywords of the language.
- Standard Library (std::) - Built-in libraries (
std::console,std::debug,std::gpio,std::math) that are available globally in every script. No import is required to use them. - BattleCore Device API (battlecore::) - Functions for controlling hardware and game state on BattleCore devices. These are provided by the BattleCore firmware and are made available to a script by including their declaration files; they are not part of the core language.
- BattleScript.io REST API - HTTP endpoints for interacting with the BattleScript.io code sharing platform.
Each API function is documented with its syntax, parameters, return values, and usage examples. Click on any section in the table of contents to explore the specific APIs.
API Conventions
BattleScript APIs follow these conventions:
- Function names use camelCase (e.g.,
std::console.log()) - Namespaces are separated with
::and members with.(e.g.,battlecore::player.takeDamage()) - Event-driven logic is organised as
state→module→event; the targets are usually enum members or the"_"wildcard - Interfaces are defined using the
interfacekeyword - Statements end with a semicolon (
;); blocks use braces ({ })