I blinked, then..
Version 2
Example code:
public class Test extends Script {
AmountAPI amount;
RS2Widget vambracesButton;
RS2Widget chapsButton;
RS2Widget bodyButton;
RS2Widget superCombatButton;
@Override
public void onStart() throws InterruptedException {
amount = new AmountAPI();
amount.exchangeContext(bot);
amount.initializeModule();
}
@Override
public int onLoop() throws InterruptedException {
if (amount.isValid()) {
vambracesButton = amount.getButton("Green d'hide vamb");
chapsButton = amount.getButton("Green d'hide chaps");
bodyButton = amount.getButton("Green d'hide body");
superCombatButton = amount.getButton("Super combat potion(4)");
} else {
// open the interface...
}
return 250;
}
}
Functions:
public Map<ItemDefinition, RS2Widget> getItemButtons()
public RS2Widget getButton(int... itemIds)
public RS2Widget getButton(int itemId)
public RS2Widget getButton(String... itemNames)
public RS2Widget getButton(String itemName)
public RS2Widget getButton(Predicate<ItemDefinition> itemDefinitionFilter)
public RS2Widget getButton(ItemDefinition itemDefinition)
public boolean isVisible()
public boolean isValid()
private Map<ItemDefinition, RS2Widget> findItemButtons()
private boolean isRootOf(RS2Widget widget)
private RS2Widget findAmountWidget()
private static ItemDefinition getItem(RS2Widget parent)
private static int getItemId(RS2Widget parent)
private static RS2Widget getItemIdWidget(RS2Widget parent)
private static boolean isItemIdValid(RS2Widget child)
private static boolean isWidgetMakeAction(RS2Widget child)
Source:
V1 Source