-
Notifications
You must be signed in to change notification settings - Fork 2
Commands
Drew Wibbenmeyer edited this page Nov 30, 2017
·
6 revisions
The following is a list of all supported commands in DRAK-0 scripts:
- ChaiScript Standard Library
- Most of Lua/LuaJIT Standard Library
- btn(id) => Returns true if the indicated button is currently pressed
- circ(x0, y0, rad, col) => Draws a filled circle
- circb(x0, y0, rad, col) => Draws a circle border
- cls(col) => Clears the screen with the indicated color
- exit() => Exits the game
- line(x0, y0, x1, y1, col) => Draws a line
- mbtn(id) => Returns true if the indicated mouse button is currently pressed
- memcpy(dest, src, len) => Copies console ram from src to dest
- memset(dest, val, len) => Sets values in console ram at dest to val
- mpos(axis) => Returns mouse's position along the indicated axis
- peek(addr) => Returns byte value at addr in console ram
- pix(x, y, color) => If color != -1: Sets the color of the indicated pixel to color; else: returns the color of the indicated pixel
- poke(addr, val) => Sets byte value at addr in console ram to val
-
random() or random(n) or random(m, n) => Operates exactly like Lua's
math.random
except uses the power of C++11's std::random capability (AKA a Mersenne Twister PRNG) - rect(x, y, w, h, col) => Draws a filled rectangle
- rectb(x, y, w, h, col) => Draws a rectangle border
- rgb(r, g, b, mode) => If mode == 0: r, g, and b are values from 0-3; else if mode == 1: r, g, and b are values from 0-255. Returns closest palette entry. NOTE: Only behaves like expected when using builtin palette
- sidx(p, x, y) => Returns the sprite index of the sprite on page p at cell (x,y)
- spr(idx, x, y, ck) => Draws a sprite to the screen
- time() => Returns the number of milliseconds that have passed since the console started up
- trace(msg) => Outputs text to the console/terminal