mrx
New Member
Posts: 9 Likes: 0
|
Post by mrx on Jun 14, 2022 20:27:13 GMT
function moveTo(X, Z) while not distanceTo(X, Z) do Move(X, CHARPOSY, Z) sleep(2000) end end
function distanceTo(X, Z) xmin, xmax = math.min(CHARPOSX, X), math.max(CHARPOSX, X) zmin, zmax = math.min(CHARPOSZ, Z), math.max(CHARPOSZ, Z) xtrue = xmax - xmin < 1 ztrue = zmax - zmin < 1 return xtrue and ztrue end
function scanJournal(startT, endT, search) for i = startT, endT, .25 do ScanJournal(i) for j in search do if string.match(SCANJOURNALMESSAGE, j) then return true end end end return false end
function useFishingRod(x, y, z) equip("rod", BACKPACKID) Macro(28) WaitForTarget() TargetLoc(x, y, z) end
function fish(clickX, clickY, clickZ) local timeLimit = 25 local fishAvailableMessages = {"caught", "fail to catch", "got away"} local fishUnavailableMessages = {"biting here"} local fishAvailable = true local time = TIME useFishingRod(clickX, clickY, clickZ) while fishAvailable do if (scanJournal(time, TIME, fishAvailableMessages)) or TIME > time + 25 then time = TIME useFishingRod(clickX, clickY, clickZ) elseif (scanJournal(time, TIME, fishUnavailableMessages)) then fishAvailable = false end sleep(2000) end end
function equip(item, containerId) FindItem(item, CHARID) if FINDITEM then -- Already equiped return end FindItem(item, containerId) if FINDITEM then ContextMenu(FINDITEM[1].ID, "Equip") sleep(1000) end end
function hasFishingRod() FindItem("rod") if FINDITEM then return true end return false end
--[[ ########################################################################################################## # # # You have to config your fishing spots with their click coordinates in order for this script to work. # # You can add as many fishing spots as you want, it will go fishing through all of them. # # The script will stop if you are full weight,if you don't have anymore fishing rods or if you are dead. # # # ########################################################################################################## --]]
local fishingSpots = { { locationX = "xxxxx", locationZ = "xxxxx", clickX = "xxxxx", clickY = "xxxxx", clickZ = "xxxxx" }, { locationX = "xxxxx", locationZ = "xxxxx", clickX = "xxxxx", clickY = "xxxxx", clickZ = "xxxxx" } }
local maxWeight = 350 for spot in fishingSpots do moveTo(spot.locationX, spot.locationZ) fish(spot.clickX, spot.clickY, spot.clickZ) if CHARWEIGHT > maxWeight or hasFishingRod() == false or CHARGHOST then StopAllScripts() end end
|
|