Files and branding¶
Client files¶
The server's client files are on the player's computer before scripts run.
sagl.files.read(path) |
A file's contents as text, or null. |
sagl.files.url(path) |
Where RML finds it (for src, href), or null. |
sagl.ui.openFile(path, options?) |
Opens an RML file as a document; its relative links resolve beside it. |
sagl.map.setOverlay(id, { file, ... }) |
An overlay image from a file. |
const config = JSON.parse(sagl.files.read("data/shops.json"));
page.setHtml("logo", `<img src="${sagl.files.url("ui/ammu.png")}"/>`);
In RML from a client file, link files beside it relatively, and SAGL's theme absolutely:
<link type="text/rcss" href="/sagl/ui/theme/base.rcss"/>
<link type="text/rcss" href="shop.rcss"/>
<img src="icons/pistol.png"/>
RmlUi only reads SAGL's sagl/ui/ and the current server's files.
Branding¶
sagl.branding is the server's branding:
sagl.branding;
// { name: "Example Roleplay", primary: "#2fb3a0", secondary: "#0e3a36",
// logo: "/sagl/servers/127.0.0.1_7777/files/branding/logo.png" }
Use it to match your documents to the server's colours: