Skip to content

CreateWebSurface

Places a web surface - a page of the web interface drawn on a board in the world.

name is a surface page of the interface’s ui.toml ([surfaces.<name>]). x, y, z are the board’s middle; yaw is the way its face looks, in degrees like a prop’s (0 faces +Y) - a board in front of a player who looks at yaw a faces them at a + 180. width and height are its size in metres (0.1 to 20 each); the page is drawn on the whole board, so give it the page’s shape (a page of 768 x 512 pixels on a board of 1.5 x 1 m) or the page is stretched.

options (all optional):

  • pitch - degrees about its side-to-side line: positive leans its top away from the one who reads it (a lectern’s page)
  • roll - degrees about the line through its face (a crooked sign)
  • glow - 0 to 1: how much it shines by itself (1 = as bright as the page is drawn, day or night: a screen); 0 = lit by the world alone
  • transparent - true (or "blend") lets the world show through the page’s see-through parts: letters painted on a wall, a sign of its own shape. The page decides what is see-through (background: transparent in its CSS, an image’s clear parts, a colour with alpha). "cutout" is hard-edged instead - a pixel shows when it is at least half opaque, else not at all - and casts a shadow of its own outline. Left out, the board is solid: the page on white. A soft board is lit by the sun and the lamps but not by the light bounced into shade, so on a wall in deep shade its paint reads darker than the wall around it: give it a little glow, or make it "cutout"
  • prompt - the use hint shown when a player looks at it from close by (“Read the notices”); the use key then calls OnPlayerUseWebSurface
  • world - the virtual world it stands in

The answer is the surface’s entity id, or nil: the interface declares no such surface page, the size is out of bounds, there are 256 surfaces already or the world is full. A server without a web interface has no surfaces.

CreateWebSurface(name, x, y, z, yaw, width, height [, options])
Parameter Type
name string the surface page’s name in ui.toml
x number the board’s middle, metres
y number
z number
yaw number the way its face looks, degrees
width number metres, 0.1-20
height number metres, 0.1-20
options {pitch?: number, roll?: number, glow?: number, transparent?: boolean|string, prompt?: string, world?: number} the tilt, the glow, see-through or not, the use prompt, the world (optional)

the surface’s entity id, or nil

RegisterCommand("board", function(pid)
local x, y, z = GetPlayerPos(pid)
local yaw = GetPlayerYaw(pid)
local a = math.rad(yaw)
-- 2.5 m ahead, its middle 1.5 m up, facing the player
CreateWebSurface("board", x - math.sin(a) * 2.5, y + math.cos(a) * 2.5, z + 1.5, yaw + 180, 1.5, 1.0,
{ prompt = "Read the notices" })
end)

SetWebSurfacePos · SetWebSurfaceSize · SetWebSurfaceGlow · SetWebSurfaceTransparent · DestroyEntity · OnPlayerWebSurfaceReady · the Web surfaces group of the index