Welcome!

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

Sign up now!

Question InterfaceWindows.getCombatOptions

Client Developer
Joined
Oct 12, 2015
Messages
3,781
Current available methods are:
InterfaceWindows.getInventory()
..getEquipment()
..getMagic()
..getPrayer()

Should really be a getCombatOptions()/getCombat() to open the following menu:

NepClEt.png

 
@Vaped
 
Further to that, there should also be an option to perform a special attack.

Special attack button: Interfaces.getAt(593, 30)
Special attack % text: Interfaces.getAt(593, 34)

My method to parse spec percentage:
Code:
    public void parseSpecPercentage() {
        String full;
        if (specValue != null) {
            full = Interfaces.getAt(593, 34).getText().replace("Special Attack: ", ""); //Label "Special Attack: x%"
            specPercentage = Integer.valueOf(full.replace("%", ""));
        }
    }

Method to determine if spec is selected:

Code:
            if (!Equipment.containsAnyOf(specWeapon.getItemNames())) {
                if (Inventory.containsAnyOf(specWeapon.getItemNames())) {
                    SpriteItem weapon = Inventory.newQuery().names(specWeapon.getItemNames()).results().first();
                    if (weapon != null) weapon.interact("Wield");
                    Log.info("Equipping spec weapon");
                }
            } else if (specButton != null) {
                if (specButton.isVisible() && specButton.getTextColor().equals(new Color(0, 0, 16))) {
                    specButton.interact("Use Special Attack");
                } else if(!specButton.isVisible()){
                    InterfaceComponent component = Interfaces.getAt(161,44);
                    if(component != null) component.interact("Combat Options");
                }
            }
 
Joined
Dec 10, 2014
Messages
3,332
Current available methods are:
InterfaceWindows.getInventory()
..getEquipment()
..getMagic()
..getPrayer()

Should really be a getCombatOptions()/getCombat() to open the following menu:

NepClEt.png

 
@Vaped
 
Further to that, there should also be an option to perform a special attack.

Special attack button: Interfaces.getAt(593, 30)
Special attack % text: Interfaces.getAt(593, 34)

My method to parse spec percentage:
Code:
    public void parseSpecPercentage() {
        String full;
        if (specValue != null) {
            full = Interfaces.getAt(593, 34).getText().replace("Special Attack: ", ""); //Label "Special Attack: x%"
            specPercentage = Integer.valueOf(full.replace("%", ""));
        }
    }

Method to determine if spec is selected:

Code:
            if (!Equipment.containsAnyOf(specWeapon.getItemNames())) {
                if (Inventory.containsAnyOf(specWeapon.getItemNames())) {
                    SpriteItem weapon = Inventory.newQuery().names(specWeapon.getItemNames()).results().first();
                    if (weapon != null) weapon.interact("Wield");
                    Log.info("Equipping spec weapon");
                }
            } else if (specButton != null) {
                if (specButton.isVisible() && specButton.getTextColor().equals(new Color(0, 0, 16))) {
                    specButton.interact("Use Special Attack");
                } else if(!specButton.isVisible()){
                    InterfaceComponent component = Interfaces.getAt(161,44);
                    if(component != null) component.interact("Combat Options");
                }
            }
OSRSTab.COMBAT_OPTIONS
 
Joined
Feb 12, 2018
Messages
48
Sorry for bumping an old thread, but has there been any progress on this functionality?

CombatOptions could be added as separate interface similar to Inventory / Equipment / Magic / Prayer interfaces.
Would allow easy access to changing combat styles / using special attacks / changing auto-retaliate.

Currently those options are not available, and everyone has to manually track interfaceComponents with corresponding text / id.
 
Joined
Dec 10, 2014
Messages
3,332
Sorry for bumping an old thread, but has there been any progress on this functionality?

CombatOptions could be added as separate interface similar to Inventory / Equipment / Magic / Prayer interfaces.
Would allow easy access to changing combat styles / using special attacks / changing auto-retaliate.

Currently those options are not available, and everyone has to manually track interfaceComponents with corresponding text / id.
Back in the day I did it based on the wielded weapon, not sure if it was dynamic using itemdefinitions or I possibly had it predefined based on matching the weapon name to the combat options.

Edit: I believe there's a gitlab or similar issue tracker you can make these suggestions on now?
 
Last edited:
The Omen
Joined
Dec 27, 2018
Messages
159
Sorry for bumping an old thread, but has there been any progress on this functionality?

CombatOptions could be added as separate interface similar to Inventory / Equipment / Magic / Prayer interfaces.
Would allow easy access to changing combat styles / using special attacks / changing auto-retaliate.

Currently those options are not available, and everyone has to manually track interfaceComponents with corresponding text / id.

Back in the day I did it based on the wielded weapon, not sure if it was dynamic using itemdefinitions or I possibly had it predefined based on matching the weapon name to the combat options.

Edit: I believe there's a gitlab or similar issue tracker you can make these suggestions on now?
Issues · RuneMate · GitLab

To answer the question there's nothing in the API which can help you yet. However you may be aware Runelite offers an Attack Styles alerter if you switch to an undesired style (if a pure switches to defence mode, for example). I'd recommend looking at what they do to see if you can make this yourself and contribute it to the API :) runelite/runelite
 
Top