Skip to content

Supported Languages

Skeptim edited this page Aug 4, 2024 · 20 revisions

TIC-80 Supports multiple scripting languages, including:

TIC-80 also supports compiled languages via our WASM support. If your compiled language of choice can compile to Web Assembly there is a good chance you could use it to develop for TIC-80.

You need to specify the language you use by adding one the following to the metadata:

Language Tag
For Fennel ;; script: fennel
For Javascript // script: js
For Lua -- script: lua
For Moonscript -- script: moon
For Ruby # script: ruby
For Squirrel // script: squirrel
For Wren // script: wren
For Janet # script: janet
For Scheme ;; script: scheme
For Python # script: python

Note: If no script tag is added it will be considered as a Lua cart.

Starting New Compiled from Source Project

Starting New Scripting Project

To see a demo or start a new project in your scripting language of choice just start up TIC-80 and from the console type new [lang], for example for a Wren project just type:

new wren

Type help new to print arguments for each language.

for some on-screen guidance.

Python Integration

Python integration is based on pocketpy, the list of available modules can be found in the documentation.

You can use this stub file or this more detailed one for vscode's intellisense.

def btn(id: int) -> bool: ...
def btnp(id: int, hold=-1, period=-1) -> bool: ...
def circ(x: int, y: int, radius: int, color: int): ...
def circb(x: int, y: int, radius: int, color: int): ...
def clip(x: int, y: int, width: int, height: int): ...
def cls(color=0): ...
def elli(x: int, y: int, a: int, b: int, color: int): ...
def ellib(x: int, y: int, a: int, b: int, color: int): ...
def exit(): ...
def fget(sprite_id: int, flag: int) -> bool: ...
def fset(sprite_id: int, flag: int, b: bool): ...
def font(text: str, x: int, y: int, chromakey: int, char_width=8, char_height=8, fixed=False, scale=1, alt=False) -> int: ...
def key(code=-1) -> bool: ...
def keyp(code=-1, hold=-1, period=-17) -> int: ...
def line(x0: int, y0: int, x1: int, y1: int, color: int): ...
def map(x=0, y=0, w=30, h=17, sx=0, sy=0, colorkey=-1, scale=1, remap=None): ...
def memcpy(dest: int, source: int, size: int): ...
def memset(dest: int, value: int, size: int): ...
def mget(x: int, y: int) -> int: ...
def mset(x: int, y: int, tile_id: int): ...
def mouse() -> tuple[int, int, bool, bool, bool, int, int]: ...
def music(track=-1, frame=-1, row=-1, loop=True, sustain=False, tempo=-1, speed=-1): ...
def peek(addr: int, bits=8) -> int: ...
def peek1(addr: int) -> int: ...
def peek2(addr: int) -> int: ...
def peek4(addr: int) -> int: ...
def pix(x: int, y: int, color: int=None) -> int | None: ...
def pmem(index: int, value: int=None) -> int: ...
def poke(addr: int, value: int, bits=8): ...
def poke1(addr: int, value: int): ...
def poke2(addr: int, value: int): ...
def poke4(addr: int, value: int): ...
def print(text, x=0, y=0, color=15, fixed=False, scale=1, alt=False): ...
def rect(x: int, y: int, w: int, h: int, color: int): ...
def rectb(x: int, y: int, w: int, h: int, color: int): ...
def reset(): ...
def sfx(id: int, note=-1, duration=-1, channel=0, volume=15, speed=0): ...
def spr(id: int, x: int, y: int, colorkey=-1, scale=1, flip=0, rotate=0, w=1, h=1): ...
def sync(mask=0, bank=0, tocart=False): ...
def ttri(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, u1: float, v1: float, u2: float, v2: float, u3: float, v3: float, texsrc=0, chromakey=-1, z1=0.0, z2=0.0, z3=0.0): ...
def time() -> int: ...
def trace(message, color=15): ...
def tri(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, color: int): ...
def trib(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, color: int): ...
def tstamp() -> int: ...
def vbank(bank: int=None) -> int: ...

Structured Edition

Structured edition is an edition mode, available only for lisp-like languages like Scheme, Janet and Fennel and with the Emacs mode enabled. It helps the user to keep the program well written by automatically balancing the parenthesis and editing code at an S-Expression level. It will be harder to delete parenthesis until the expression is emptied first, to help keep the balance. Here are some key bindings available in structured edition languages:

Key Binding Functionality
ctl-down or alt-S S-Expify (add parenthesis around word or s-expression)
ctl-up Extirp from S-Expression (remove word or s-expression from enclosing s-expression)

Fennel strict Tag

See metadata page.
TODO

Using Typescript

Scrambier developped a tool to use typescript in TIC-80 that you can find on the external tools page.

Clone this wiki locally