Post by nefariis on Mar 15, 2021 0:53:36 GMT
This is a script that will go across a user selected field and grab soil samples....
When the script starts you will be asked for an upper left bounds, followed by the lower right bounds.
When the script starts you will be asked for an upper left bounds, followed by the lower right bounds.
-- LoA 1.4.0.0
-- LoU 1.2.1.0
local lowestx, highestx, lowestz, highestz
local pileID
function getBounds()
print("Please define top left gathering location...")
sleep(5000)
ulx, ulz = CLICKWORLDX, CLICKWORLDZ
print(string.format(" - Upper Bounds x: %s, z: %s", ulx, ulz))
print("Please define lower right gathering location...")
sleep(5000)
lrx, lrz = CLICKWORLDX, CLICKWORLDZ
print(string.format(" - Lower Bounds x: %s, z: %s", lrx, lrz))
lowestx, highestx = math.min(ulx, lrx), math.max(ulx, lrx)
lowestz, highestz = math.min(ulz, lrz), math.max(ulz, lrz)
end
-- Start by digging a hole at location
function startGatheringAt(x, z)
Move(x + 1, CHARPOSY, z)
while CHARPOSX != x + 1 do
sleep(500)
end
Macro(gardeningMacroID)
TargetLoc(x, CHARPOSY, z)
sleep(2000)
return cultivateSoil()
end
-- Cultivate our newly dug hole
function cultivateSoil()
FindItem("messy soil pile")
if not FINDITEM then
return "Could not find hole"
end
pileID = FINDITEM[1].ID
ContextMenu(pileID, "Cultivate Soil")
repeat
sleep(1000)
FindItem("tilled soil")
until FINDITEM
sleep(2000)
return takeSoilSample()
end
-- Take A Soil Sample
function takeSoilSample()
ContextMenu(pileID, "Take Soil")
ScanJournal(TIME)
return SCANJOURNALMESSAGE
end
-- Start Script
getBounds()
for x = lowestx, highestx, 1.5 do
for z = lowestz, highestz, 1.5 do
print(startGatheringAt(x, z))
sleep(3000)
end
end