Unscheduled Proxy Lua Documentation

Introduction

This document shows:

  • Setting and getting options
  • Sending variantlists with sendPacketVariantList
  • Handling events (game messages, generic text, variant lists)
  • Useful Lua functions for bot control

1. Setting & Getting Options

bot:setOption("speedInt", 750)
local speed = bot:getOption("speedInt")

Available Fields

Category Field Name Type Description
Utils
Utils "showPing" bool If true, will display ping by your name.
Utils "visualMod" bool If true, enables a “visual mod” mode.
Mod Settings
Mod Settings "leaveOnMod" bool If true, bot leaves the world upon mod entry.
Mod Settings "banAll" bool If true, bot automatically bans all players.
Mod Settings "autoCollectBeforeLeave" bool If true, bot tries to collect items before leaving.
Mod Settings "unAccessAll" bool If true, bot unaccesses all players.
Mod Settings "unAccessOnMod" bool If true, bot unaccesses everyone when a mod enters.
Auto Farm
Auto Farm "isAutoFarmActive" bool If true, the auto-farming logic is active.
Auto Farm "autoFarmID" int The item ID that auto-farm targets (e.g. 4584).
Auto Farm "autoFarmDelay" int Delay between auto-farming actions, in ms.
Speed/Physics
Speed/Physics "speedInt" int The integer representing movement speed for the bot.
Speed/Physics "gravityInt" int Gravity integer used in the bot’s physics.
Speed/Physics "accelerationX" float Horizontal acceleration the bot uses for movement.
Speed/Physics "accelerationY" float Vertical acceleration the bot uses for movement.
Automations
Automations "isCrimeEnabled" bool If true, enables auto crime.
Automations "isAutoSurgActive" bool If true, enables auto surg.
Automations "assistiveAutoSurg" bool If true, uses an assistive surgery.
Titles
Titles "legendTitleEnabled" bool Toggles a “Legend” title.
Titles "talkWithMe" bool Whenever you chat, it automatically uses /me.
Titles "drTitleEnabled" bool Doctor title.
Titles "autoAcceptAccess" bool If true, automatically accepts access for other players.
Titles "maxLevelTitleEnabled" bool Toggles a “Max Level” title.
Titles "donorTitleEnabled" bool Donor title.
Titles "masterTitleEnabled" bool Master title.
Titles "partyAnimalTitleEnabled" bool Party Animal title.
Titles "ccBadgeEnabled" bool CC Badge.
Titles "thanksgivingTitleEnabled" bool Thanksgiving title.
Titles "oldTimerTitleEnabled" bool Old Timer title.
Titles "goldTitleEnabled" bool Gold title.
Titles "silverTitleEnabled" bool Silver title.
Titles "bronzeTitleEnabled" bool Bronze title.

Usage

Setting an Option

bot:setOption("showPing", true)
bot:setOption("visualMod", false)
bot:setOption("leaveOnMod", true)
bot:setOption("banAll", false)
bot:setOption("isAutoFarmActive", true)
bot:setOption("autoFarmID", 4584)
bot:setOption("autoFarmDelay", 200)
bot:setOption("speedInt", 500)
bot:setOption("gravityInt", 1000)
bot:setOption("accelerationX", 1500.0)
bot:setOption("accelerationY", 1200.0)

Getting an Option

local pingVis = bot:getOption("showPing")
local speed = bot:getOption("speedInt")
local accelX = bot:getOption("accelerationX")
print("showPing? ", pingVis)
print("speedInt = ", speed)
print("accelerationX = ", accelX)

2. Sending a VariantList Packet

Purpose

We expose a method to send a variantlist packet, which in Lua, you call with:

bot:sendPacketVariantList(sendToProxy, variantTable, netID)
  • sendToProxy: Boolean. If true, interpret as proxy → client. If false, interpret as proxy → server.
  • variantTable: A Lua table containing up to 7 elements. Each element can be a string, number, or boolean.
  • netID: (optional) integer netID to be sent in the packet.

Usage

Basic Example:

local varlist = {
    "OnTextOverlay",
    "`2Accepted`` Access."
}
bot:sendPacketVariantList(true, varlist)
Important: The code that translates the Lua table → variantlist_t is fairly simple:
  • Skips unknown types (tables, functions, etc.).
  • Converts booleans to integer variant (0 or 1).
  • Converts numbers to floats.
  • Converts strings to strings.

3. Event Handling (Callbacks)

You can listen for events by using:

bot:on("eventName", function(...) ... end)

The following event names are available:

gameMessage

Triggered when a game message is fired in the internal handler. Callback receives 1 argument: message (string).

bot:on("gameMessage", function(msg)
    print("Received gameMessage:", msg)
end)

genericText

Triggered when “generic text” data is received. Callback receives 1 argument: text (string).

bot:on("genericText", function(txt)
    print("Received genericText:", txt)
end)

variantlist

Triggered when a variant list arrives in the internal handler. Callback receives 2 arguments: table and netID.

bot:on("variantlist", function(varTable, netID)
    print("Got a variantlist, netID:", netID)
    for i, v in ipairs(varTable) do
        print("   Index", i, "Value:", v)
    end
end)

Usage Example

bot:on("gameMessage", function(msg)
    print("Game message arrived:", msg)
end)

bot:on("genericText", function(txt)
    print("Generic text arrived:", txt)
end)

bot:on("variantlist", function(varTable, netID)
    print("Variant list arrived from netID:", netID)
end)

4. Other Notable Lua Functions

Text Packet Sending

bot:sendPacket(packetType, data)
  • packetType: (integer)
  • data: (string)

Sends a raw packet with the specified packetType and data from proxy → server.

Sleeping / Delays

bot:sleep(milliseconds)
  • milliseconds: integer
  • Blocks the script for the given number of milliseconds.

Example:

print("Sleeping for 2 seconds...")
bot:sleep(2000)
print("Awake again!")

World Info & Entities

local worldName = bot:getWorldName()
local tiles = bot:getTiles()
local players = bot:getPlayers()
local objects = bot:getObjects()

Movement / Interaction

bot:findPath(x, y)
bot:getPosition()
bot:punch(x, y)
bot:place(itemID, x, y)

Misc

bot:warp(worldName)
local botName = bot:name()
getBot(growID)

5. Example Lua Snippet

-- 1) Retrieve a bot by GrowID
local bot = getBot("GrowID")

-- 2) Set some options:
bot:setOption("showPing", true)
bot:setOption("visualMod", true)
bot:setOption("speedInt", 750)
bot:setOption("accelerationX", 2000.0)
bot:setOption("leaveOnMod", false)
bot:setOption("isAutoFarmActive", true)
bot:setOption("autoFarmID", 4584)
bot:setOption("autoFarmDelay", 150)

-- 3) Check them:
print("Ping visible? ", bot:getOption("showPing"))
print("speedInt:", bot:getOption("speedInt"))
print("accelerationX:", bot:getOption("accelerationX"))

-- 4) Register some event callbacks:
bot:on("gameMessage", function(msg)
    print("Got a gameMessage:", msg)
end)

bot:on("variantlist", function(vlist, netID)
    print("VariantList from netID:", netID)
    for i, v in ipairs(vlist) do
        print("   ["..i.."] = "..tostring(v))
    end
end)

-- 5) Use pathfinding:
local ok = bot:findPath(30, 15)
if ok then
  print("Pathfinding to 30;15 started.")
else
  print("No valid path or cannot start pathfinding!")
end

-- 6) Punch a tile:
bot:punch(28, 14)

-- 7) Place an item:
bot:place(4584, 31, 15)

-- 8) Send a text overlay using a variantlist:
local overlay = {
    "OnTextOverlay", 
    "This is my overlay text"
}
bot:sendPacketVariantList(true, overlay)

-- 9) Sleep for a moment:
print("Sleeping for 1 second...")
bot:sleep(1000)
print("Woke up!")

-- 10) Get the bot’s position:
local x, y = bot:getPosition()
print("Bot position is now", x, y)

6. Troubleshooting & Tips

Unknown Option:
bot:setOption("randomValue", true)  -- Throws error
Type Mismatch:
-- Bad:
bot:setOption("speedInt", "fast")
-- Good:
bot:setOption("speedInt", 500)
Blocking Calls:

The bot:sleep(milliseconds) function blocks the script. If you need asynchronous behavior, keep in mind that this stops your Lua code entirely until the time has elapsed (unless forcibly stopped).

Stopping a Script:

If the script is forcibly stopped from outside (C++ side), the sleep, findPath, or other blocking calls will throw an error and terminate the script. Wrap them in pcall if you need to catch that.