Popular Post Eliot Posted July 29, 2018 Popular Post Share Posted July 29, 2018 (edited) I started a new account and needed some agility levels, so I figured I'd record myself making an agility script and post it here. The goal of this is to try and encourage others to learn to script. Apologies for those on tiny monitors, the text will be very difficult to read (I make the font bigger about 2.5 minutes in). Also sorry for pauses and random scene switches, I was trying to figure out how to work the recording software and code and talk at the same time... too many things at once. Watch at max quality (1440p) if you want to be able to read the code. Source code: import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.util.Arrays; @ScriptManifest(author = "eliot", info = "", logo = "", version = 1.0, name = "A GOOD SCRIPT") public class Main extends Script { private String[] actions = {"Climb", "Cross", "Balance", "Jump-up", "Jump", "Climb-down"}; private String[] names = {"Rough wall", "Tightrope", "Narrow wall", "Wall", "Gap", "Crate"}; Entity previous; @Override public void onStart() { getExperienceTracker().start(Skill.AGILITY); } @Override public int onLoop() throws InterruptedException { int starting = getExperienceTracker().getGainedXP(Skill.AGILITY); Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getName()) && Arrays.asList(actions).contains(obj.getActions()[0]) && (getMap().canReach(obj) || obj.getName().equals("Crate")) && !obj.equals(previous)); if (nextObj != null && !myPlayer().isMoving()) { if (nextObj.interact(nextObj.getActions()[0])) { new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return getExperienceTracker().getGainedXP(Skill.AGILITY) > starting; } }.sleep(); } if (getExperienceTracker().getGainedXP(Skill.AGILITY) > starting) { previous = nextObj; } } return 250; } } Edited July 29, 2018 by Eliot 26 3 Quote Link to comment Share on other sites More sharing options...
Furious 7 Posted July 29, 2018 Share Posted July 29, 2018 Incredible! I might actually give it a try and try to code myself. 1 Quote Link to comment Share on other sites More sharing options...
D Bolter Posted July 29, 2018 Share Posted July 29, 2018 thank you for this. 1 Quote Link to comment Share on other sites More sharing options...
Alek Posted July 29, 2018 Share Posted July 29, 2018 Beautiful voice, just FYI you don't need the action name if you're using .interact() because it uses the first action in the menu index anyways. 2 1 Quote Link to comment Share on other sites More sharing options...
ProjectPact Posted July 29, 2018 Share Posted July 29, 2018 (edited) Why not use a Map with both the object and the action as strings or an Enum? P.S - You have a perfect narrator's voice. Edited July 29, 2018 by ProjectPact 1 1 Quote Link to comment Share on other sites More sharing options...
Explv Posted July 29, 2018 Share Posted July 29, 2018 I like ur voice fren, and nice video, A+ 2 minutes ago, ProjectPact said: Why not use a Map with both the object and the action as strings or an Enum? P.S - You have a perfect narrator's voice. Cuz it's for beginner noobs 1 1 Quote Link to comment Share on other sites More sharing options...
R3G3N Posted July 29, 2018 Share Posted July 29, 2018 Very nice video!! 1 Quote Link to comment Share on other sites More sharing options...
Eliot Posted July 29, 2018 Author Share Posted July 29, 2018 Thanks for the feedback friends. The code certainly isn't perfect, but it's definitely a good starting point and demonstrates the simplicity of some scripts! I've added the source code to the original post. Some things for aspiring script writers to try and add on: Make the bot pick up marks of grace Make the bot eat food if it becomes damaged 2 1 Quote Link to comment Share on other sites More sharing options...
DeadPk3r Posted July 29, 2018 Share Posted July 29, 2018 Well done nice to see tutorials and such come out. Quote Link to comment Share on other sites More sharing options...
Alek Posted July 30, 2018 Share Posted July 30, 2018 1 hour ago, ProjectPact said: Why not use a Map with both the object and the action as strings or an Enum? P.S - You have a perfect narrator's voice. Arrays are a smaller data structure, also easier to understand as a beginner. 1 Quote Link to comment Share on other sites More sharing options...
nickatina Posted July 30, 2018 Share Posted July 30, 2018 This is an awesome tutorial, I'm new to programming with java and would like to start scripting for some projects. If anyone wants a good book to learn java, I've found this one pretty useful: http://greenteapress.com/thinkjava6/thinkjava.pdf Quote Link to comment Share on other sites More sharing options...
DuckyQ Posted July 30, 2018 Share Posted July 30, 2018 Good tutorial, I have been thinking about doing a little series or weekly scripting sessions where I either stream or post a walk through. My idea is just to try and get as many people involved as I can. Quote Link to comment Share on other sites More sharing options...
Rex93 Posted July 30, 2018 Share Posted July 30, 2018 This is super cool, thanks for sharing! Quote Link to comment Share on other sites More sharing options...
Eliot Posted July 30, 2018 Author Share Posted July 30, 2018 A couple more ideas I have are a code review series where I go over someone's script and offer advice, etc. Also a "What is antiban?" video I think @Alek would get a kick out of. 1 Quote Link to comment Share on other sites More sharing options...
Alek Posted July 30, 2018 Share Posted July 30, 2018 58 minutes ago, Eliot said: A couple more ideas I have are a code review series where I go over someone's script and offer advice, etc. Also a "What is antiban?" video I think @Alek would get a kick out of. I'd prove that we can convert a script into a two tape turing machine which is reducible to an NFA. Quote Link to comment Share on other sites More sharing options...