Scripting API
This is the full Lua API your scripts can use - pulled straight from the OTClient client (luafunctions.cpp). Everything the client exposes to Lua is listed on the left.
It comes in two shapes:
- Globals - singletons such as
g_game,g_map,g_creatures. Called directly, e.g.g_game.getLocalPlayer(). - Objects - values you get back, such as
Creature,Item,Tile,Container. Called with a colon on an instance, e.g.g_game.getLocalPlayer():getMana().
Browse or search on the left, then click any function for a short description and a ready-to-copy example. You wire these into macros in the Scripts tab with macro(intervalMs, "Name", fn) - the macro runs on its interval while its toggle is ON.
To make a bot module or Tools toggle follow the macro, pass status to easybot_module. Macro ON switches the target ON; macro OFF or script unload switches it OFF.
Control CaveBot with macro status
macro(1000, "CaveBot", function()
easybot_module("cave", status)
end)Example script - Rainbow outfit
macro(3000, "Rainbow outfit", function()
if not g_game.isOnline() then return end
local p = g_game.getLocalPlayer()
if not p then return end
local o = p:getOutfit()
o.head = math.random(0, 132)
o.body = math.random(0, 132)
o.legs = math.random(0, 132)
o.feet = math.random(0, 132)
g_game.changeOutfit(o)
end)