Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Checking what attack style is active?

Featured Replies

So I want to essentially make a check for whether the player is training attack, strength, or defence, so that my script can activate with widgets to change the attack style. 

I've tried to check whether the style is visible or not, but that always returns true if the combat options screen is showing, and false if not, so it doesn't actually check if "Lunge" is selected or not.

I looked into configs in the api, but can't find anything. Any Ideas? 

Cheers guys

15 minutes ago, mitsuki said:

So I want to essentially make a check for whether the player is training attack, strength, or defence, so that my script can activate with widgets to change the attack style. 

I've tried to check whether the style is visible or not, but that always returns true if the combat options screen is showing, and false if not, so it doesn't actually check if "Lunge" is selected or not.

I looked into configs in the api, but can't find anything. Any Ideas? 

Cheers guys

 

Read section 13 of this tutorial to learn about configs 

 

 

Funnily enough, it actually covers attack style as the example.

Screenshots are a bit out of date and the OSBot UI has changed, but there is still a config debug view in the settings.

TLDR: Config 43.

Just to add on, you should pay attention to weapons with different styles/xp types. Eg. abyssal whip 

You would think an attack style like "slash" would always give you the same xp, bur that's not the case.

Also, configs can help you check what spell you are autocasting. (You would need widgets to select spells though)

  • 3 weeks later...

@mitsuki~
not sure if you had this solved yet but I only just realised this section was a thing, here's what I've been using for my bots fresh from tutorial island.

 

	public void setAttackStyle(String trainType) {
	      int style = script.getConfigs().get(43);
	      
	      switch (trainType) {
	        case "DEFENCE":
	          if (style != 3) {
	            while (!script.tabs.isOpen(Tab.ATTACK))
	              script.getTabs().open(Tab.ATTACK); 
//	            postStatus("CHANGING ATTACK STANCE TO DEFENCE");
	            script.widgets.get(593, 17, 4).interact(new String[0]);
	          } 
	          break;
	        case "ATTACK":
	          if (style != 0) {
	            while (!script.tabs.isOpen(Tab.ATTACK))
	              script.getTabs().open(Tab.ATTACK); 
//	            postStatus("CHANGING ATTACK STANCE TO ATTACK");
	            script.widgets.get(593, 5, 4).interact(new String[0]);
	          } 
	          break;
	        case "STRENGTH":
	          if (style != 1) {
	            while (!script.tabs.isOpen(Tab.ATTACK))
	            script.getTabs().open(Tab.ATTACK); 
//	            postStatus("CHANGING ATTACK STANCE TO STRENGTH");
	            script.widgets.get(593, 9, 4).interact(new String[0]);
	          }
	          break;
	      }
	}

 

On 3/2/2021 at 7:29 AM, Ricky Dactyl said:

@mitsuki~
not sure if you had this solved yet but I only just realised this section was a thing, here's what I've been using for my bots fresh from tutorial island.

 




	public void setAttackStyle(String trainType) {
	      int style = script.getConfigs().get(43);
	      
	      switch (trainType) {
	        case "DEFENCE":
	          if (style != 3) {
	            while (!script.tabs.isOpen(Tab.ATTACK))
	              script.getTabs().open(Tab.ATTACK); 
//	            postStatus("CHANGING ATTACK STANCE TO DEFENCE");
	            script.widgets.get(593, 17, 4).interact(new String[0]);
	          } 
	          break;
	        case "ATTACK":
	          if (style != 0) {
	            while (!script.tabs.isOpen(Tab.ATTACK))
	              script.getTabs().open(Tab.ATTACK); 
//	            postStatus("CHANGING ATTACK STANCE TO ATTACK");
	            script.widgets.get(593, 5, 4).interact(new String[0]);
	          } 
	          break;
	        case "STRENGTH":
	          if (style != 1) {
	            while (!script.tabs.isOpen(Tab.ATTACK))
	            script.getTabs().open(Tab.ATTACK); 
//	            postStatus("CHANGING ATTACK STANCE TO STRENGTH");
	            script.widgets.get(593, 9, 4).interact(new String[0]);
	          }
	          break;
	      }
	}

 

You could simplify it to something like this (Although didn't test it), another step would be changing the traintype to an enum but yeah.

 

	public void setAttackStyle(String trainType)
	{
		int style = script.getConfigs().get(43);
		switch (trainType)
		{
			case "DEFENCE":
				if (style != 3)
				{
					selectAttackStyle(17, 4);
				}
				break;
			case "ATTACK":
				if (style != 0)
				{
					selectAttackStyle(5, 4);
				}
				break;
			case "STRENGTH":
				if (style != 1)
				{
					selectAttackStyle(9, 4);
				}
				break;
		}
	}

	private void selectAttackStyle(int childId, int subChildId)
	{
		if (!script.getTabs().open(Tab.ATTACK))
		{
			return;
		}
		RS2Widget widget = script.widgets.get(593, childId, subChildId);
		if (widget != null && widget.isVisible())
		{
			widget.interact();
		}
	}

 

Edited by PTY Botting
Fixed bracket formatting

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.