Project OutFox Wiki
Project OutFox home View the OutFox Wiki source on GitHub Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto mode Back to homepage

Anatomy of an Actor

Every actor in SM5 follows a standard general structure, with ActorFrames being more flexible in how they’re constructed.

General layout

Def.Actor {
	Name= "Example Actor",
	InitCommand= function(self) self:zoom(100) end,
	OnCommand= function(self) self:linear(2):x(30) end,

Every actor starts with a Def. prefix, followed by the actor type itself. An actor can have a name and commands. These commands could be anything, as long as it’s suffixed with a Command or MessageCommand, depending on the type of commands needed.

Names allow one to easily grab the actor through functions like GetChild, but there are other exampled given later.

When the definition is complete, the actor has to be “returned” for the game to see it. Most of the time, ActorFrames are usually what’s returned instead of just a single actor.


Commands come in two variants: “Commands” and “Messages”.

Commands are usually isolated to a single actor, with a few exceptions. Messages are commands that are meant to be in multiple actors and can be invoked at around the same time on all actors with a “Broadcast”.

MESSAGEMAN:Broadcast("SpecialMove", {funnymove = 10, absolute = false})

This would run “SpecialMoveMessageCommand” on all actors that have this command defined, with a parameter table being passed in. Not all actors might use this table, even though they might have the command defined.

If one needs to manually queue a command or message, the queuecommand or queuemessage functions can be used.

These queued commands run only after all previous tweens have finished.


-- The actor itself
	-- an action is performed first
	-- an action is performed after 'Action'

If a command has to run instantly, playcommand can be used for that.


-- The actor itself
	-- an action is performed

If one wants to pass custom parameters into the command, a single table has to be used to wrap every parameter passed.

These command functions generally take two paramters: The actor calling the function (often called self), and the parameters table passed into the command. The paramters table is optional.

self:playcommand("Action", { --[[Values are added here like a regular table.]] })

-- example
self:playcommand("Action", { Value = 2 })

-- In the actor
	SCREENMAN:SystemMessage("I've got value which has ".. param.Value)