TheScripter 0 Share Posted July 17, 2019 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 More sharing options...
henrique190 7 Share Posted July 17, 2019 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 More sharing options...
TheScripter 0 Author Share Posted July 18, 2019 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 More sharing options...
henrique190 7 Share Posted July 18, 2019 you removed the meted getEmotes in your main? Link to comment Share on other sites More sharing options...
henrique190 7 Share Posted July 18, 2019 method* Link to comment Share on other sites More sharing options...
TheScripter 0 Author Share Posted July 18, 2019 Yeah i updated everything. have you tried it yourself? maybe im missing somethin Link to comment Share on other sites More sharing options...
henrique190 7 Share Posted July 18, 2019 I cant, if you send the account for me test , i do for you If this notworking, use widgets to open emote tab Link to comment Share on other sites More sharing options...
Koschei 147 Share Posted July 18, 2019 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 More sharing options...
TheScripter 0 Author Share Posted July 18, 2019 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 More sharing options...
Koschei 147 Share Posted July 18, 2019 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 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