RetroBot 35 Posted June 28, 2017 Made this snippet to check if there was an interface up before doing an action, and thought this could be of some use to some people. private final int CLOSE_TEXTURE_ID = 535; public boolean isRandomInterfaceOpen() { for (Widget parent : getWidgets().getWidgets()) { for (WidgetChild child : parent.getChildren()) { if (child.getTextureId() == CLOSE_TEXTURE_ID) { return true; } for (WidgetChild grandchild : child.getChildren()) { if (grandchild.getTextureId() == CLOSE_TEXTURE_ID) { return true; } } } } return false; }
Polymorphism 48 Posted June 28, 2017 I wonder if it would be less intensive to filter non visible widgets and their children prior to iteration. Otherwise good snippet!
None 227 Posted June 28, 2017 I wonder if it would be less intensive to filter non visible widgets and their children prior to iteration. Otherwise good snippet! final static int CLOSE_TEXTURE_ID = 535; List<WidgetChild> randomInterface = new ArrayList<WidgetChild>(); public boolean isRandomInterfaceOpen() { randomInterface = getWidgets().getWidgets(f -> f !=null && f.isVisible() && (f.isGrandChild() && f.getTextureId() == CLOSE_TEXTURE_ID || f.getChildTextureID() == CLOSE_TEXTURE_ID)); return randomInterface !=null && !randomInterface.isEmpty(); }
Polymorphism 48 Posted June 28, 2017 final static int CLOSE_TEXTURE_ID = 535; List<WidgetChild> randomInterface = new ArrayList<WidgetChild>(); public boolean isRandomInterfaceOpen() { randomInterface = getWidgets().getWidgets(f -> f !=null && f.isVisible() && (f.isGrandChild() && f.getTextureId() == CLOSE_TEXTURE_ID || f.getChildTextureID() == CLOSE_TEXTURE_ID)); return randomInterface !=null && !randomInterface.isEmpty(); } Yes, was hoping he'd change his code tho.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.