Overview
The purpose of this page is to provide an overview of all the classes, functions, and types available in the Pathing API. It won't go into detail on how to use them, but can be used as a quick reference for when you need to look up a class, function, or type and aren't sure where it might be.
Script Attributes
Script Attributes are attribute tags used on markers in your pack.xml
in order to execute Lua functions. They provide interoperability between your scripts and your markers and trails.
That's a fancy way of saying you can use them to interact with your markers and trails in your Lua scripts.
Here's an example of a marker with a Script Attribute:
- pack.xml
- pack.lua
- script.lua
- output
<POI ... script-once="SaySomething(Woah!)" guid="aWk9ZRjiAUanhexdaUdYWA=="/>
-- The script must be required in order to be used
Pack:Require("/Data/ExamplePack/Scripts/script.lua")
-- Notice we use the default `marker` parameter, then our own custom `message` parameter
function SaySomething(marker, message)
Debug:Print("Message from marker " .. marker.Guid .. ": " .. message)
end
Message from marker aWk9ZRjiAUanhexdaUdYWA: Woah!
In this example, the script-once
attribute is used to call the SaySomething
function in the Lua script. The marker
parameter is automatically passed to the function, and the message
parameter is passed from the script-once
attribute.
Every script attribute will execute at different times and have different parameters, making them all useful in different ways depending on what you are trying to accomplish. Below is a list of all script attributes with a brief description. You can click on the attribute name to see more information about it.
Script Attribute | Default Parameters | Description |
---|---|---|
script-filter | marker(Marker ) | Executes every frame if it is determined that the attached marker should be visible. |
script-focus | marker(Marker ), isFocused(boolean ) | Executes when a marker is focused (the player is within the marker's triggerRange ). |
script-once | marker(Marker ) | Executes once when the marker is loaded. |
script-tick | marker(Marker ), gameTime(GameTime ) | Executes once every in-game tick (typically every frame, but potentially less depending on configuration) |
script-trigger | marker(Marker ), isAutoTriggered(boolean ) | Executes when a marker is triggered (the player is within triggerRange and autoTrigger is on or the player has pressed their interact key). |
Globals
The Pathing API provides a number of global classes and functions that you can use in your Lua scripts. These classes and functions are used to interact with the game world, markers, trails, and more.
Global classes are always available and can be used without any special setup. Their functions can be called directly from your Lua scripts by using the class name followed by a colon and the function name, like this:
Debug:Print("Hello, world!")
Below is a list of all global classes and their functions. Clicking on the arrow next to the class name will expand their function list, and clicking on the class itself will take you to its page in the docs.
Class | Description | |
---|---|---|
Debug | Provides access to various debugging functions which are useful for testing and debugging your scripts. | |
Event | Provides the OnTick function used to call functions every tick. | |
Instance | Provides the ability to create new instances of various pathing types, which can then be used in other functions. | |
Menu | Provides the ability to create and remove menus for script functions in the Pathing UI. | |
Mumble | Provides access to all mumble information, provided in the form of various classes, enums and fields. | |
Pack | Provides the ability to execute scripts and create new markers. | |
User | Provides the ability to set the user's clipboard | |
World | Provides access to many utility functions used to access categories and pathables (markers/trails) within the world. | |
Types
The Pathing API also provides a number of types that you'll need to explore to get information about various things. These types are used to represent various objects in the game world, such as markers, trails, and more. They all have their own fields and helper functions.
For example, if I wanted to get the closest marker's position, I could use the World:GetClosestMarker
global function and then reference the returned Marker
's Position
field, like this:
- Lua
- Output
local closestMarker = World:GetClosestMarker()
local closestMarkerPosition = closestMarker.Position
Debug:Print("The closest marker's position is X: " .. closestMarkerPosition.X .. ", Y: " .. closestMarkerPosition.Y .. ", Z: " .. closestMarkerPosition.Z)
The closest marker's position is X: 0, Y: 0, Z: 0
Below is a list of all types and any helper functions they may have. Clicking on the arrow next to the type name will expand their function list, and clicking on the type itself will take you to its page in the docs.
Class | Description | |
---|---|---|
Category | A marker pack category. | |
Color | A color. | |
GameTime | A table containing two timespans. | |
Guid | A unique identifier. | |
IBehavior | A behavior. | |
IPathable | A pathable. | |
Marker | A marker pack marker. | |
Texture | A marker pack texture. | |
Trail | A marker pack trail. | |
Vector3 | A 3D vector. Has built in functions for vector operations (addition, subtraction, multiplication, etc). | |