q0idmation // draw, rig, animate, export .q0s log inregister

built-in libraries

home · syntax · host api

import name takes exactly one known library name, without quotes. The import is recorded in the runtime. It loads no file, creates no namespace and grants no access to the system. The math functions work without an import. A few imports change how q0player runs the script: import q0.input switches on a game clock that ticks while the timeline is paused, and q0.object, q0.input or q0.mouse in an object script make its frame code run every tick.

all libraries

librarysymbols
q0.coredo!, listen, xlisten, pb, pr, func, if, else, while, for, in, range, break, continue, return, true, false, null, and, or, not
q0.mathpi, tau, sin, cos, tan, sqrt, abs, min, max, clamp, lerp, floor, ceil, round
q0.timelinegorun!, gostop!, frame, label
q0.objectself.x, self.y, self.frame, self.playing, self.name, self.id, self.width, self.height, self.left, self.right, self.top, self.bottom, self.hovered, self.mouse_x, self.mouse_y
q0.mousemouse.down, mouse.up, mouse.move, mouse.click, mouse.double, mouse.wheel, mouse.over, mouse.out
q0.inputinput.left, input.right, input.jump, input.jump_pressed
q0.scenestage.width, stage.height, player.x, player.y, player.left, player.right, player.top, player.bottom, player.width, player.height, q0scene.switch!
q0.timetime.dt
q0.rigq0rig.position!, q0rig.value!, q0rig.reset!, q0rig.pose!, q0rig.pose_reset!
q0.physicsq0physics.start!, q0physics.pause!, q0physics.reset!, q0physics.push!, q0physics.velocity!, q0physics.spin!, q0physics.teleport!, q0physics.gravity!, q0physics.cut!
q0.particlesq0particles.start!, q0particles.stop!, q0particles.burst!, q0particles.move!, q0particles.clear!
q0.lightq0light.on!, q0light.off!, q0light.move!, q0light.color!, q0light.brightness!, q0light.size!, q0light.darkness!
q0shellq0shell.print!, q0shell.read!, q0shell.write!, q0shell.append!, q0shell.mkdir!, q0shell.list!, q0shell.move!, q0shell.delete!

This is the list of libraries the parser recognises, not a promise that every host implements every symbol. frame holds the current frame only inside object scripts; label has no value yet. player stands for an instance name you give in the project. The availability table explains which program supports what.

q0.math

Every function takes exactly the listed number of number arguments and returns a number. Numeric strings and booleans are not converted. A wrong argument count or type gives a diagnostic. Arguments are evaluated left to right.

written asdoes
piπ, about 3.141592653589793
tau2π, about 6.283185307179586
sin(x)sine; x in radians
cos(x)cosine; x in radians
tan(x)tangent; x in radians
sqrt(x)square root; negative x gives nan
abs(x)absolute value
floor(x)rounds down, floor(-1.2) = -2
ceil(x)rounds up, ceil(-1.2) = -1
round(x)nearest whole number; halves round away from zero
min(a, b)the smaller of two numbers
max(a, b)the larger of two numbers
clamp(x, lo, hi)keeps x within the range; lo ≤ hi, neither bound nan
lerp(a, b, t)a + (b - a) * t; t is not clamped

pi and tau resolve as constants unless a shared variable has the same name; an assignment can shadow them. The built-in function names cannot be shadowed by your own functions.

import q0.math
angle = 90 * pi / 180
wave = sin(angle)
position = lerp(10, 90, 0.25)
limited = clamp(position, 0, 20)

wave is about 1, position is 30 and limited is 20. There is no random number generator, no str() / number() conversion and no string function yet. Strings join with +.

commands

Commands are statements; they never return a value into an expression. Put a space after the name ending in ! and separate arguments with commas. Do not write q0rig.pose!(...) and do not assign a command's result.

commandargumentshost
gorun! targetframe index or target stringeditor preview, player
gostop! targetframe index or target stringeditor preview, player
q0scene.switch! aliasthe alias of a bundled scene, as a stringplayer
q0rig.position! control, x, yname, two numbersplayer
q0rig.value! control, valuename, numberplayer
q0rig.reset! controlnameplayer
q0rig.pose! pose, weightname, finite number; clamped to 0…1player
q0rig.pose_reset! posenameplayer
q0physics.start!, q0physics.pause!, q0physics.reset!noneplayer
q0physics.push! body, x, yinstance name, two numbers in px/splayer
q0physics.velocity! body, x, yinstance name, two numbers in px/splayer
q0physics.spin! body, degreesinstance name, degrees per second, clockwiseplayer
q0physics.teleport! body, x, yinstance name, a stage pointplayer
q0physics.gravity! x, ytwo numbers in px/s²player
q0physics.cut! linklink nameplayer
q0particles.start! emitter, q0particles.stop! emitter, q0particles.clear! emitteremitter nameplayer
q0particles.burst! emitter, countemitter name, number of particlesplayer
q0particles.move! emitter, x, yemitter name, a stage pointplayer
q0light.on! light, q0light.off! lightlight nameplayer
q0light.move! light, x, ylight name, a stage pointplayer
q0light.color! light, red, green, bluelight name, three numbers 0…255player
q0light.brightness! light, valuelight name, number; 1 shows colours as drawnplayer
q0light.size! light, radiuslight name, pixelsplayer
q0light.darkness! valuenumber, 0 (day) to 1 (pitch dark)player
q0shell.print! value, ...zero to 255 valuesshell
q0shell.read! pathpathshell
q0shell.write! path, textpath, value to writeshell
q0shell.append! path, textpath, value to appendshell
q0shell.mkdir! pathpathshell
q0shell.list! or q0shell.list! pathno path or one pathshell
q0shell.move! from, totwo pathsshell
q0shell.delete! pathpathshell

The detailed behaviour of frames, names, rigs, physics, particles and lights is in the host api; file operations, value conversion and path rules are in q0shell. Keywords are covered in syntax, events in events.

Sources: q0s-format/src/q0lang/parser.rs, q0vm/src/lib.rs, q0s-format/src/q0lang/runtime.rs.

Desktop window appearance

Import q0.window. q0window.decorations! false hides the system frame; q0window.decorations! true restores it (q0window.titlebar! is an alias). q0window.icon! "app_icon" uses a bundled library bitmap, addressed by name or numeric asset id. q0window.icon! null restores the player icon. These desktop commands do not change the executable file or the browser player.