Skip to main content

Host types

A script's host type (extends) is not a behaviour but a category: it says what the script can be attached to, what it can use and, on the client, its entry point. The language knows none of them; Caria gives them in its catalog.

Host typeSideGoes onFor
Worldserverthe world (.world)decisions for the whole town: power, weather
Buildingservera building (.building)a building's fields and the events it receives
Characterservera character (.character)a resident: mood, where they are, their day
Partservera part of a package, an object (.object)a door, a sign, a lamp
Areaserver— (coming)a square, a street
VisualEffectclienta parta part's colour, every frame
Lightclienta partthe light a part casts, every frame
  • A package is Caria's unit of design: a folder with its document (object.json) and its model. Its parts are the nodes of its model (a door, a sign's letters).
  • In the editor, Add Component offers only the scripts whose host type fits the selection: Building scripts on a building, Part scripts on a part or an object, and so on.
  • A server script is bound to an object of its host type; binding it anywhere else is refused.

Client entry points​

Host typeEntry pointEffect
VisualEffectfunction apply(baseColor: color, elapsedSeconds: float): colorpure
Lightfunction apply(elapsedSeconds: float): colorpure

Every Light script declares property reach: float, the distance in metres at which its light fades out; the view reads it from every binding. See Client scripts.

The calendar​

The server side of Caria also gives the calendar, as library functions: year(), month(), day(), weekday() and season() (Library).