Jump to content

How to change the combat style?


Recommended Posts

Posted (edited)

I understand that to obtain the current option is like this:

getConfigs().get(43)

Knowing that the ways to use are the following:

0 - Attack

1 - Strength

3 - Defense

How do I order the change of this configuration?

Many thanks to anyone who can help me.

Edited by trainux
Posted

So it seems like you've figured out that if that config is a certain value, you're currently using that attack style.

Now we check if we're currently using the attack style you want, and then we use widgets to change the attack style, for example:

if (needAttackStyle() && getConfigs().get(43) != 0) {
	open settings tab and interact with the required widget
}

 

Posted
22 minutes ago, d0zza said:

So it seems like you've figured out that if that config is a certain value, you're currently using that attack style.

Now we check if we're currently using the attack style you want, and then we use widgets to change the attack style, for example:


if (needAttackStyle() && getConfigs().get(43) != 0) {
	open settings tab and interact with the required widget
}

 

Ok, I understand that changing the tab is simple:

getTabs().open(Tab.ATTACK);

The part that I do not understand is the "widget", so far I do not know how they are used for more than I look for examples, I do not know what I'm confusing.

Posted
1 minute ago, trainux said:

Ok, I understand that changing the tab is simple:


getTabs().open(Tab.ATTACK);

The part that I do not understand is the "widget", so far I do not know how they are used for more than I look for examples, I do not know what I'm confusing.

Go to the settings in osbot and tick widgets, you should get a good idea of what they are from experimenting with that.

Posted
18 minutes ago, d0zza said:

Get the widget you want and interact with it using the widget api.

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

Thanks.


int str = getSkills().getDynamic(Skill.STRENGTH);
RS2Widget modeStr = getWidgets().get(593,7);
int atk = getSkills().getDynamic(Skill.ATTACK);
RS2Widget modeAtk = getWidgets().get(593,3);
int def = getSkills().getDynamic(Skill.DEFENCE);
RS2Widget modeDef = getWidgets().get(593,15);

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

if(str < 13) {
    getTabs().open(Tab.ATTACK);
	sleep(1000);
	if(config!=1) {
		modeStr.interact("Slash");
		sleep(random(3000,7000));
	}
    getTabs().open(Tab.INVENTORY);
}else if(atk < 13) {
    getTabs().open(Tab.ATTACK);
	sleep(1000);
	if(config!=0) {
		modeAtk.interact("Chop");
		sleep(random(3000,7000));
	}
    getTabs().open(Tab.INVENTORY);
}else if(def < 13) {
    getTabs().open(Tab.ATTACK);
	sleep(1000);
	if(config!=3) {
		modeDef.interact("Block");
		sleep(random(3000,7000));
	}
    getTabs().open(Tab.INVENTORY);
}else {
    getTabs().open(Tab.ATTACK);
	sleep(1000);
	if(config!=1) {
		modeStr.interact("Slash");
		sleep(random(3000,7000));
	}
    getTabs().open(Tab.INVENTORY);
}

Declare widgets and interact with them.

  • Like 1
Posted
7 hours ago, trainux said:

Thanks.



int str = getSkills().getDynamic(Skill.STRENGTH);
RS2Widget modeStr = getWidgets().get(593,7);
int atk = getSkills().getDynamic(Skill.ATTACK);
RS2Widget modeAtk = getWidgets().get(593,3);
int def = getSkills().getDynamic(Skill.DEFENCE);
RS2Widget modeDef = getWidgets().get(593,15);

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

if(str < 13) {
    getTabs().open(Tab.ATTACK);
	sleep(1000);
	if(config!=1) {
		modeStr.interact("Slash");
		sleep(random(3000,7000));
	}
    getTabs().open(Tab.INVENTORY);
}else if(atk < 13) {
    getTabs().open(Tab.ATTACK);
	sleep(1000);
	if(config!=0) {
		modeAtk.interact("Chop");
		sleep(random(3000,7000));
	}
    getTabs().open(Tab.INVENTORY);
}else if(def < 13) {
    getTabs().open(Tab.ATTACK);
	sleep(1000);
	if(config!=3) {
		modeDef.interact("Block");
		sleep(random(3000,7000));
	}
    getTabs().open(Tab.INVENTORY);
}else {
    getTabs().open(Tab.ATTACK);
	sleep(1000);
	if(config!=1) {
		modeStr.interact("Slash");
		sleep(random(3000,7000));
	}
    getTabs().open(Tab.INVENTORY);
}

Declare widgets and interact with them.

null checks

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...