TheScripter 0 Share Posted July 13, 2019 Im a brand new person when it comes to learning java, and am trying to learn the ropes as a hobby. I recently just started to try and make my own bot with a little help from tutorials and other websites that teach you java. That being, the script is a pump furnace script that just clicks once on the pump and clicks on a random location(emotes is my preferred choice) every 2-3 minutes eventually leading up to an hour, until moving one tile away to repeat the process by clicking on the pump. This is what i got so far, but if someone if is willing to help steer me in the right direction, it would be greatly appreciated. I have it clicking the furnace all great, but now am wondering how i can make it click a random location every 2-3 mins leading up to an hour, until repeating the process. Thanks in advance, @Override public int onLoop() { GameObject pump = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Pump")); if (pump.interact("Operate")); { int xpLog = getSkillTracker().getGainedExperiencePerHour(Skill.STRENGTH); sleepUntil(() -> getSkillTracker().getStartExperience(Skill.STRENGTH) > xpLog, 120000); } return 1000; } Link to comment Share on other sites More sharing options...
depwession 26 Share Posted July 13, 2019 (edited) idk if there is a more efficient way but you could just set an Area and use getWalking.walk(area).getRandomTile (I think that's the right line if not its something like that) then sleep for whatever amount of seconds before you have it repeat Or if you mean location as in tabs getTabs would be the way to go Edited July 13, 2019 by depwession cat on keyboard make me illiterate :) Link to comment Share on other sites More sharing options...
TheScripter 0 Author Share Posted July 13, 2019 6 hours ago, depwession said: idk if there is a more efficient way but you could just set an Area and use getWalking.walk(area).getRandomTile (I think that's the right line if not its something like that) then sleep for whatever amount of seconds before you have it repeat Or if you mean location as in tabs getTabs would be the way to go Yeah that is the next step i'm taking but how would i go about making the script repeatedly click a location (ex. clicking on a random emote) since if you don't, the bot will stop and log you out. This can be done for up to 1 hour, then stops granting you xp. Link to comment Share on other sites More sharing options...
depwession 26 Share Posted July 13, 2019 3 hours ago, TheScripter said: Yeah that is the next step i'm taking but how would i go about making the script repeatedly click a location (ex. clicking on a random emote) since if you don't, the bot will stop and log you out. This can be done for up to 1 hour, then stops granting you xp. I've never done anything with emotes so assuming there is nothing within the api to interact with emotes randomly you could do something like int random = Calculations.random(1,10); //I don't remember if its .random() or not but its something like that if(random <= 5) { do this emote } else if(random <=10) { do that emote } If there is no emote interaction at all within the api do the same thing but just set Rectangle's for each emote. I'm sure there is emote interaction but again I've never used it so if anyone has any better methods please share! Link to comment Share on other sites More sharing options...
Koschei 147 Share Posted July 14, 2019 Link for the Emote Class of the Javadocs page. https://dreambot.org/javadocs/org/dreambot/api/methods/emotes/Emotes.html Example of doing a random emote: if (getEmotes().isTabOpen()){ if (getEmotes().doRandomEmote()){ return 1000; } } else { if (getEmotes().openTab()){ sleepUntil(()-> getEmotes().isTabOpen(),5000); } } depwession 1 Link to comment Share on other sites More sharing options...
TheScripter 0 Author Share Posted July 14, 2019 3 hours ago, Koschei said: Link for the Emote Class of the Javadocs page. https://dreambot.org/javadocs/org/dreambot/api/methods/emotes/Emotes.html Example of doing a random emote: if (getEmotes().isTabOpen()){ if (getEmotes().doRandomEmote()){ return 1000; } } else { if (getEmotes().openTab()){ sleepUntil(()-> getEmotes().isTabOpen(),5000); } } Thank you!!!! 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