Getting started with scripts
What a map script is, where to write it, how it stays safe.
A map script makes your map react to the game. Open a gate every 20 seconds, score a point for holding a hill, flash a banner when someone caps.
Where to write one
- Open your map in the editor and pick the Scripts tab.
- Write, or pick one from Add an example. Errors show by line as you type.
- Point at a tile: the tab shows its x and y, for gate(x, y) and friends.
- Play here to test it. Errors and log() lines show in the game chat.
- Save. The script goes with the map: drafts, versions and published maps all keep it.
Your first script
# A banner when the game starts
on start {
say("Good luck")
}
# A gate that opens for 5 s every 20 s
every 20 {
open(gate(14, 9))
after 5 {
reset(gate(14, 9))
}
}
Lines starting with # are notes. on start runs once; every 20 runs every 20 seconds; after 5 waits, then runs once.
How it stays safe
Next