Your browser does not support JavaScript or its disabled!
Please turn it on, or be aware that some features on this website will not work correctly.
OTClient Code

These are codes that I have posted on various forums/discord.

Get Position from Shift-Click Look #1
onTextMessage(function(mode, text)
    if mode == 20 then
        if not modules.game_interface.gameMapPanel.mousePos then return end
        local tile = modules.game_interface.gameMapPanel:getTile(modules.game_interface.gameMapPanel.mousePos)
        if tile then
            local loc = tile:getPosition()
            error("Position: " .. loc.x.. ", "..loc.y..", "..loc.z)
            if not modules.game_textmessage then return end
            modules.game_textmessage.displayMessage(16, "position: " .. loc.x.. ", "..loc.y..", "..loc.z)
        end
    end
end)

Look messages are generated server side, but the message for look is mode 20, so you can listen for mode 20 textmessages and then just get the position from the tile under your cursor.

#LUA
01/01/2021
Evo Autoloot add #2
local items = {"golden legs", "golden armor"}
UI.Separator()
UI.Label("Auto Loot List:")
UI.Button("Golden", function(newText)
    say("!autoloot clear")
    for x = 1, table.getn(items) do
        say("!autoloot add, ".. items[x])
    end
end)
#LUA
01/01/2021
Actionbar per character #3
file game_actionbar\actionbar.lua
function online()
  actionConfig = g_configs.create("/actionbars/" .. g_game.getLocalPlayer():getName():lower().. ".otml")

  setupActionPanel(1, actionPanel1)
  setupActionPanel(2, actionPanel2)
  show()
end
create a folder called actionsbars in your configs folder (%appdata%\OTClientV8\otclientv8\actionbars)
#LUA
01/01/2021
Drop to Pos #4
UI.Button("Drop to Pos", function()
    local dropPos = { x = 300, y = 2056, z = 7 }
    local itemToDrop = 3031
    for _, container in pairs(g_game.getContainers()) do
        for __, item in ipairs(container:getItems()) do
            if item:getId() == itemToDrop then
                return g_game.move(item, dropPos , 1)
            end
        end
    end
end)
#LUA
01/01/2021
Load Backpacks on config load #5
openBackpacks = function()
    containers = getContainers()
    if #containers < 1 and containers[0] == nil then
        bpItem = getBack()
        if bpItem ~= nil then
            g_game.open(bpItem)
        end
    end

    schedule(500, function()
        local nextContainers = {}
        containers = getContainers()
            for i, container in pairs(g_game.getContainers()) do
            for i, item in ipairs(container:getItems()) do
                if item:isContainer() then
                    table.insert(nextContainers, item)
                end
            end
        if #nextContainers == 0 then return end
        local delay = 1
        for i = 1, #nextContainers do
            schedule(delay, function()
                g_game.open(nextContainers[i], nil)
            end)
            delay = delay + 250
        end
        end
    end)
end

-- this loads the function straighta way
openBackpacks()
-- this adds a button to your bot, so you can press it
UI.Button("Backpack Open", function()
    openBackpacks()
end)
#LUA
01/01/2021