Skyrim Multiplayer Docs
  • Home
  • Running A Server
  • Server Configuration Reference
  • Server Command Line Api
  • Server Ports Usage
  • Database Drivers
  • Serverside Scripting Reference
  • Clientside Scripting Reference
  • Properties System
  • Events System
  • Skyrim Platform
  • Server Data Directory
Powered by GitBook
On this page
  • ctx.sp
  • ctx.refr
  • ctx.value
  • ctx.state
  • ctx.get()
  • ctx.getFormIdInServerFormat()
  • ctx.getFormIdInClientFormat()
  • ctx.respawn()
  • ctx.sendEvent()

Was this helpful?

Clientside Scripting Reference

PreviousServerside Scripting ReferenceNextProperties System

Last updated 4 years ago

Was this helpful?

In Skyrim Multiplayer there are no dedicated clientside scripts. Code snippets that runs client-side are passed as strings to makeProperty, updateOwner and updateNeighbor which are described in .

ctx.sp

Refers to Skyrim Platform API. See page.

// Print to console
ctx.sp.printConsole("Hello Skyrim Platform!");
// Kill player character (locally)
ctx.sp.Game.getPlayer().kill();

ctx.refr

In makeProperty is always undefined.

In updateOwner is similar to ctx.sp.Game.getPlayer().

In updateNeighbor refers to neighbor synchronized ObjectReference or Actor.

const pos = [
  ctx.refr.getPositionX(),
  ctx.refr.getPositionY(),
  ctx.refr.getPositionZ()
];

ctx.value

In makeProperty is always undefined.

In updateOwner / updateNeighbor is equal to the value of a property that is processed currently or undefined if there is no value or it's not visible due to flags.

ctx.sp.Game.setPlayerLevel(ctx.value || 1);

ctx.state

A writable object that is used to store data between updateOwner/updateNeighbor calls or makeProperty initializations.

state is currently shared between properties.

ctx.state.x = "y";

ctx.get()

Get the value of the specified property. Built-in properties are not supported properly, so attempts getting them are leading to the undefined behavior.

const v = ctx.get("myAwesomeProperty");

ctx.getFormIdInServerFormat()

Gets serverside formId by clientside formId or 0 if not found.

const serversideFormId = ctx.getFormIdInServerFormat(0xff00016a);

ctx.getFormIdInClientFormat()

Opposite to getFormIdInServerFormat. Gets clientside formId by serverside formId or 0 if not found.

const clientsideFormId = ctx.getFormIdInClientFormat(0xff000000);

ctx.respawn()

Respawns ctx.refr immediately.

ctx.respawn();

ctx.sendEvent()

Available only in makeProperty context. Sends an event to the server.

ctx.sendEvent({ foo: 'bar' });
Serverside Scripting Reference
Skyrim Platform