Skip to content

Instantly share code, notes, and snippets.

@Treeki
Last active January 31, 2018 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Treeki/ff73a6ee13379dcc183f7fbef4fd5416 to your computer and use it in GitHub Desktop.
Save Treeki/ff73a6ee13379dcc183f7fbef4fd5416 to your computer and use it in GitHub Desktop.
Kitterspeak Reference

Kitterspeak Reference

This document is meant to be a reference for users and implementers of Kitterspeak, a scripting language for animating graphical shapes used by the MMOSG Furcadia.

Concept

Each Furcadia shape has four layers, at which it may draw its frames. These are, in order from bottom to top:

  • BG - background,
  • BEHIND - behind furre,
  • furre (not directly usable),
  • FRONT - in front of furre,
  • FG - foreground.

If a furre is present in the shape (in case of items, for example), then the two former layers are drawn behind the furre and the two latter ones are drawn in front of them. Otherwise, these frames are drawn from bottom to top.

When no kitterspeak is present in a shape, then the default is to draw the first frame of that object on the default layer BEHIND, except for Effect shapes, where the default layer becomes FRONT.

Structure

Each Kitterspeak line is composed of up to three numeric values: the step ID that denotes the type of a given Kitterspeak line, and up to two arguments accepted by that particular step ID.

Internal structure

In FOX5 files, each Kitterspeak line is defined as a triplet:

  • UInt16 StepId,
  • Int16 Arg1,
  • Int16 Arg2.

The first argument, StepId, denotes the type of the Kitterspeak rule, as on the below list.

The latter two arguments, Arg1 and Arg2, may or may not be used, depending if the rule denoted by StepID accepts zero, one or two arguments. If unused, the arguments should be 0.

FOXed ignores KS lines with StepId equal to 0 or greater than 33.

Rules

The following lists all legal Kitterspeak rules. The number in brackets is the internal number of the KS line. The two arguments that a step may take are denoted via M and N - if they are present inside a step description, then the step takes them as arguments.

While the below list attempts to be comprehensive and describe all legal Kitterspeak rule types, note that not all of these rules may be available for selection in FOXed.

Rule 1 - Show frame M

Draws frame M on the active legacy layer. This layer defaults to BEHIND (or FRONT for Effect shapes), but rules 9 and 10 can change it. The automatic frame delay is triggered immediately afterwards.

Legacy. New shapes should use rules 23, 24, 29 or 30 which explicitly specify a layer.

Rule 2 - Delay M ms

Pauses KitterSpeak execution for the next M milliseconds.

Rule 3 - Loop to step [M] N times

Increments the rule's internal loop counter L. If L <= N, then jump to step M. Otherwise, set L to 0 and continue.

Rule 4 - Jump to step [M]

Jumps to step M.

Rule 5 - Set frame X position to M

Set the frame's X offset from the (0, 0) point to M pixels. M may be positive or negative. Overrides the frame-provided position for all layers.

Rule 6 - Set frame Y position to M

Set the frame's Y offset from the (0, 0) point to M pixels. M may be positive or negative. Overrides the frame-provided position for all layers.

Rule 7 - Set furre X position to M

Set the furre's X offset from the (0, 0) point to M pixels. M may be positive or negative.

Unofficial proposal: implementations which do not concern themselves with drawing furres in objects are not required to implement this rule.

Rule 8 - Set furre Y position to M

Set the furre's Y offset from the (0, 0) point to M pixels. M may be positive or negative.

Unofficial proposal: implementations which do not concern themselves with drawing furres in objects are not required to implement this rule.

Rule 9 - Move frame in front of furre

If the active legacy layer is currently set to BEHIND, the frame currently visible on the BEHIND layer is moved to the FRONT layer and the active legacy layer is set to FRONT.

Legacy. Used in conjunction with rule 1.

Rule 10 - Move frame behind furre

If the active legacy layer is currently set to FRONT, the frame currently visible on the FRONT layer is moved to the BEHIND layer and the active legacy layer is set to BEHIND.

Legacy. Used in conjunction with rule 1.

Rule 11 - Set default frame delay to M ms

Sets the automatic frame delay that will be used by the various 'show frame' rules.

Rule 12 - Stop

Hammer time. Halts further Kitterspeak execution.

Unofficial proposal: implementations which are meant to showcase Kitterspeak objects may allow this rule to introduce a long delay instead of halting Kitterspeak execution completely.

Rule 13 - Set camera to follow furre position (M)

Controls how the camera is offset when a furre is standing on this object. If M is 1, the camera will be offset along with the furre. If M is 0, the furre will be offset and the object will remain in the centre of the screen. Defaults to 0.

Unofficial proposal: implementations which do not concern themselves with drawing furres in objects are not required to implement this rule.

Rule 14 - Random default frame delay between M and N ms

Sets the automatic frame delay to a range of values, similar to rule 11. A different random delay is chosen each time the delay activates.

Rule 15 - Random delay between M and N ms

Pauses KitterSpeak execution for a random amount of milliseconds between M and N.

Rule 16 - Show frame M from shape N

DEPRECATED. Never implemented in an official client for complexity reasons.

Rule 17 - Set opacity to M

Sets the overall opacity value for this object to M (0 = transparent, 255 = opaque).

Rule 18 - Slide frame's X position to M in N ms

Like rule 5, but the value is linearly adjusted to M over the next N milliseconds. The starting value for the slide is either the default layer's X position (if no override has been performed using rule 5 or 18), or the current overridden X position.

Rule 19 - Slide frame's Y position to M in N ms

Like rule 6, but the value is linearly adjusted to M over the next N milliseconds. The starting value for the slide is either the default layer's Y position (if no override has been performed using rule 6 or 19), or the current overridden Y position.

Rule 20 - Slide furre's X position to M in N ms

Like rule 7, but the value is linearly adjusted to M over the next N milliseconds. The starting value for the slide is either the default layer's furre X position (if no override has been performed using rule 7 or 20), or the current overridden furre X position.

Unofficial proposal: implementations which do not concern themselves with drawing furres in objects are not required to implement this rule.

Rule 21 - Slide furre's Y position to M in N ms

Like rule 8, but the value is linearly adjusted to M over the next N milliseconds. The starting value for the slide is either the default layer's furre Y position (if no override has been performed using rule 8 or 21), or the current overridden furre Y position.

Unofficial proposal: implementations which do not concern themselves with drawing furres in objects are not required to implement this rule.

Rule 22 - Slide opacity to M in N ms

Like rule 17, but the value is linearly adjusted to M over the next N milliseconds.

Rule 23 - Show frame M in the background

Draws frame M on the BG layer. If frame M is currently visible on another layer, it is removed from that layer.

Rule 24 - Show frame M in the foreground

Draws frame M on the FG layer. If frame M is currently visible on another layer, it is removed from that layer.

Rule 25 - Show this file's object M in the background

DEPRECATED. Never implemented in an official client for complexity reasons.

Rule 26 - Show this file's object M in the foreground

DEPRECATED. Never implemented in an official client for complexity reasons.

Rule 27 - Hide background

DEPRECATED. Not available in FOXEd.

Rule 28 - Hide foreground

DEPRECATED. Not available in FOXEd.

Rule 29 - Show frame M behind the furre

Draws frame M on the BEHIND layer. If frame M is currently visible on another layer, it is removed from that layer.

Rule 30 - Show frame M in front of the furre

Draws frame M on the FRONT layer. If frame M is currently visible on another layer, it is removed from that layer.

Rule 31 - Move frame M forward

If frame M is currently being displayed on a layer, it is moved forward one space (BG -> BEHIND -> FRONT -> FG), using the following conditions:

  • M is already at the front (FG): Nothing happens
  • Free space directly in front of M: M is moved into that free space
  • Free space somewhere in front of M: Layers are moved forward one space as necessary to fill that free space, and M is moved forward
  • No free spaces in front of M: M swaps places with the layer directly in front of it

Rule 32 - Move frame M backward

If frame M is currently being displayed on a layer, it is moved backward one space (FG -> FRONT -> BEHIND -> BG), using the following conditions:

  • M is already at the back (BG): Nothing happens
  • Free space directly behind M: M is moved into that free space
  • Free space somewhere behind M: Layers are moved backward one space as necessary to fill that free space, and M is moved backward
  • No free spaces behind M: M swaps places with the layer directly behind it

Rule 33 - Set effect layer mode (M)

This rule only affects Effect shapes, and controls the order in which the 'back' sprites (BG and BEHIND layers) and the 'front' sprites (FRONT and FG layers) for particular objects are rendered in-game.

  • 0 - Legacy: Item Back -> Effect Back -> Furre -> Item Front -> Effect Front
  • 1 - Wrap Item and Furre: Effect Back -> Item Back -> Furre -> Item Front -> Effect Front
  • 2 - Wrap Furre: Item Back -> Effect Back -> Furre -> Effect Front -> Item Front

Shapes that contain at least one of rules 23, 24, 29, 30 (the layer-based Show Frame rules) or 33 will default to Wrap Item and Furre. Other shapes will default to Legacy. The Legacy mode cannot be activated through rule 33; it only exists as a default to support objects with old KitterSpeak code.

Legal

This document © Michał "phoe" Herda. Licensed under the CC0 license.

Furcadia © Dragon's Eye Productions, Inc. All rights reserved. The authors of this document are not affiliated with Furcadia or Dragon's Eye Productions, Inc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment