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.

How to pull the value from a field taken from a third level widget?

Featured Replies

I'm currently trying to get and print out a widget name from a third-level widget.

For example, I want to get the player name from the widget for a player added to my friend list (let's say this widget address is 432, 6, 1).

I can get the first, second, and third level ID's printed out (432, 6, 1) but that's not what I want. I want the actual player name to be what is returned. The field for the widget query that contains the player name is "Message". Alternatively, the field "Spell Name" also lists the player name for this third-level widget.

Anyone have any idea how to do this or a snippet of code that might work/has worked?

 

If I understood correctly, you want something like this?

RS2Widget widget = widgets.get(432, 6, 1);
	if (widget != null && widget.isVisible())
		String playerName = widget.getSpellName();

Edit: Or just use widget.getMessage(); instead of getSpellname();

Edited by nosepicker

  • Author
6 minutes ago, nosepicker said:

If I understood correctly, you want something like this?


RS2Widget widget = widgets.get(432, 6, 1);
	if (widget != null && widget.isVisible())
		String playerName = widget.getSpellName();

 

I should have thought of that. Thanks for saving me 2 hours of frustration.

This works perfectly, except I get the junk that is included (for the text color?) that is also included in the Spell Name. This may be a stupid question, but anyway to trim the output?

For example, when I tried it on my friend list widget for "SparcMac" it returned "<col=ff9040>SparcMac</col>"

2 minutes ago, moeotterson said:

I should have thought of that. Thanks for saving me 2 hours of frustration.

This works perfectly, except I get the junk that is included (for the text color?) that is also included in the Spell Name. This may be a stupid question, but anyway to trim the output?

For example, when I tried it on my friend list widget for "SparcMac" it returned "<col=ff9040>SparcMac</col>"

Either use regex "<.*?\\>"  or osbots #stripFormatting(String) method to remove the color tags

5 minutes ago, moeotterson said:

I should have thought of that. Thanks for saving me 2 hours of frustration.

This works perfectly, except I get the junk that is included (for the text color?) that is also included in the Spell Name. This may be a stupid question, but anyway to trim the output?

For example, when I tried it on my friend list widget for "SparcMac" it returned "<col=ff9040>SparcMac</col>"

stringName.replaceAll("[^a-zA-Z0-9]","")

Just now, Vilius said:

Either use regex "<.*?\\>"  or osbots #stripFormatting(String) method to remove the color tags

or that :boge: 

  • Author

Edit: Nevermind, got it working. Many thanks, Computron Sensei.

Edited by moeotterson

On 1/6/2018 at 3:35 PM, moeotterson said:

Edit: Nevermind, got it working. Many thanks, Computron Sensei.

Could you write your solution on the thread for the rest of us when we have the same question :).

On 1/8/2018 at 11:30 PM, moeotterson said:

String y = widget.getSpellName();
String x = stripFormatting(y);

 

String y = stripFormatting(widget.getSpellName());

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.