Pluto API Documentation

FAQ

Q: What is Pluto?

A: Pluto is a superset of Lua with a focus on general-purpose programming.
More On Pluto

Q: Where are Pluto scripts stored?

A: You can place Pluto script files (.lua, .pluto) here:
%appdata%/spooky/scripts/
and start them from Settings -> Pluto

Q: How do I learn Pluto?

A: You can learn Lua first which will teach you 90% of Pluto
Learn Lua

Q: Where do I get started?

A: You can base your first scripts off of developer made example scripts
View Example Scripts

Functions

LOG(?number LogState = LogState.Info, string Content)

Log(?number LogState = LogState.Info, string Content)

allows you to print information to the console, LogState can be any of the following:


LogState.Brand or 1,
LogState.Info or 2,
LogState.Error or 3,
LogState.Event or 4,
LogState.Warning or 5
        

Content is a string that contains your message.

void LOG(LogState.Info, "Hello World!")

Notify(string Content, ?bool Log = false)

allows you to notify information to the screen, will appear in the top right.

Content is a string that contains your message.

void Notify("Hello World!")

string GetGameVersion()

returns the current Phasmophobia version as a string

string GetSpookyVersion()

returns the current Spooky version as a string

userdata GetObjectByName(string Name)

returns a CComponent userdata (see below) by finding an object that contains the provided name string

userdata GetLocalPlayer()

returns a CComponent userdata (see below) that contains the local players world object

bool IsGameLoaded()

returns a boolean corrosponding to if the game is properly loaded in, we recommend using this before interacting with world objects or trying to find them, otherwise crashes can occur.

void Yield(number milliseconds = 1)

will pause the script for the provided number of milliseconds, or 1 if no number is provided

number GetAccountTier()

returns the Spooky account tier of the current user as any of:


AccountTier.Ghost or 0,
AccountTier.Hunter or 1,
AccountTier.Free or 2
        

string GetAccountName()

returns the Spooky account nickname of the current user

bool AmIHost()

returns if you are the host of the current Phasmophobia room

void SetCursorVisible(bool visible)

sets if the Phasmophobia cursor should be visible

void SetCursorVisible(bool visible)

sets if the Phasmophobia cursor should be visible

string GetServerAddress()

returns the current Photon server IP Address, or an empty string

void SetCursorLockState(number state)

sets if the Phasmophobia cursor should be restricted to the window, or even the centre of the screen, state can be any of:


LockState.Non or 0, -- can be moved anywhere
AccountTier.Locked or 1, -- locked to the centre of the screen
AccountTier.Confined or 2 -- locked to the window
        

number GetCursorLockState()

UserDatas and Tables

Vector3

a Vector3 table contains 3 floats (x, y, z) that typically represent a position

Vector

The Vector class contains functions to assist with Vector math

All Vector math functions can be used with any Vector type as they are dynamic

For example if your table contains just one "x" field, it will do the math just for it.

If your table contains "x", "y", "z", and "w", it will do the math for all of them.

If the second vector does not contain any/some of those elements then that element will be skipped

VectorType Vector.GetType(table Vector)


VectorType.Non or 0, -- not a vector
VectorType.V1 or 1, -- vector containing x
VectorType.V2 or 2, -- vector containing x and y
VectorType.V3 or 3, -- vector containing x, y, and z
VectorType.V4 or 4, -- vector containing x, y, z, and w
        

table Vector.New(?number x = 0, ?number y = 0, ?number z = 0, ?number w = 0)

table Vector.Add(table VectorA, table VectorB)

If the second vector is smaller than the first, the first's elements will be added, example:


local VecA = Vector.New(1, 0, 1)
local VecB = Vector.New(5, 0)

Notify(Vector.ToString(Vector.Add(VecA, VecB))) -- Result: X: 6, Y: 0, Z: 1
        

table Vector.Multiply(table VectorA, table VectorB)

Similar logic to Add

table Vector.Multiply(table VectorA, number Multiplier)

table Vector.Divide(table VectorA, table VectorB)

Similar logic to Add

table Vector.Divide(table VectorA, number Divisor)

Quaternion

a Quaternion table contains 4 floats (x, y, z, w) that typically represent a rotation

CComponent

a CComponent userdata represents an object or an objects component in the world, it has the following functions:

string GetName()

userdata GetTransform()

GetTransform returns a CTransform userdata (see below)

any CallMethod(string MethodName, ...)

CallMethod is an advanced function that allows you to call an in-game function that is attached to the CComponent, it can take an unlimited amount of parameters, and return any value

you should consult game data to find these functions, and ensure the arguments you pass and recieve are valid

CTransform

a CTransform userdata is a type of component which holds an objects position, scale, and rotation, it has the following functions:

string GetName()

userdata GetGameObject()

GetGameObject returns a CComponent userdata (see above)

Vector3 GetPosition()

void SetPosition(number x, number y, number z)

void SetPosition(Vector3 position)

Quaternion GetRotation()

void SetRotation(number x, number y, number z, number w)

void SetRotation(Quaternion rotation)

Vector3 GetScale()

void SetScale(number x, number y, number z)

void SetScale(Vector3 scale)