Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!
RuneMate will permanently shut down on August 7, 2026
due to events outside our control. You can continue using RuneMate until this date after which it will no longer be available. Thank you to everyone that contributed to RuneMate's success and to the community for the opportunity to serve you all these years.

  • Learn about RuneMate Vault and how its zero knowledge local encryption already protects your sensitive information.
  • Edit or delete your RuneMate account from your Account Settings.
  • All account upgrade subscriptions have been cancelled. No action required.

Question How to use a SpriteItem on a GameObject

Joined
Apr 8, 2018
Messages
45
I'm trying to use air runes on an altar but the bot clicks on the air runes and doesn't use them on the altar.

Code:
import com.runemate.game.api.hybrid.entities.GameObject;
import com.runemate.game.api.hybrid.local.hud.interfaces.SpriteItem;
public class Test extends LoopingBot {
    GameObject altar;
    SpriteItem air_rune;
    public static boolean used = false;
    @Override
    public void onStart(String... args){
        setLoopDelay(400,800);
    }
    @Override
    public void onLoop(){
        air_rune = Inventory.newQuery().names("Air rune").results().first();
        altar = GameObjects.newQuery().names("Altar").results().nearest();
        if(air_rune!=null && used == false){
            air_rune.interact("Use");
            used = true;
        } else if(altar!=null){
            air_rune.interact("Use", air_rune.getDefinition().getName() + " -> " + altar);
            used = false;
        }
    }
}
 
Joined
Nov 24, 2017
Messages
8
Code:
airRune = Inventory.newQuery().names("Air rune").results().first();
        if(airRune != null) {
            if(airRune.interact("Use","Earth rune")) {
                Execution.delayUntil(()->Inventory.getSelectedItem() != null,1000,1500);
                altar = GameObjects.newQuery().names("Altar").results().first();
                if(altar != null) {
                    if(altar.interact("Use", airRune.getDefinition().getName() + " -> " + altar.getDefinition().getName())) {
                        Execution.delayUntil(()->Inventory.newQuery().names("Pure essence").results().size() == 0,750,1050);
                        getLogger().debug("....");
                    }
                    else {
                        getLogger().debug("Failed to interact with altar..."); //Edited after CuppaJava's comment
                    }
                }
                else {
                    getLogger().debug("Couldnt find altar");
                }
            }
            else {
                getLogger().debug("Failed to interact with rune...");
            }
        }
        else {
            getLogger().debug("Couldn't find air rune");
        }
 
Last edited:
cuppa.drink(java);
Joined
Mar 13, 2018
Messages
9,257
Code:
airRune = Inventory.newQuery().names("Air rune").results().first();
        if(airRune != null) {
            if(airRune.interact("Use","Earth rune")) {
                Execution.delayUntil(()->Inventory.getSelectedItem() != null,1000,1500);
                altar = GameObjects.newQuery().names("Altar").results().first();
                if(altar != null) {
                    if(altar.interact("Use", airRune.getDefinition().getName() + " -> " + altar.getDefinition().getName())) {
                        Execution.delayUntil(()->Inventory.newQuery().names("Pure essence").results().size() == 0,750,1050);
                        getLogger().debug("....");
                    }
                    else {
                        getLogger().debug("Missclicked altar...");
                    }
                }
                else {
                    getLogger().debug("Couldnt find altar");
                }
            }
            else {
                getLogger().debug("Missclicked rune...");
            }
        }
        else {
            getLogger().debug("Couldn't find air rune");
        }

Just for the record, the logs aren't accurate. For example, line 7:
Code:
altar.interact("Use", airRune.getDefinition().getName() + " -> " + altar.getDefinition().getName())
If this interact() returns false, that doesn't (necessarily) mean it was misclicked, it could also mean the action wasn't totally completed. Eg. interact() could return false if the mouse was still moving towards the altar but not yet completed moving/clcking before that specific bot loop was over. This is so that the bot knows to continue attempting to interact() next iteration of the bot loop.
 
Joined
Nov 24, 2017
Messages
8
Just for the record, the logs aren't accurate. For example, line 7:
Code:
altar.interact("Use", airRune.getDefinition().getName() + " -> " + altar.getDefinition().getName())
If this interact() returns false, that doesn't (necessarily) mean it was misclicked, it could also mean the action wasn't totally completed. Eg. interact() could return false if the mouse was still moving towards the altar but not yet completed moving/clcking before that specific bot loop was over. This is so that the bot knows to continue attempting to interact() next iteration of the bot loop.
Ahh I didn't know that, thanks for the input.
 
Top