Void Posted May 7, 2017 Share Posted May 7, 2017 https://gyazo.com/0ed02a1a00f07dce19b9301293d63666 Hi, I'm wondering if the level up widget for every level is the same? Currently my flax spinner stops spinning flax whenever the level up screen shows; as it stops animating. Current code: https://hastebin.com/aqajeliyuj.java I'm wondering if I can just say something like: https://hastebin.com/abiberiqer.java Basically - is the widget for levelling up any skills ALWAYS the same; or does it vary? So level 13 crafting will be different to level 14? If so; how do I ask the bot to continue it's task after it's levelled up? Thanks Quote Link to comment Share on other sites More sharing options...
Charlotte Posted May 7, 2017 Share Posted May 7, 2017 if (!myPlayer().isAnimating() && getInventory().contains("Flax")) repeat action Quote Link to comment Share on other sites More sharing options...
Explv Posted May 7, 2017 Share Posted May 7, 2017 (edited) 9 minutes ago, Void said: I'm wondering if the level up widget for every level is the same? Just sleep until either the inventory does not contain flax, or the dialog is pending continue: return !getInventory().contains("Flax") || getDialogue().isPendingContinuation(); Edited May 7, 2017 by Explv 1 Quote Link to comment Share on other sites More sharing options...
Saiyan Posted May 7, 2017 Share Posted May 7, 2017 Either check if your not animating or your player animation is the standard idle animation and check if you still have flax and i think the level up is a dialogue not a interface? Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted May 7, 2017 Share Posted May 7, 2017 15 minutes ago, Explv said: Just sleep until either the inventory does not contain flax, or the dialog is pending continue: return !getInventory().contains("Flax") || getDialogue().isPendingContinuation(); This will work the best, because animating won't stop instantly after leveling up or after your inventory doesn't contain flax anymore. Quote Link to comment Share on other sites More sharing options...
Butters Posted May 7, 2017 Share Posted May 7, 2017 Explv option is probably the best, thouh another simple way to handle it would be to if (dialogues.isPendingContinuation()) dialogues.clickContinue(); Quote Link to comment Share on other sites More sharing options...
Void Posted May 8, 2017 Author Share Posted May 8, 2017 (edited) On 2017-5-7 at 0:38 PM, Charlotte said: if (!myPlayer().isAnimating() && getInventory().contains("Flax")) repeat action On 2017-5-7 at 0:57 PM, The Undefeated said: This will work the best, because animating won't stop instantly after leveling up or after your inventory doesn't contain flax anymore. On 2017-5-7 at 0:42 PM, Explv said: Just sleep until either the inventory does not contain flax, or the dialog is pending continue: return !getInventory().contains("Flax") || getDialogue().isPendingContinuation(); On 2017-5-7 at 0:49 PM, Saiyan said: Either check if your not animating or your player animation is the standard idle animation and check if you still have flax and i think the level up is a dialogue not a interface? On 2017-5-7 at 1:21 PM, nosepicker said: Explv option is probably the best, thouh another simple way to handle it would be to if (dialogues.isPendingContinuation()) dialogues.clickContinue(); Thanks everyone Got it working now. How would you add it to repeat a certain part of a task based script? So if (dialogues.isPendingContinuation()) dialogues.clickContinue(); repeat // - how to make it repeat the below until the return is met for final condition? api.getObjects().closest("Spinning wheel").interact("Spin"); api.log("Interacting with Spinning wheel.."); new ConditionalSleep(MethodProvider.random(2000,3000)) { public boolean condition() throws InterruptedException { return api.getWidgets().isVisible(459, 93); } }.sleep(); api.getWidgets().getWidgetContainingText("Bow String").interact("Make X"); MethodProvider.sleep(900); api.getKeyboard().typeString("" + MethodProvider.random(31, 283)); api.log("Starting to spin Flax...."); new ConditionalSleep(MethodProvider.random(80000,110000)) { public boolean condition() throws InterruptedException { return !api.getInventory().contains("Flax") && !api.myPlayer().isAnimating() && api.getInventory().onlyContains("Bow string"); } }.sleep(); Currently I just have a class called "pending" which states Edited May 8, 2017 by Void Quote Link to comment Share on other sites More sharing options...
progamerz Posted May 8, 2017 Share Posted May 8, 2017 10 minutes ago, Void said: Thanks everyone Got it working now. How would you add it to repeat a certain part of a task based script? So if (dialogues.isPendingContinuation()) dialogues.clickContinue(); repeat // - how to make it repeat the below until the return is met for final condition? api.getObjects().closest("Spinning wheel").interact("Spin"); api.log("Interacting with Spinning wheel.."); new ConditionalSleep(MethodProvider.random(2000,3000)) { public boolean condition() throws InterruptedException { return api.getWidgets().isVisible(459, 93); } }.sleep(); api.getWidgets().getWidgetContainingText("Bow String").interact("Make X"); MethodProvider.sleep(900); api.getKeyboard().typeString("" + MethodProvider.random(31, 283)); api.log("Starting to spin Flax...."); new ConditionalSleep(MethodProvider.random(80000,110000)) { public boolean condition() throws InterruptedException { return !api.getInventory().contains("Flax") && !api.myPlayer().isAnimating() && api.getInventory().onlyContains("Bow string"); } }.sleep(); Currently I just have a class called "pending" which states You have to use if statements as currently if any thing happens it may glitch the script Quote Link to comment Share on other sites More sharing options...
progamerz Posted May 8, 2017 Share Posted May 8, 2017 if (dialogues.isPendingContinuation()){ dialogues.clickContinue(); } else if (!getWidgets().isVisible(459, 93)) { getObjects().closest("Spinning wheel").interact("Spin"); log("Interacting with Spinning wheel.."); new ConditionalSleep(MethodProvider.random(2000, 3000)) { public boolean condition() throws InterruptedException { return getWidgets().isVisible(459, 93); } }.sleep(); } else if (getWidgets().getWidgetContainingText("Bow String") != null) { getWidgets().getWidgetContainingText("Bow String").interact("Make X"); new ConditionalSleep(MethodProvider.random(2000, 3000)) { public boolean condition() throws InterruptedException { return getWidgets().getWidgetContainingText("Enter amount:") != null //check the text not sure if i wrote correctly && getWidgets().getWidgetContainingText("Enter amount:").isVisible(); } }.sleep(); } else if (getWidgets().getWidgetContainingText("Enter amount:") != null //check the text not sure if i wrote correctly && getWidgets().getWidgetContainingText("Enter amount:").isVisible()) { getKeyboard().typeString("" + MethodProvider.random(31, 283)); log("Starting to spin Flax...."); new ConditionalSleep(MethodProvider.random(80000, 110000)) { public boolean condition() throws InterruptedException { return getInventory().contains("Flax") && !myPlayer().isAnimating() && getInventory().onlyContains("Bow string"); } }.sleep(); } Not sure if that works try it out Quote Link to comment Share on other sites More sharing options...
Void Posted May 8, 2017 Author Share Posted May 8, 2017 3 hours ago, progamerz said: if (dialogues.isPendingContinuation()){ dialogues.clickContinue(); } else if (!getWidgets().isVisible(459, 93)) { getObjects().closest("Spinning wheel").interact("Spin"); log("Interacting with Spinning wheel.."); new ConditionalSleep(MethodProvider.random(2000, 3000)) { public boolean condition() throws InterruptedException { return getWidgets().isVisible(459, 93); } }.sleep(); } else if (getWidgets().getWidgetContainingText("Bow String") != null) { getWidgets().getWidgetContainingText("Bow String").interact("Make X"); new ConditionalSleep(MethodProvider.random(2000, 3000)) { public boolean condition() throws InterruptedException { return getWidgets().getWidgetContainingText("Enter amount:") != null //check the text not sure if i wrote correctly && getWidgets().getWidgetContainingText("Enter amount:").isVisible(); } }.sleep(); } else if (getWidgets().getWidgetContainingText("Enter amount:") != null //check the text not sure if i wrote correctly && getWidgets().getWidgetContainingText("Enter amount:").isVisible()) { getKeyboard().typeString("" + MethodProvider.random(31, 283)); log("Starting to spin Flax...."); new ConditionalSleep(MethodProvider.random(80000, 110000)) { public boolean condition() throws InterruptedException { return getInventory().contains("Flax") && !myPlayer().isAnimating() && getInventory().onlyContains("Bow string"); } }.sleep(); } Not sure if that works try it out Thanks works well but if (api.dialogues.isPendingContinuation()){ api.dialogues.clickContinue(); doesn't work whatsoever; if the dialogue appears it is completely ignored. I can't work out why. I've also tried adding if (api.dialogues.isPendingContinuation()){ api.dialogues.clickContinue(); } else if (api.dialogues.isPendingContinuation()) { api.dialogues.clickContinue(); api.log("Walking to spin room"); new ConditionalSleep(MethodProvider.random(10000,13000)) { public boolean condition() throws InterruptedException { return !api.dialogues.isPendingContinuation(); } }.sleep(); The script still just stops there. Quote Link to comment Share on other sites More sharing options...
progamerz Posted May 8, 2017 Share Posted May 8, 2017 (edited) 9 minutes ago, Void said: Thanks works well but if (api.dialogues.isPendingContinuation()){ api.dialogues.clickContinue(); doesn't work whatsoever; if the dialogue appears it is completely ignored. I can't work out why. I've also tried adding if (api.dialogues.isPendingContinuation()){ api.dialogues.clickContinue(); } else if (api.dialogues.isPendingContinuation()) { api.dialogues.clickContinue(); api.log("Walking to spin room"); new ConditionalSleep(MethodProvider.random(10000,13000)) { public boolean condition() throws InterruptedException { return !api.dialogues.isPendingContinuation(); } }.sleep(); The script still just stops there. new ConditionalSleep(MethodProvider.random(80000, 110000)) { public boolean condition() throws InterruptedException { return (!getInventory().contains("Flax") || !myPlayer().isAnimating() || api.dialogues.isPendingContinuation()) || getInventory().onlyContains("Bow string"); } }.sleep(); Try this instead of: 9 minutes ago, Void said: new ConditionalSleep(MethodProvider.random(80000, 110000)) { public boolean condition() throws InterruptedException { return getInventory().contains("Flax") && !myPlayer().isAnimating() && getInventory().onlyContains("Bow string"); } }.sleep(); And remove this: 9 minutes ago, Void said: if (dialogues.isPendingContinuation()){ dialogues.clickContinue(); } else So the final code for this task will be: if (!getWidgets().isVisible(459, 93)) { getObjects().closest("Spinning wheel").interact("Spin"); log("Interacting with Spinning wheel.."); new ConditionalSleep(MethodProvider.random(2000, 3000)) { public boolean condition() throws InterruptedException { return getWidgets().isVisible(459, 93); } }.sleep(); } else if (getWidgets().getWidgetContainingText("Bow String") != null) { getWidgets().getWidgetContainingText("Bow String").interact("Make X"); new ConditionalSleep(MethodProvider.random(2000, 3000)) { public boolean condition() throws InterruptedException { return getWidgets().getWidgetContainingText("Enter amount:") != null //check the text not sure if i wrote correctly && getWidgets().getWidgetContainingText("Enter amount:").isVisible(); } }.sleep(); } else if (getWidgets().getWidgetContainingText("Enter amount:") != null //check the text not sure if i wrote correctly && getWidgets().getWidgetContainingText("Enter amount:").isVisible()) { getKeyboard().typeString("" + MethodProvider.random(31, 283)); log("Starting to spin Flax...."); new ConditionalSleep(MethodProvider.random(80000, 110000)) { public boolean condition() throws InterruptedException { return (!getInventory().contains("Flax") || !myPlayer().isAnimating() || api.dialogues.isPendingContinuation()); } }.sleep(); } And make another task which handles Dialogues seperately with the logic: Validate : If is dialogue is pending continuation Process : click continue Edited May 8, 2017 by progamerz Quote Link to comment Share on other sites More sharing options...
Void Posted May 8, 2017 Author Share Posted May 8, 2017 (edited) 12 minutes ago, progamerz said: new ConditionalSleep(MethodProvider.random(80000, 110000)) { public boolean condition() throws InterruptedException { return (!getInventory().contains("Flax") || !myPlayer().isAnimating() || api.dialogues.isPendingContinuation()) || getInventory().onlyContains("Bow string"); } }.sleep(); Try this instead of: And remove this: So the final code for this task will be: if (!getWidgets().isVisible(459, 93)) { getObjects().closest("Spinning wheel").interact("Spin"); log("Interacting with Spinning wheel.."); new ConditionalSleep(MethodProvider.random(2000, 3000)) { public boolean condition() throws InterruptedException { return getWidgets().isVisible(459, 93); } }.sleep(); } else if (getWidgets().getWidgetContainingText("Bow String") != null) { getWidgets().getWidgetContainingText("Bow String").interact("Make X"); new ConditionalSleep(MethodProvider.random(2000, 3000)) { public boolean condition() throws InterruptedException { return getWidgets().getWidgetContainingText("Enter amount:") != null //check the text not sure if i wrote correctly && getWidgets().getWidgetContainingText("Enter amount:").isVisible(); } }.sleep(); } else if (getWidgets().getWidgetContainingText("Enter amount:") != null //check the text not sure if i wrote correctly && getWidgets().getWidgetContainingText("Enter amount:").isVisible()) { getKeyboard().typeString("" + MethodProvider.random(31, 283)); log("Starting to spin Flax...."); new ConditionalSleep(MethodProvider.random(80000, 110000)) { public boolean condition() throws InterruptedException { return (!getInventory().contains("Flax") || !myPlayer().isAnimating() || api.dialogues.isPendingContinuation()); } }.sleep(); } And make another task which handles Dialogues seperately with the logic: Validate : If is dialogue is pending continuation Process : click continue Ok thanks! I'll let you know Edited May 8, 2017 by Void 1 Quote Link to comment Share on other sites More sharing options...
Void Posted May 8, 2017 Author Share Posted May 8, 2017 Worked great Thanks everyone for help. 1 Quote Link to comment Share on other sites More sharing options...