0% found this document useful (0 votes)
78 views2 pages

AutoHT DropSource - Lua 2

The document contains Lua code for an auto farming script in a game. It defines functions to check inventory amounts, drop items, find paths, punch tiles, and harvest seeds. The main function calls the seed planting function, then drops excess items. It has error handling to retry the main function if errors occur.

Uploaded by

Setno Vian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views2 pages

AutoHT DropSource - Lua 2

The document contains Lua code for an auto farming script in a game. It defines functions to check inventory amounts, drop items, find paths, punch tiles, and harvest seeds. The main function calls the seed planting function, then drops excess items. It has error handling to retry the main function if errors occur.

Uploaded by

Setno Vian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

--CHANGE HERE--

delay = 500
itemid = 929 -- item id
seedid = 928 -- seed id
posx = 97 -- posx where you want to drop
posy = 23 -- posy where you want to drop

--NO CHANGE--
EditToggle([[Fast Drop "/setcount"]],true)

function blocks(itemid)
for _, item in pairs(GetInventory()) do
if item.id == itemid then
return item.amount
end
end
return 0
end

function drop(itemid)
SendPacket(2,"action|drop\n|itemID|".. itemid)
Sleep(1000)
end

function p(seedid)
for _, tile in pairs (GetTiles()) do
if tile.fg == seedid and GetTiles(tile.x, tile.y)
then
if blocks(itemid) < 200 then
Sleep(20)
FindPath(tile.x , tile.y)
Sleep(delay)
punchs(0,0)
Sleep(30)
elseif blocks(itemid) == 200 then
Sleep(400)
FindPath(posx,posy)
Sleep(700)
drop(itemid)
end
end
end
end

function punchs(x, y)
local packet = {}
packet.px = math.floor(GetLocal().posX / 32) + x
packet.py = math.floor(GetLocal().posY / 32) + y
packet.type = 3
packet.value = 18
packet.x = GetLocal().posX
packet.y = GetLocal().posY
SendPacketRaw(false, packet)
end

function main()
p(seedid)
FindPath(posx,posy)
drop(itemid)
end

seedid = 929

function punch(x,y)
pkt = {}
pkt.type = 3
pkt.value = 18
pkt.px = math.floor(GetLocal().pos.x / 32 +x)
pkt.py = math.floor(GetLocal().pos.y / 32 +y)
pkt.x = GetLocal().pos.x
pkt.y = GetLocal().pos.y
SendPacketRaw(false, pkt)
end

function harvest()
for _, tile in pairs(GetTiles()) do
if tile.fg == seedid and tile.extra.progress == 1 then
FindPath(tile.x,tile.y)
Sleep(300)
punch(0,0)
Sleep(50)
end
end
end

harvest()

function AvoidError()
if pcall(function()
main()
end) == false then
Sleep(100)
AvoidError()
end
Sleep(100)
AvoidError()
end

AvoidError()

You might also like