Runeplug Posted January 14, 2021 Share Posted January 14, 2021 Hi Guys, trying to get my high alcher script to work... here is code below. Its getting to the right state get high alch selected then just hovers in inventory.... IF i pause script it then clicks once and alchs once! I am really confused I have tried a combination of interactions also tried getInventory().getItem("Maple longbow").interact("Cast"); didnt work either... Please help pulling my hair out if (currentState == State.HIGH_ALCH) { getMagic().castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY); new ConditionalSleep(random(30000, 100000)) { @Override public boolean condition() throws InterruptedException { return !getTabs().magic.isSpellSelected(); } }.sleep(); // sleep untill magic tab isnt open getInventory().interact("Cast", MAPLE_LONG_BOW_ID_NOTED); Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted January 14, 2021 Share Posted January 14, 2021 2 hours ago, mcpimpen said: if (currentState == State.HIGH_ALCH) { getMagic().castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY); new ConditionalSleep(random(30000, 100000)) { @Override public boolean condition() throws InterruptedException { return !getTabs().magic.isSpellSelected(); } }.sleep(); // sleep untill magic tab isnt open getInventory().interact("Cast", MAPLE_LONG_BOW_ID_NOTED); You are sleeping for 30 to 100 seconds after you have selected the alch spell. Do a sleep until the inventory is visible, than interact with the item. Quote Link to comment Share on other sites More sharing options...
Runeplug Posted January 14, 2021 Author Share Posted January 14, 2021 Hi Bravo Taco, cheers for reply. the sleep is set so it doesnt start casting high alch again.. the issue I am having is its not interacting with the longbow at all as far as I am aware there is no code stopping that? I guess my question is does the below make sense? or is there a different way I should be selecting / interacting with the bows AFTER high alch has already been selected. getInventory().interact("Cast", MAPLE_LONG_BOW_ID_NOTED); Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted January 14, 2021 Share Posted January 14, 2021 (edited) 24 minutes ago, mcpimpen said: Hi Bravo Taco, cheers for reply. the sleep is set so it doesnt start casting high alch again.. the issue I am having is its not interacting with the longbow at all as far as I am aware there is no code stopping that? I guess my question is does the below make sense? or is there a different way I should be selecting / interacting with the bows AFTER high alch has already been selected. getInventory().interact("Cast", MAPLE_LONG_BOW_ID_NOTED); Also just tested your code, It is the sleep you are using causing the script to not interact with your inventory item. This is what I tested. getMagic().castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY); new ConditionalSleep(random(30000, 100000)) { @Override public boolean condition() throws InterruptedException { return !getTabs().magic.isSpellSelected(); } }.sleep(); // sleep untill magic tab isnt open getInventory().interact("Cast", "Feather"); Than I removed the sleep. getMagic().castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY); // sleep untill magic tab isnt open getInventory().interact("Cast", "Feather"); This allowed it to work. Also, It will work even with the sleep, but again it will take 30-100 seconds before it will interact with the item in the inventory. Also you should use if statements on those calls so you can do other things based on if they were performed or not. if (getMagic().castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY)) { if (getInventory().interact("Cast", "Feather")) { // Do sleeps here } } Edited January 14, 2021 by BravoTaco Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted January 14, 2021 Share Posted January 14, 2021 (edited) Didn't mean to repost this lol. Meant to edit the old one. Edited January 14, 2021 by BravoTaco Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted January 14, 2021 Share Posted January 14, 2021 (edited) 3 hours ago, mcpimpen said: Hi Bravo Taco, cheers for reply. the sleep is set so it doesnt start casting high alch again.. the issue I am having is its not interacting with the longbow at all as far as I am aware there is no code stopping that? I guess my question is does the below make sense? or is there a different way I should be selecting / interacting with the bows AFTER high alch has already been selected. getInventory().interact("Cast", MAPLE_LONG_BOW_ID_NOTED); After interacting with the items just add another contional sleep to wait until it's back to magic tab ^^ You also have a small logic issue in your script, will make it pretty unstable if (currentState == State.HIGH_ALCH) { if (s.getTabs().getOpen() == Tab.MAGIC) { if(getMagic().castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY)){ new ConditionalSleep(2500) { @Override public boolean condition() throws InterruptedException { return s.getTabs().getOpen() == Tab.INVENTORY; } }.sleep(); } }else{ if(getInventory().interact("Cast", MAPLE_LONG_BOW_ID_NOTED)){ new ConditionalSleep(2500) { @Override public boolean condition() throws InterruptedException { return s.getTabs().getOpen() == Tab.MAGIC; } }.sleep(); } } } Edited January 14, 2021 by Khaleesi Quote Link to comment Share on other sites More sharing options...
Runeplug Posted January 14, 2021 Author Share Posted January 14, 2021 49 minutes ago, Khaleesi said: After interacting with the items just add another contional sleep to wait until it's back to magic tab ^^ You also have a small logic issue in your script, will make it pretty unstable if (currentState == State.HIGH_ALCH) { if (s.getTabs().getOpen() == Tab.MAGIC) { if(getMagic().castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY)){ new ConditionalSleep(2500) { @Override public boolean condition() throws InterruptedException { return s.getTabs().getOpen() == Tab.INVENTORY; } }.sleep(); } }else{ if(getInventory().interact("Cast", MAPLE_LONG_BOW_ID_NOTED)){ new ConditionalSleep(2500) { @Override public boolean condition() throws InterruptedException { return s.getTabs().getOpen() == Tab.MAGIC; } }.sleep(); } } } Thanks Kahaleesi, Ill look at this in morning and rework... currently I had chnaged it to if (currentState == State.HIGH_ALCH) { getMagic().castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY); getInventory().interact("Cast", MAPLE_LONG_BOW_ID_NOTED); sleep(random(344,453)); Which works but obviously not best way around it.... I was previously using the tab method but kept getting a error when trying to == it to INVENTORY... I have very limited knowledge this is my first script so thanks for being patient... I am like 2 days into learning scripting / code. Thanks Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted January 14, 2021 Share Posted January 14, 2021 1 hour ago, mcpimpen said: Thanks Kahaleesi, Ill look at this in morning and rework... currently I had chnaged it to if (currentState == State.HIGH_ALCH) { getMagic().castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY); getInventory().interact("Cast", MAPLE_LONG_BOW_ID_NOTED); sleep(random(344,453)); Which works but obviously not best way around it.... I was previously using the tab method but kept getting a error when trying to == it to INVENTORY... I have very limited knowledge this is my first script so thanks for being patient... I am like 2 days into learning scripting / code. Thanks Well you learn by doing it Quote Link to comment Share on other sites More sharing options...