0% found this document useful (0 votes)
284 views

Script Lua Tibia

The document contains Lua code that defines macros and UI elements in OTClient. It defines macros to exchange money items, send trade channel messages, and stack items. It also defines UI containers and text edits to manage money items and trade messages. Spells are defined and macros cast them on targets within range if mana and level requirements are met.

Uploaded by

D4RK L0F1
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
284 views

Script Lua Tibia

The document contains Lua code that defines macros and UI elements in OTClient. It defines macros to exchange money items, send trade channel messages, and stack items. It also defines UI containers and text edits to manage money items and trade messages. Spells are defined and macros cast them on targets within range if mana and level requirements are met.

Uploaded by

D4RK L0F1
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

-- tools tab

setDefaultTab("Tools")

if type(storage.moneyItems) ~= "table" then


storage.moneyItems = {3031, 3035}
end
macro(1000, "Exchange money", function()
if not storage.moneyItems[1] then return end
for index, container in pairs(containers) do
if not container.lootContainer then -- ignore monster containers
for i, item in ipairs(container:getItems()) do
if item:getCount() == 100 then
for m, moneyId in ipairs(storage.moneyItems) do
if item:getId() == moneyId.id then
return g_game.use(item)
end
end
end
end
end
end
end)

local moneyContainer = UI.Container(function(widget, items)


storage.moneyItems = items
end, true)
moneyContainer:setHeight(35)
moneyContainer:setItems(storage.moneyItems)

UI.Separator()

macro(60000, "Send message on trade", function()


local trade = getChannelId("advertising")
if not trade then
trade = getChannelId("trade")
end
if trade and storage.autoTradeMessage:len() > 0 then
sayChannel(trade, storage.autoTradeMessage)
end
end)
UI.TextEdit(storage.autoTradeMessage or "I'm using OTClientV8!", function(widget,
text)
storage.autoTradeMessage = text
end)

macro(1000, "Stack items", function()


local containers = g_game.getContainers()
local toStack = {}
for index, container in pairs(containers) do
if not container.lootContainer then -- ignore monster containers
for i, item in ipairs(container:getItems()) do
if item:isStackable() and item:getCount() < 100 then
local stackWith = toStack[item:getId()]
if stackWith then
g_game.move(item, stackWith[1], math.min(stackWith[2],
item:getCount()))
return
end
toStack[item:getId()] = {container:getSlotPosition(i - 1), 100 -
item:getCount()}
end
end
end
end
end)

local Spells = {
{name = "utevo gran res sac", cast = true, range = 10, buffSpell = false, manaCost
= 1000, level = 0},}
-- script
macro(100, "Familiar", function()
if not g_game.isAttacking() then
return
end
local target = g_game.getAttackingCreature()
local distance = getDistanceBetween(player:getPosition(), target:getPosition())
for _, spell in ipairs(Spells) do
if mana() >= spell.manaCost and lvl() >= spell.level and distance <= spell.range
and spell.cast then
if not hasPartyBuff() or not spell.buffSpell then
say(spell.name)
end
end
end
end)

local Spells = {
{name = "utito tempo san", cast = true, range = 10, buffSpell = false, manaCost =
1000, level = 0},}
-- script
macro(5000, "Utito San", function()
if not g_game.isAttacking() then
return
end
local target = g_game.getAttackingCreature()
local distance = getDistanceBetween(player:getPosition(), target:getPosition())
for _, spell in ipairs(Spells) do
if mana() >= spell.manaCost and lvl() >= spell.level and distance <= spell.range
and spell.cast then
if not hasPartyBuff() or not spell.buffSpell then
say(spell.name)
end
end
end
end)

You might also like