ts2
ts2 is the language you write Rift interfaces in: shop windows, inventory grids, quest logs, health bars. It is a small, statically typed language with markup built in, and the build turns it into interfaces the game client loads.
import { createRef, sessionState, useInventory, useState } from 'ts2';import { Colors, Fonts, Icons, Inventories, Items } from './refs';
const CoinPurse = (): Component => { const inventory = useInventory(Inventories.INVENTORY); const coins = inventory.total(Items.COINS);
return ( <layer x={0} y="bottom" w="fill" h={24}> <sprite x={2} y="center" w={20} h={20} sprite={Icons.COINS} /> <text x={26} y="center" w={120} h={16} text={`${coins} gp`} font={Fonts.BOLD} valign="middle" shadow color={Colors.AMBER} /> </layer> );};Where to start
Section titled “Where to start”- Quick start builds one shop panel and touches every idea in the language. Start here.
- Essentials teaches the language one feature a page, from markup through events to game state.
- Talking to the game covers how an interface is opened, how the server calls into it, and what the client runs by name.
- Writing it well is a short list of habits.
Looking something up
Section titled “Looking something up”Reference has a page per element and per hook, and the complete lists of props, types, collections and error codes. Rules of ts2 lists what the compiler refuses. Extra topics explain how updates reach the screen.