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.

Amount input

Featured Replies

How would I handle inputting an amount when you click the X-option.

The dialogues class didn't bring me any solution, neither did configs and I don't really know where else to look.

widgets and keyboard  if dialogs doesn't have it biggrin.png

Edited by Fruity

No offense, but shouldn't scripter 1 be able to at least know how to use widgets?

  • Author

No offense, but shouldn't scripter 1 be able to at least know how to use widgets?

Use sure, thinking about it is another thing :D

As this is dialogue related to me I was thinking dialogues and not widgets.

Will try to get it working with widgets in a bit

Use sure, thinking about it is another thing biggrin.png

As this is dialogue related to me I was thinking dialogues and not widgets.

Will try to get it working with widgets in a bit

 

Its all good though mate. You earned your rank. 

  • Author
RS2Widget w = getWidgets().get(162, 31);

if (w == null) {
  log("Widget not found");
  break;
}
if (w.isVisible()) {
  getKeyboard().typeString("5");
}

Works perfectly, thanks for the help guys

No offense, but shouldn't scripter 1 be able to at least know how to use widgets?

 

Scripter 1 is there for a reason - it's a great platform to build your knowledge on. Besides, you can make completely reasonable and functional scripts without widgets. You've got to learn it somewhere! :)

RS2Widget w = getWidgets().get(162, 31);

if (w == null) {
  log("Widget not found");
  break;
}
if (w.isVisible()) {
  getKeyboard().typeString("5");
}

Works perfectly, thanks for the help guys

 

 

FYI, in this case. If the interface is null, it's also not visible.

if(w != null) getKeyboard().typeString("5"); else log("Widget not found");

will also work.

Edited by Zappster

  • Author

FYI, in this case. If the interface is null, it's also not visible.

if(w != null) getKeyboard().typeString("5"); else log("Widget not found");

will also work.

Don't kill me when I'm wrong but with isVisible(); I'm assuming it's actually visible on the screen.

This means that the widget might not be null, but because of e.g. lag it's not visible instantly yet.

So checking if it's visible would be a good thing over only checking if it's not null.

Don't kill me when I'm wrong but with isVisible(); I'm assuming it's actually visible on the screen.

This means that the widget might not be null, but because of e.g. lag it's not visible instantly yet.

So checking if it's visible would be a good thing over only checking if it's not null.

 

Fine example of "A programemr will look both ways before crossing a one way street" lol.

 

I've used this in my scripts and I don't get the problem. In some cases, you can have a wdiget that is there and not ready to show (such as in Zeah, the family stats are hidden but not null and still readable). However, in this case and with all cases of chat box interfaces, I believe the widget is created with the .isVisible set to true at all time and will never have a return of false. This is purely from my personal experience. I've not once had a moment in which the player typed in the chatbox before sending the message.

No offense, but shouldn't scripter 1 be able to at least know how to use widgets?

@KEVzilla is Scripter II and doesn't know how to use Widgets :doge:

RS2Widget w = getWidgets().get(162, 31);

if (w == null) {
  log("Widget not found");
  break;
}
if (w.isVisible()) {
  getKeyboard().typeString("5");
}

Works perfectly, thanks for the help guys

 

you should really null check that widget before calling its isVisible(). incase you think you did. I have to tell you, you didn't.

 

The idea:

RS2Widget wid = getWidget(#,#);

if (wid == null) {
//the widget is null
} else {
//its not null
 if (wid.isVisible()) {
  //whatever........
 }
}

here the method I use

	public boolean canEnterAmount() {
		RS2Widget w = getWidgets().getWidgetContainingText(162, "Enter amount:");
		return w != null && w.isVisible();
	}
//this is what I normally do

if (!canEnterAmount()) {
//interact with something until it pops up
} else {
  getKeyboard().typeString("5", canEnterAmount());
}

that Boolean after the "5"  is there as a failsafe so incase you type in the chatbox. The message doesn't get sent out

Edited by Joseph

you should really null check that widget before calling its isVisible(). incase you think you did. I have to tell you, you didn't.

 

But he did. Going by the code he posted he's using that in some sorta loop, and breaks out of it if it's null...

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.