Jump to content
Sign in to follow this  
pittasium

How to use an item or cast a spell

Recommended Posts

I'm wondering how to tell the bot to teleport to castlewars if the inventory is full and then do a house teleport after depositing the items. I have the Bank Area part already done.

 

Not sure how to go about this as I'm trying to write my first script.

 

Any help is appreciated.

Edited by pittasium

Share this post


Link to post
Share on other sites

That's to teleport back to your home if using spell book when inventory isn't full, haven't got any duel rings to make you the other part.

        if (!client.getInventory().isFull()) {
            magicTab.open();
            magicTab.castSpell(Spell.HOME_TELEPORT);
        }

Share this post


Link to post
Share on other sites

well you will need to write your own method to interact with equipment inside the tab

lucky for you i had the exact same problem so  i wrote a little method to interact with a ring item  in the equipment tab! which i will link below

 

http://osbot.org/forum/topic/7274-interacting-with-equipment/

 

you will put this method inside your script

 

then you will call it as such

interactWithEquipment("STRING",DUEL_RING INT);

as duel rings have many charges and all have separate int's you will need to do a for loop

but i have that in my booleans so i don't worry about that so i use this method to get the id of the ring

   int i = equipmentTab.getItemInSlot(EquipmentSlot.RING).getId();

so you will need a boolean's something that looks like this

    private boolean hasRingOfDuelingEquiped() {
        for (int i : rods) {
            if ((equipmentTab.isWearingItem(EquipmentSlot.RING, i))) {
                return true;
            }
        }
        return false;
    }

Rods is an variable i have set

private final int rods[] = { 2552, 2554, 2556, 2558, 2560, 2562, 2564, 2566 };
    private boolean inventoryHasRing() {
        for (int i : rods) {
            if (client.getInventory().contains(i)) {
                return true;
            }
        }
        return false;
    }

once you have completed this phase you will need another boolean to check if the interface of the duel ring is open and if so you will need to interact with it

sorry i can't spoon fed you anymore of my work hope this helps you!

 

 

 

 

Share this post


Link to post
Share on other sites

well you will need to write your own method to interact with equipment inside the tab

lucky for you i had the exact same problem so  i wrote a little method to interact with a ring item  in the equipment tab! which i will link below

 

http://osbot.org/forum/topic/7274-interacting-with-equipment/

 

you will put this method inside your script

 

then you will call it as such

interactWithEquipment("STRING",DUEL_RING INT);

as duel rings have many charges and all have separate int's you will need to do a for loop

but i have that in my booleans so i don't worry about that so i use this method to get the id of the ring

   int i = equipmentTab.getItemInSlot(EquipmentSlot.RING).getId();

so you will need a boolean's something that looks like this

    private boolean hasRingOfDuelingEquiped() {
        for (int i : rods) {
            if ((equipmentTab.isWearingItem(EquipmentSlot.RING, i))) {
                return true;
            }
        }
        return false;
    }

Rods is an variable i have set

private final int rods[] = { 2552, 2554, 2556, 2558, 2560, 2562, 2564, 2566 };
    private boolean inventoryHasRing() {
        for (int i : rods) {
            if (client.getInventory().contains(i)) {
                return true;
            }
        }
        return false;
    }

once you have completed this phase you will need another boolean to check if the interface of the duel ring is open and if so you will need to interact with it

sorry i can't spoon fed you anymore of my work hope this helps you!

 

way to use the fore each :)

 

lol

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...