Jump to content

Checking Combat Style


Recommended Posts

Posted

How do you check what combat skill is being trained? Upon a cursory check with the widget debugger there does not seem to be a difference in the combat style button widget variables when a said button is selected or not but I am likely missing something. 

The other way I can think of is using the experience tracker to find out which skill's xp is increasing but that feels like a clunky approach. 

Thanks. 

Posted
10 hours ago, Eagle Scripts said:

Take a look into configs :)

Edit:

I found something in my workspaces for you. The general idea of this should be able to help you : https://hastebin.com/miloqepima.java

It should be used in combination with 


s.getConfigs().get(43)

Know of a reliable way to tell if you're currently on range/mage/melee? I think I ran into that issue years ago when I first started scripting here.

Posted (edited)
49 minutes ago, Alek said:

Know of a reliable way to tell if you're currently on range/mage/melee? I think I ran into that issue years ago when I first started scripting here.

I haven't had to particularly check that so I have never given it an approach. You should always be able to compare the attackStyle that is included in the enum however that'd obviously require the script to open the attack tab which isn't the most efficient. :(

Edit: You could probably also go with the config that stores the magic spell that's on autocast. If there's any; we're doing magic. If there's none than you could do an arrow in the equipment check. Still not a very fancy way though :(

Edited by Eagle Scripts
Posted
1 hour ago, Alek said:

Know of a reliable way to tell if you're currently on range/mage/melee? I think I ran into that issue years ago when I first started scripting here.

try

  • range = if our WEAPON slot name.contains("crossbow", "bow", ....)
  • melee = if all other options fail or check weapon type with names
  • magic = autocasting or has special staff with attackable option (trident, ...)
    public boolean isAutocasting(AutocastSpell auto) {
    		return ctx.getConfigs().get(AUTOCAST_SPELL_CONFIG) == auto.getConfigValue();
    	}

     

Posted

Cool, I can now track and display xp gained for a specific combat skill instead of having to track them all. 

Must have missed the section on configs when I read expliv's scripting tutorial. I had to do some research on what exactly 43 refered to. 

13. Configs

  Hide contents

Configs are persistent id-value pairs that are updated on the RuneScape servers when certain events occur in game.

For example, there is a config for your player's attack style, it has a fixed id, and it's value changes whenever you select a different attack style in game.

There is also a config for your sound settings, and configs for quests, where the value indicates your player's progress through that quest.

Like with widgets, there is an option in the OSBot debug settings to enable a config view:

9Whhgka.png

When you enable this you will see a list of id:value pairs appear:

iochpa7.png

If you then perform an action in game, for example changing attack style, you will see new id:value pairs appear at the top. If you have multiple id:value pairs with the same id, the highest one on the list displays the current value.

For example, the id of the config for attack style is 43.

When I start changing the attack style, I can see the config 43's value changing:

PgeyyXB.png

To retrieve a config's value, you can use the Configs class, to retrieve the instance of this class there is a getter method in the MethodProvider class

So to retrieve the current attack style I would write:


int attackStyle = getConfigs().get(43);

To check if the first attack style is selected I would write:


if (getConfigs().get(43) == 0) {
    // First attack style is selected
}
Posted
48 minutes ago, PayPalMeRSGP said:

Cool, I can now track and display xp gained for a specific combat skill instead of having to track them all. 

Must have missed the section on configs when I read expliv's scripting tutorial. I had to do some research on what exactly 43 refered to. 

13. Configs

  Reveal hidden contents

Configs are persistent id-value pairs that are updated on the RuneScape servers when certain events occur in game.

For example, there is a config for your player's attack style, it has a fixed id, and it's value changes whenever you select a different attack style in game.

There is also a config for your sound settings, and configs for quests, where the value indicates your player's progress through that quest.

Like with widgets, there is an option in the OSBot debug settings to enable a config view:

9Whhgka.png

When you enable this you will see a list of id:value pairs appear:

iochpa7.png

If you then perform an action in game, for example changing attack style, you will see new id:value pairs appear at the top. If you have multiple id:value pairs with the same id, the highest one on the list displays the current value.

For example, the id of the config for attack style is 43.

When I start changing the attack style, I can see the config 43's value changing:

PgeyyXB.png

To retrieve a config's value, you can use the Configs class, to retrieve the instance of this class there is a getter method in the MethodProvider class

So to retrieve the current attack style I would write:



int attackStyle = getConfigs().get(43);

To check if the first attack style is selected I would write:



if (getConfigs().get(43) == 0) {
    // First attack style is selected
}

Why would you need configs to track the xp gained in a specific skill?

https://osbot.org/api/org/osbot/rs07/api/Skills.html

Posted
On 21/1/2018 at 10:25 PM, Alek said:

Know of a reliable way to tell if you're currently on range/mage/melee? I think I ran into that issue years ago when I first started scripting here.

Your class of weapon is in config 843. You can use that for the most part.

The ranged classes are:
Bow: 3
Crossbow: 5
Chinchompa: 7
Thrown: 19

Tho more could potentially be added in the future; so it's not exactly future-proof

  • Like 3
Posted (edited)
1 hour ago, FrostBug said:

Your class of weapon is in config 843. You can use that for the most part.

The ranged classes are:
Bow: 3
Crossbow: 5
Chinchompa: 7
Thrown: 19

Tho more could potentially be added in the future; so it's not exactly future-proof

never knew that, clever bug :boge:

Dont suppose you know more to save me some effort :boge:

Edited by Fruity

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...