Script Lua v5

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

-- tools tab

setDefaultTab("Tools")

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
intainers
for i, item in ipairs(container:getItems()) do
if item:getCount() == 100 then
for m, moneyId in ipairs(storage.moneyItems) do

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