Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Need help please! New Scripter here :)


    TheScripter

    Recommended Posts

    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

    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

    Link to comment
    Share on other sites

    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

    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

    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);
                }
            }
    Link to comment
    Share on other sites

    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

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.