Professional Documents
Culture Documents
local DELAY_FINDPATH = 60
local DELAY_PLANT = 130
function count(id)
local c = 0
for _, inv in pairs(GetInventory()) do
if inv.id == id then
c = c + inv.count
end
end
return c
end
function Hook(varlist)
if varlist[0]:find("OnDialogRequest") and varlist[1]:find("Edit MAGPLANT 5000")
then
if MAG_X == 0 and MAG_Y == 0 then
MAG_X = varlist[1]:match('embed_data|x|(%d+)')
MAG_Y = varlist[1]:match('embed_data|y|(%d+)')
WORLD = GetLocal().world
end
return true
end
end
if PlaceX >= 0 and PlaceX < WORLD_SIZE_X and PlaceY >= 0 and PlaceY <
WORLD_SIZE_Y and GetTile(PlaceX,PlaceY).fg == 0 then
FindPath(PlaceX, PlaceY)
Sleep(DELAY_FINDPATH)
Place(PlaceX, PlaceY, 5640)
Sleep(DELAY_PLANT)
end
end
end
end
end
Dialog()
while true do
Sleep(1000)
if (MAG_X ~= 0 and MAG_Y ~= 0) and CheckRemote() then
Plant()
end
end