January 19, 201610 yr 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.
January 19, 201610 yr widgets and keyboard if dialogs doesn't have it Edited January 19, 201610 yr by Fruity
January 19, 201610 yr if(xWidget != null && xWidget.isVisible()){ getKeyboard().typeString("I like vaginas."); } Edited January 19, 201610 yr by Extreme Scripts
January 19, 201610 yr No offense, but shouldn't scripter 1 be able to at least know how to use widgets?
January 19, 201610 yr 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 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
January 19, 201610 yr Use sure, thinking about it is another thing 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.
January 19, 201610 yr 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
January 19, 201610 yr 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!
January 20, 201610 yr 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 January 20, 201610 yr by Zappster
January 20, 201610 yr 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.
January 20, 201610 yr 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.
January 20, 201610 yr 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
January 22, 201610 yr 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 January 22, 201610 yr by Joseph
January 23, 201610 yr 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