Scripts read these with (input 'var1 default). Unset vars use the default.

Keys

Ctrl+Enter
Load the file live. main restarts; bullets in flight keep going.
Alt+Enter
Evaluate the form under the cursor, or the selection.
Ctrl+Shift+Enter
Start over with a fresh VM.
Ctrl+Shift+H
Hide or show the code.
Alt+P
Pause or play.
Alt+. and Alt+,
Step one tick forward or back.
F
Fullscreen, when you're not typing.
Ctrl+S, share
Copy a link that opens this script in this scene.
Ctrl+Shift+S
The same link in plain ASCII, for places that mangle Unicode.
download
Save the code as a .bs file.
Drop a .bs file
Open it from your computer.

Forms

defn def fn
(defn ring [n] …), (def n 3), (fn [] …)
let if when cond do and or
The usual. Values never change.
dotimes forever loop recur
(dotimes [i n] …), (loop [a 0] (recur …))
wait wait-until
Pause the script. (wait 0.5) is half a tick.
par race until
Run forms together. race and until cancel the rest.
fire
(fire :dir d :speed s :kind 'k :run f), all optional.
vanish emit
Remove this actor. (emit 'name) tells the host.
change-speed change-dir
(change-speed 0 :over 40) tweens in the background.
turn accel
(turn rate :for n), (accel ax ay :over n)
aim heading speed x y age
Ask about this actor and the target.
last-dir last-speed rand rank
The last shot, (rand a b), difficulty.
+ - * / mod inc dec abs
Arithmetic.
min max floor ceil round trunc
Limits and rounding.
sqrt pow sin cos tan atan2
Degrees, with 0 along +x and counterclockwise.
lerp clamp < > = not= not
Blending and comparison.
input
Inputs: (input 'var1) to (input 'var8), set from the settings menu.

What a script can rely on

Field
W × 448 units, origin bottom-left, y up. W follows the window; stay relative to the emitter.
Angles
Degrees, 0 is +x (right), counterclockwise: 90 is up, 270 is down toward the player.
Speed
Units per tick, at 60 ticks a second.
main
Spawned at the enemy, as its kind. Ctrl+Enter respawns it; bullets in flight carry on.
(aim)
Points at the player ship, which follows the mouse.
rank
The rank slider, 0 to 1.
(input 'var1)
Up to var8, from the settings menu.
Culling
Actors more than 32 units outside the field are removed.
emit
Names you emit show in the console at the bottom.
More
lists every sprite; show each form at work.

Any symbol works as a kind. Unknown ones draw as 'bullet; 'emitter draws nothing. Click to insert.

paused tick 0 actors 0 vm 0.00 ms 60 fps