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
  • Can't get the Emotes to open up (should i use widgets instead?)


    TheScripter

    Recommended Posts

    I am able to get my bot to click on the pump but can't get it to open the emote tabs and start clickin. Heres my code so far,

    package Pumpfurn;
    
    import org.dreambot.api.methods.emotes.Emotes;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.Timer;
    import org.dreambot.api.wrappers.interactive.GameObject;
    
    @ScriptManifest(category = Category.COMBAT, name = "TS Furnace", author = "TheScripter", version = 0.01)
    public abstract class StrXp extends AbstractScript {
    
        private int state;
        private GameObject pump;
        Timer timer;
        private long hour = 3600000;
    
        @Override
        public Emotes getEmotes() {
    
            return super.getEmotes();
        }
    
        @Override
        public void onStart() {
            timer = new Timer();
            super.onStart();
        }
    
    
        @Override
        public int onLoop() {
    
            timer.setRunTime(20000);
    
            if (state == 0) {
                operate();
            } else if (state == 1) {
                clickemote();
            } else if (state == 2) {
                resettile();
            }
    
            return 4000;
        }
    
        private void operate() {
            if (!getLocalPlayer().isAnimating()) {
                pump = getGameObjects().closest(f -> f.getName().contains("Pump"));
                if (pump != null) {
                    pump.interact("Operate");
    
                } else {
                    state = 1;
                }
            }
        }
    
        private void clickemote() {
            if (getLocalPlayer().isAnimating()) {
                if (getEmotes().isTabOpen()) {
                    if (getEmotes().doRandomEmote()) {
                        sleepUntil(() -> timer.remaining() >= hour, 5000);
                    } else {
                        if (getEmotes().openTab()) {
                            sleepUntil(() -> getEmotes().isTabOpen(), 5000);
                        } else {
                            if (timer.remaining() == 3600000) {
                                state = 2;
                            }
                        }
                    }
                }
            }
        }
    Link to comment
    Share on other sites

    package Training;
    
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.Timer;
    import org.dreambot.api.wrappers.interactive.GameObject;
    
    import java.awt.*;
    
    @ScriptManifest(category = Category.AGILITY, name ="Timer" , author ="" , version = 1)
    public class Timerzinho extends AbstractScript {
    
    
        private int state;
        private GameObject pump;
        Timer timer;
        private long hour = 3600000;
    
        @Override
        public void onStart(String... strings) {
            timer.setRunTime(hour);
    
        }
    
        @Override
        public int onLoop() {
    
            if (state == 0) {
                operate();
            } else if (state == 1) {
                clickemote();
            } else if (state == 2) {
               // resettile();
            }
            return 500;
        }
    
        private void operate() {
            if (!getLocalPlayer().isAnimating()) {
                pump = getGameObjects().closest(f -> f.getName().contains("Pump"));
                if (pump != null) {
                    pump.interact("Operate");
    
                } else {
                    state = 1;
                }
            }
        }
    
        private void clickemote() {
            if (getLocalPlayer().isAnimating()) {
                if (getEmotes().isTabOpen()){
                    if (getEmotes().doRandomEmote()) {
                        sleepUntil(() -> timer.remaining() >= hour, 5000);
                    } else {
                        if (getEmotes().openTab()) {
                            sleepUntil(() -> getEmotes().isTabOpen(), 5000);
                        } else {
                            if (timer.remaining() == 3600000) {
                                state = 2;
                            }
                        }
                    }
                }
            }
        }
    
    
    
    }
    
    Link to comment
    Share on other sites

    43 minutes ago, henrique190 said:
    
    package Training;
    
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.Timer;
    import org.dreambot.api.wrappers.interactive.GameObject;
    
    import java.awt.*;
    
    @ScriptManifest(category = Category.AGILITY, name ="Timer" , author ="" , version = 1)
    public class Timerzinho extends AbstractScript {
    
    
        private int state;
        private GameObject pump;
        Timer timer;
        private long hour = 3600000;
    
        @Override
        public void onStart(String... strings) {
            timer.setRunTime(hour);
    
        }
    
        @Override
        public int onLoop() {
    
            if (state == 0) {
                operate();
            } else if (state == 1) {
                clickemote();
            } else if (state == 2) {
               // resettile();
            }
            return 500;
        }
    
        private void operate() {
            if (!getLocalPlayer().isAnimating()) {
                pump = getGameObjects().closest(f -> f.getName().contains("Pump"));
                if (pump != null) {
                    pump.interact("Operate");
    
                } else {
                    state = 1;
                }
            }
        }
    
        private void clickemote() {
            if (getLocalPlayer().isAnimating()) {
                if (getEmotes().isTabOpen()){
                    if (getEmotes().doRandomEmote()) {
                        sleepUntil(() -> timer.remaining() >= hour, 5000);
                    } else {
                        if (getEmotes().openTab()) {
                            sleepUntil(() -> getEmotes().isTabOpen(), 5000);
                        } else {
                            if (timer.remaining() == 3600000) {
                                state = 2;
                            }
                        }
                    }
                }
            }
        }
    
    
    
    }
    

    Thank you so much for helping me with my script man. Rapid response as well!

    have you tried it out yourself? I added the corrections you gave me and still got no results on the opening tab part.

    Link to comment
    Share on other sites

    52 minutes ago, TheScripter said:

    Yeah i updated everything. have you tried it yourself? maybe im missing somethin

    From looking at the code it seems to be from your operate loop 

            if (!getLocalPlayer().isAnimating()) {
                pump = getGameObjects().closest(f -> f.getName().contains("Pump"));
                if (pump != null) {
                    pump.interact("Operate");
    
                } else {
                    state = 1;
                }
            }

    As it can't change the state to 1, since the player will be animating after it interacts with the pump gameobject. Then, once it's done animating it the gameobject won't be null anymore causing it to just keep operating it.

    Link to comment
    Share on other sites

    44 minutes ago, Koschei said:

    From looking at the code it seems to be from your operate loop 

    
            if (!getLocalPlayer().isAnimating()) {
                pump = getGameObjects().closest(f -> f.getName().contains("Pump"));
                if (pump != null) {
                    pump.interact("Operate");
    
                } else {
                    state = 1;
                }
            }

    As it can't change the state to 1, since the player will be animating after it interacts with the pump gameobject. Then, once it's done animating it the gameobject won't be null anymore causing it to just keep operating it.

    ah i see your point that your trying to make.

    is there an exception i can add to my else if statement? that continue my loop onto the next?

    i was thinking about putting something inside the isAnimating() condition, but not sure what would work.

    Link to comment
    Share on other sites

    2 minutes ago, TheScripter said:

    ah i see your point that your trying to make.

    is there an exception i can add to my else if statement? that continue my loop onto the next?

    i was thinking about putting something inside the isAnimating() condition, but not sure what would work.

    What you could do is instead is just simply check if the timer has run out, if so change the state, if not then interact normally. I believe that should work since you're trying to do an emote every hour or something correct?

    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.