Jump to content
mcpimpen

High Alch Not Working.

Recommended Posts

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);

Link to post
Share on other sites
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.

Link to post
Share on other sites

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);
Link to post
Share on other sites
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 by BravoTaco
Link to post
Share on other sites
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 by Khaleesi
Link to post
Share on other sites
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 :)

 

Link to post
Share on other sites
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 😉

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...