program OGLDraynorChopper; {$i cLib.simba} { This script requires ogLib. Learn how to set it up correctly here: https://villavu.com/forum/showthread.php?t=112486 This script also requires cLib. Learn how to set it up correctly here: https://villavu.com/forum/showthread.php?t=113750 Make sure to set your game window to 'Resizable' and your interface to the RuneScape 3 default. If you prefer a different screen size, change it at lines 18 and 29. } { const Screen Constants; Description: Constants for the screen. Change these to your own preference. } const WIDTH = 1440; HEIGHT = 900; { const Misc Constants; Description: Miscellaneous constants for the script. } const GLX_DEBUG = 'none'; // options: none, models, textures, fonts VERSION = '2.1.3'; METEORITE_SKILL = WOODCUTTING; { const Object Model Constants: Description: Constants for various object models. Shouldn't be changed. } const BANKER_MODEL_IDS : tCardinalArray = [1828922260]; BANK_BOOTH_MODEL_IDS : tCardinalArray = [2697527608]; WILLOW_MODEL_IDS : tCardinalArray = [2741093185, 3438012135, 135155099]; BIRDS_NEST_IDS : tCardinalArray = [3295357347, 2974258964, 1860798043]; { const Object Texture Constants: Description: Constants for various object textures. Shouldn't be changed. } const MINIMAP_FLAG_ID = 1275; BANK_ICON_ID = 45052; WILLOW_LOGS_ID = 116280; var clientCenter: tPoint; willowModels, nestModels, meteoriteModels: glModelArray; canChopTree, canPickupNest, canWalk, canOpenBank, canDeposit, canPrintProgress, canGetExperience: tCountDown = 0; willowsCut, startExperience, playerId: integer; startTime: integer; procedure printProgress(); var elapsedTime: integer; hours: double; minutes: double; gainedExperience: integer; begin elapsedTime := getSystemTime() - startTime; hours := elapsedTime / 3600000; minutes := floor(elapsedTime / 60000) mod 60; gainedExperience := player.getExperience() - startExperience; writeln('Running for: ', floor(hours), 'h ', minutes, 'm'); writeln('Willows cut: ', willowsCut); writeln('Willows per hour: ', floor(willowsCut / hours)); writeln('Experience earned: ', gainedExperience); writeln('Experience per hour: ', floor(gainedExperience / hours)); writeln('========================================='); canPrintProgress.setTime(15000); end; procedure twiddleThumbs; begin case Random(533) of 1: antiban.rotateCamera(342, 11, 4); end; end; function checkTrees: boolean; begin willowModels := ogl.getModels(WILLOW_MODEL_IDS); result := not willowModels.isEmpty(); end; procedure chopTree; var funcClickPoint: TPoint; begin funcClickPoint := clientCenter.closest(willowModels)[0].randomizePointEllipse(55); mouse.click(funcClickPoint); canChopTree.setTime(random(4000, 6000)); end; function checkMinimapFlag: boolean; var funcFlagTexture: glTextureArray; begin funcFlagTexture := ogl.getTextures(MINIMAP_FLAG_ID); try if (not funcFlagTexture.isEmpty()) then result := funcFlagTexture[0].distanceFrom(minimap.getPlayer()) > normalRandom(18, 24) else result := false; except result := false; end; end; procedure walkToWillows; begin walking.walkToRelativePoint(-10, -6, 6, 10); canWalk.setTime(normalRandom(5000, 10000)); end; procedure walkToBank; begin walking.walkToIcon(BANK_ICON_ID, -10, -2, 0, 10); canWalk.setTime(normalRandom(5000, 10000)); end; function isAtBank: boolean; begin result := ogl.getTextures(BANK_ICON_ID)[0].distanceFrom(minimap.getPlayer()) < normalRandom(38, 41); end; function isBankerVisible: boolean; begin result := not ogl.getModels(BANKER_MODEL_IDS).getVisible().isEmpty(); end; procedure openBank; var funcClickPoint: tPoint; begin funcClickPoint := clientCenter.closest(ogl.getModels(BANKER_MODEL_IDS))[0] .closest(ogl.getModels(BANK_BOOTH_MODEL_IDS))[0].randomizePointEllipse(25); mouse.click(funcClickPoint); canOpenBank.setTime(normalRandom(6000, 7500)); end; procedure bankInventory; begin wait(normalRandom(550, 790)); if (canPrintProgress.isFinished()) then begin willowsCut := willowsCut + inventory.getItems(WILLOW_LOGS_ID).indexes() - 1; printProgress(); end; bank.clickDepositCarriedItems(); canWalk.setTime(normalRandom(170, 330)); canDeposit.setTime(2000); end; function checkNests: boolean; begin nestModels := ogl.getModels(BIRDS_NEST_IDS); result := not nestModels.isEmpty(); end; procedure pickupNest(); var funcClickPoint: tPoint; begin funcClickPoint := clientCenter.closest(nestModels)[0].randomizePointEllipse(8); mouse.rightClickOption(funcClickPoint, 'Take'); canPickupNest.setTime(normalRandom(2000, 2500)); canChopTree.setTime(normalRandom(2000, 2500)); end; procedure mainLoop; var funcReaction: procedure() = @twiddleThumbs; begin antiban.checkRandoms(); if (isAtBank()) then begin if (inventory.isFull()) then begin if (bank.hasBank() and canDeposit.isFinished()) then funcReaction := @bankInventory else if (canOpenBank.isFinished()) then funcReaction := @openBank end else if (canWalk.isFinished()) then walkToWillows() end else begin if (not inventory.isFull()) then begin if (checkNests()) and (canPickupNest.isFinished()) then funcReaction := @pickupNest else if (not player.isAnimating(playerId)) and (checkTrees()) and (not checkMinimapFlag()) and (canChopTree.isFinished()) then begin funcReaction := @chopTree; canChopTree.setTime(normalRandom(4000, 6000)); end end else if (canWalk.isFinished()) then walkToBank() end; funcReaction(); end; begin ogl.setup(WIDTH, HEIGHT); clientCenter := ogl.getClientMidPoint(); startTime := getSystemTime(); ogl.setDebugMode(GLX_DEBUG); if (not web.isUpToDate(VERSION, 'https://raw.githubusercontent.com/yuri-moens/simba-scripts/master/OGLDraynorChopper.version')) then web.update('https://raw.githubusercontent.com/yuri-moens/simba-scripts/master/OGLDraynorChopper.simba', 'OGLDraynorChopper'); writeln('[OGL] Draynor Chopper v', VERSION, ' by ChaosEnergy'); writeln('========================================='); try antiban.setMeteoriteSkill(METEORITE_SKILL); playerId := player.getId(); startExperience := player.getExperience(); repeat mainLoop; wait(normalRandom(220, 670)); until false; except writeln('Oops! It appears I have crashed.'); writeln('Logging out...'); login.logout(); terminateScript(); end; end.