GhostData 3 Share Posted July 25 (edited) Live Scripting w/ Lua Write scripts with lua using LuaJ This is my first attempt at writing a script. Wanted to write something where i can see the results immediately. Please post any errors here or on the Github. Thanks! Spoiler Source: https://github.com/GhostDataIsDreaming/LiveScripting/ Download Link: https://github.com/GhostDataIsDreaming/LiveScripting/releases VirusTotal: https://www.virustotal.com/gui/file/e0326c840a23950b4352503e6c8e3e297de8ac9cbc9780c85dc8adee83cfb173 Edited July 28 by GhostData fix broken links holic, LostVirt and yeeter01 3 Link to comment Share on other sites More sharing options...
GhostData 3 Author Share Posted July 26 (edited) Samples WoodcutAnywhere (Click here for most recent) Spoiler --[[ Simple Wookcutting Script written in Lua Notes: 1. [Important] This entire script is iterated on every onLoop 2. Adjust frequency of script with Executing Interval to make it faster or slower 3. Can be ran anywhere. Will chop trees nearby until inventory is full or is in combat and will run to closest bank if either criteria is met 4. No Antiban present. Figure that shit out yourselves. --]] local Players = luajava.bindClass("org.dreambot.api.methods.interactive.Players") local Walking = luajava.bindClass("org.dreambot.api.methods.walking.impl.Walking") local MethodProvider = luajava.bindClass("org.dreambot.api.methods.MethodProvider") local NPCs = luajava.bindClass("org.dreambot.api.methods.interactive.NPCs") local Inventory = luajava.bindClass("org.dreambot.api.methods.container.impl.Inventory") local Bank = luajava.bindClass("org.dreambot.api.methods.container.impl.bank.Bank") local GameObjects = luajava.bindClass("org.dreambot.api.methods.interactive.GameObjects") local Calculations = luajava.bindClass("org.dreambot.api.methods.Calculations") --[[ Lets setup Main Variables to adjust script --]] local bankers = { "Banker" } local maxRadius = 10; -- Max Travel distance around starting tile local trees = { "Tree", "Oak Tree", "Willow" } -- Trees to Cut Down local logs = { "Logs", "Oak logs", "Willow logs" } -- Logs to deposit in bank --[[ Variables for script, Do not modify. Script uses them --]] local startingArea = nil local bankLocation = nil local bankArea = nil --[[ Define functions script can use --]] function isAtBank() if not bankLocation or not bankArea then bankLocation = Bank:getClosestBankLocation() bankArea = bankLocation:getArea(2) end if not NPCs:closest(bankers) then return false end return true end function isAtStartingArea() if not startingArea then startingArea = Players:localPlayer():getTile():getArea(maxRadius) end if not startingArea:contains(Players:localPlayer():getTile()) then return false end return true end --[[ Actual Script --]] script.onStart(function() -- Grab Variables onStart isAtStartingArea() isAtBank() end) script.onLoop(function() local min = Calculations:random(100, 1000) local max = Calculations:random(1001, 5000) --MethodProvider:log("Waiting between " .. min .. " and " .. max); --MethodProvider:log("Inventory Full: " .. tostring(Inventory:isFull())); --MethodProvider:log("Is at Bank (" .. bankLocation:name() .. ")? " .. tostring(isAtBank())); --MethodProvider:log("Is at Starting Area? " .. tostring(isAtStartingArea())); if Inventory:isFull() then if (isAtBank()) then local banker = NPCs:closest(trees) if not Bank:isOpen() then Bank:open() MethodProvider:sleep(100, 1000) end for _, item in ipairs(logs) do Bank:depositAll(item) MethodProvider:sleep(25, 500) end Bank:close() else --MethodProvider:log("Walking to Bank Area"); Walking:walk(bankArea:getRandomTile()) end else if isAtStartingArea() then local me = Players:localPlayer() --MethodProvider:log("Is Interacted With? " .. tostring(me:isInteractedWith())); --MethodProvider:log("Is Animating? " .. tostring(me:isAnimating())); --MethodProvider:log("Animating = " .. tostring(me:getAnimation())); if me:getAnimation() == -1 then --MethodProvider:log("Pick Tree"); local treeObject = GameObjects:closest(trees) if (treeObject) then treeObject:interact("Chop down") end end else --MethodProvider:log("Walking to Starting Area"); Walking:walk(startingArea:getRandomTile()) end end return Calculations:random(min, max) end) Edited July 28 by GhostData broken link Link to comment Share on other sites More sharing options...
yeeter01 453 Share Posted July 27 Super neat! Link to comment Share on other sites More sharing options...
GhostData 3 Author Share Posted July 28 (edited) Update to v2.2 - Direct Download ChangeLog Revamped the menus. Now includes 3 distinct menues. Loader, Editor, Settings Rewrote the Script Loading, Handling, Executing -- Start your Lua Scripts with (script.) --Supports onStart, onLoop, onExit, onResume, onPaint --Supports onLoop calling even if not present, treats entire script as onLoop Rewrote the sample WoodcutAnywhere. Start that shit anywhere and when your inventory is full it will walk to bank, deposit and then walk back Option to choose samples from the Load Menu. Automatically run them when chose. Edited July 28 by GhostData Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now