Docs Log in Sign up

Docs For developers scrawlee.yml

scrawlee.yml

Every value and room your Scrawl uses, with its type and rules. Scrawlee refuses to publish a file with problems and lists each one with its line.

The file

Name it scrawlee.yml and put it at the root of the published files. An update without it keeps the one already online. Everything goes under one cloud: key. The first line below gives editors such as VS Code autocompletion and checks as you type.

# yaml-language-server: $schema=https://www.scrawlee.com/schema/scrawlee.yml.json
cloud:
  sign_in: optional
  name: ask
  types: {}   # your own types
  data: {}    # values
  rooms: {}   # kinds of room

sign_in and name

sign_in: optionalThe default. Anyone can use the Scrawl; saving asks people to sign in and choose.
sign_in: requiredThe Scrawl loads only for people signed in who answered the consent panel. Only if it cannot work without it.
sign_in: noneRead only: the Scrawl shows values but nobody writes.
name: askThe default. People choose their username, a random name or no name.
name: noneNobody is asked for a name: everyone appears as Anonymous.

Scopes

scope: sharedOne value for everyone. Add who: creator so only you write it.
scope: ownOne value per person, only they read it.
scope: publicOne value per person, everyone can read it under the name they chose.

Types

Names of values, fields, rooms and types have 1 to 32 lowercase letters, digits or underscores and start with a letter. A single value (int, number, bool, string, enum) can have a default.

int, numberOptional min and max.
booltrue or false.
stringmax_length (required) and an optional pattern.
enumvalues: [a, b, c], one of them.
objectfields, each with its own type.
listitems (their type) and max_items.
mapkey (a string or an enum), value and max_entries. Read and written by key.
your ownDeclare it under types: and use its name as type.

Write rules

write: setThe default: any valid value.
write: addChanges only with add (numbers), safe when many people add at once.
write: increase, decreaseA number that only goes up, or only down.
write: onceSet once, then it cannot change.
step_maxWith add, increase or decrease: the largest change in one write.
rateWrites per person, such as 10/min (/s, /min, /hour, /day).
rank: asc, descOn a public number: a ranking is available.

Rooms

Each kind of room has max_members (2 to 64), an optional state (entries with a type and its rules, shared by the members) and messages (each with a type and a rate per person, 10 a second by default). A message is 1 KB at most.

rooms:
  match:
    max_members: 4
    state:
      turn: { type: int, min: 0, default: 0 }
    messages:
      move: { type: object, rate: 20/s, fields: { x: { type: int }, y: { type: int } } }
      cheer: { type: enum, values: [nice, wow, again] }

Patterns

A pattern must match the whole text. Write the characters you allow, such as [A-Za-z0-9 ]+, instead of \w or \s, which Scrawlee refuses. You are responsible for what a pattern lets through: a name limited to letters and digits cannot carry a message.

How large can values be?

Scrawlee works out the largest size each declaration allows and refuses the file when it passes a limit: 64 KB for one value or one map entry, 256 KB for all the own values of one person together, 16 KB for a room's state and 1 KB for a message. Lower max_length, max_items or max_entries to fit. What a whole Scrawl may store is on the Limits page.

Changing the file in an update

Adding values and rooms is always safe. Values already stored are not converted: rather than changing the type of a value people already use, declare a new one.