GorillaScript is a custom scripting language designed for Gorilla Tag custom maps, inspired by VRChat's Udon. It allows map creators to add custom behavior to their maps using a straightforward scripting system.
- Introduction
- Getting Started
- Language Syntax
- Built-in Properties
- Built-in Functions
- Control Flow
- Variable Types
- Defining Functions
- Examples
- Error Handling
GorillaScript provides creators with a simple scripting framework for defining behaviors in Gorilla Tag custom maps. Scripts can define Start and Update functions, utilize game-specific properties, and perform basic operations like logging, conditional statements, and variable manipulation.
GorillaScript has no comment support, NO COMMENTS IN CODE!!!!!
- Add the
GorillaScriptManagercomponent to your custom map in Unity. - Write your scripts in the format provided below.
- Register your scripts with
RegisterScriptand call them usingExecuteScriptor predefined lifecycle functions (StartandUpdate).
GorillaScript uses a simple, Python-like syntax.
def Start:
Log("Script started!");
bool isMeTagged = IsMeTagged;
if (isMeTagged) {
Log("You are tagged!");
}
def Update:
int taggedPlayers = TaggedPlayers;
Log("Number of tagged players: " + taggedPlayers);
GorillaScript provides the following built-in properties:
-
IsMeTagged (
bool)
Checks if the local player is tagged. -
TaggedPlayers (
int)
Returns the number of currently tagged players. -
PlayerPos (
vec3)
The local player’s position in world space. -
PlayerRot (
quat)
The local player’s rotation in world space.
Logs a message to the Unity console.
- Parameters:
message(string): The message to log.
Example:
Log("This is a test message!");
Conditionally execute code based on a boolean expression.
Syntax:
if (condition) {
// Code to execute if condition is true
}
Example:
if (IsMeTagged) {
Log("You are tagged!");
}
GorillaScript supports the following variable types:
- bool: Boolean (
trueorfalse) - int: Integer
- vec3: 3D vector (
Vector3in Unity) - quat: Quaternion (
Quaternionin Unity)
Example:
bool isMeTagged = IsMeTagged;
int taggedPlayers = TaggedPlayers;
vec3 playerPosition = PlayerPos;
quat playerRotation = PlayerRot;
GorillaScript allows defining two functions:
-
Start
Executed when the script is initialized. -
Update
Executed every frame.
Syntax:
def Start:
// Code to execute at the start
def Update:
// Code to execute every frame
def Start:
Log("Starting script...");
if (IsMeTagged) {
Log("You are tagged!");
} else {
Log("You are not tagged!");
}
def Update:
Log("Player position: " + PlayerPos);
### Example 2: Counting Tagged Players
def Start:
Log("Initial tagged player count: " + TaggedPlayers);
def Update:
int currentTagged = TaggedPlayers;
Log("Currently tagged players: " + currentTagged);
Errors in scripts will be logged to the Unity console with details about the error.
Use Log statements for debugging and verifying script behavior.
Common Errors:
- Undefined variables
- Syntax errors in expressions
- Unsupported operations
Example Error Log: Error executing script 'Example': Variable 'playerPos' not defined.