ATS
Andor's Trail Scripting Language
AT (Andor's Trail) Scripting Language is a simple, C-like language used to write scripts (.ats files) that define game logic, trigger events, and control interactive elements in Andor's Trail.
Script files are located in the res/raw/ folder of the project, as plain-text .ats files. The file extension used doesn't matter, but it helps for identification. ATS stands for Andor's Trail Script. There is a detailed breakdown by Zukero on the forums.
Overview
AT scripts are stored in res/raw/ as .ats files and are executed by the game engine in response to triggers like:
Map entry/exit
Player actions
NPC interactions
Combat events
Item usage
Scripts define behavior through associations - connections between game objects and script methods.
Basic Script Structure
textassociation MyAssociation {
onCondition() {
// Triggered when condition is met
}
onExecute() {
// Main execution logic
}
onDeactivate() {
// Cleanup when association ends
}
}Script Lifecycle
onLoad - Script file is loaded into memory.
onInstantiate - Association object is created.
onActivate - Condition is met, association becomes active.
onExecute - Main logic runs each game tick.
onDeactivate - Association becomes inactive or is destroyed.
Variables and Types
Variable Declaration
Value Types
numeral: Integer values (-∞ to +∞)
boolean: true or false.
string: Text values enclosed in quotes.
association: Reference to another association.
actor: Reference to an NPC or monster.
Trigger Conditions
Conditions determine when an association activates:
Map Triggers
Player Triggers
NPC Triggers
Item Triggers
Control Flow
If-Else Statements
While Loops
Logical Operators
Method Calls
Player Methods
NPC Methods
Map Methods
Item Methods
Associations
Associations link script logic to game objects and events:
Association Types
State Management
Track state using association variables:
Common Patterns
Quest Trigger
Dialogue Progression
Conditional Reward
Best Practices
Use descriptive names - Name associations and variables clearly
Keep scripts focused - One association should handle one logical unit
Check conditions - Always verify conditions before executing actions
State tracking - Use variables to track quest/dialogue progress
Error handling - Assume items or NPCs might not exist
Comments - Document complex logic
Testing - Test edge cases (missing items, NPCs, etc.)
Integration with Game Files
Scripts are referenced in JSON files:
Limitations
Scripts run synchronously - they cannot create delays or wait
Script execution is limited to prevent infinite loops
Access to game objects is restricted for security
Cannot directly modify save game data
Debugging Tips
Add dialogue messages to track execution
Check console output for script errors
Use map.displayMessage() to show variable values
Test each association independently
Verify JSON references are correct
Resources
Forum Discussion: AT Scripting Language documentation
Example Scripts: Check res/raw/*.ats in game repository
Game Engine: See source code in src/com/.../ for method definitions
Last updated