None 227 Share Posted May 10, 2017 final static int shiftDrop = 0b100000000000000000; // or final static int shiftDrop = 1 << 17 public boolean dropShift() { return (getPlayerSettings().getConfig(1055) & shiftDrop) == shiftDrop; } if (!dropShift()) { if (!getTabs().isOpen(Tab.OPTIONS)) { if (getTabs().open(Tab.OPTIONS)) sleepUntil(() -> getTabs().isOpen(Tab.OPTIONS), 3000); } else if (getWidgets().getWidgetChild(261, 65) == null || !getWidgets().getWidgetChild(261, 65).isVisible()) { if (getWidgets().getWidgetChild(261, 1, 7) != null) { if(getWidgets().getWidgetChild(261, 1, 7).interact("Controls")) sleep(1000,1500); } } else { if (getWidgets().getWidgetChild(261, 65).interact()) sleepUntil(() -> dropShift(), 3000); } } Link to comment Share on other sites More sharing options...
Hashtag 8708 Share Posted May 10, 2017 Sweet, thanks. Link to comment Share on other sites More sharing options...
None 227 Author Share Posted May 10, 2017 thanks Edit: Changing final static int shiftDrop = 0b100000000000000000; to final static int shiftDrop = 1 << 17; makes it easier to read imo added to the snippit thanks for the input Link to comment Share on other sites More sharing options...
Abstinence 15 Share Posted May 10, 2017 A better version: public boolean quickDropActive() { return ((getPlayerSettings().getConfig(1055) >> 17) & 0x1) == 1; } public boolean activateQuickDropping() { if (quickDropActive()) return true; if (!getTabs().isOpen(Tab.OPTIONS)) return getTabs().open(Tab.OPTIONS) && activateQuickDropping(); WidgetChild settings = getWidgets().getWidgetChild(261, 65); if (settings != null && settings.isVisible() && settings.interact()) { return (settings == null) && activateQuickDropping(); } WidgetChild controls = getWidgets().getWidgetChild(261, 1, 7); return (controls != null) && controls.interact("Controls"); } I would also strongly recommend splitting these things up for more accuracy/fluency, hence why I opted for a recursive solution. In short: I would split it up in opening up the sub-menu in the settings tab, and have it interact with it. I just wrote it in a suboptimal way to respect the OP's solving logic! Not sure why there was opted for a << 17 solution as that does sound as the reverse way of solving things. Link to comment Share on other sites More sharing options...
minereaper1 0 Share Posted May 10, 2017 Thanks , i was looking for this Link to comment Share on other sites More sharing options...
None 227 Author Share Posted May 10, 2017 A better version: public boolean quickDropActive() { return ((getPlayerSettings().getConfig(1055) >> 17) & 0x1) == 1; } public boolean activateQuickDropping() { if (quickDropActive()) return true; if (!getTabs().isOpen(Tab.OPTIONS)) return getTabs().open(Tab.OPTIONS) && activateQuickDropping(); WidgetChild settings = getWidgets().getWidgetChild(261, 65); if (settings != null && settings.isVisible() && settings.interact()) { return (settings == null) && activateQuickDropping(); } WidgetChild controls = getWidgets().getWidgetChild(261, 1, 7); return (controls != null) && controls.interact("Controls") && quickDropActive(); } I would also strongly recommend splitting these things up for more accuracy/fluency, hence why I opted for a recursive solution. In short: I would split it up in opening up the sub-menu in the settings tab, and have it interact with it. I just wrote it in a suboptimal way to respect the OP's solving logic! Not sure why there was opted for a << 17 solution as that does sound as the reverse way of solving things. my method is split up with the else ifs it will do 1 action per loop, open tab...reloop...click button...reloop....activate...reloop Link to comment Share on other sites More sharing options...
Eclipseop 194 Share Posted May 10, 2017 shiftDrop and dropShift() may have not been a good naming idea. Link to comment Share on other sites More sharing options...
Abstinence 15 Share Posted May 10, 2017 my method is split up with the else ifs it will do 1 action per loop, open tab...reloop...click button...reloop....activate...reloop, yours is actually more prone to fail if it lags due to the if if if structure Allow me to educate young grasshopper. The whole point of me using recursion is because it is guaranteed to reach the end-goal. I'm not saying that recursion is the solution (considering that is not how this type of API is constructed) as I'm sure that is what you're referring to but I have kept things in a singular "block" to respect the way you wrote it. I did not refer to splitting up as in splitting it up in control statements (if/else/else if), but as in splitting it up in different fields. One would be openSettings(SettingSubTab.CONTROLS) and the other would be activating the actual shift drop. Feel free to test it out, I think you'll find that yours is more prone to failure than mine. Link to comment Share on other sites More sharing options...
MavericKing 6 Share Posted May 10, 2017 A better version: public boolean quickDropActive() { return ((getPlayerSettings().getConfig(1055) >> 17) & 0x1) == 1; } public boolean activateQuickDropping() { if (quickDropActive()) return true; if (!getTabs().isOpen(Tab.OPTIONS)) return getTabs().open(Tab.OPTIONS) && activateQuickDropping(); WidgetChild settings = getWidgets().getWidgetChild(261, 65); if (settings != null && settings.isVisible() && settings.interact()) { return (settings == null) && activateQuickDropping(); } WidgetChild controls = getWidgets().getWidgetChild(261, 1, 7); return (controls != null) && controls.interact("Controls"); } I would also strongly recommend splitting these things up for more accuracy/fluency, hence why I opted for a recursive solution. In short: I would split it up in opening up the sub-menu in the settings tab, and have it interact with it. I just wrote it in a suboptimal way to respect the OP's solving logic! Not sure why there was opted for a << 17 solution as that does sound as the reverse way of solving things. Inb4 something breaks in the API and you get stuck in the recursive loop so you have to end the program through task manager. Link to comment Share on other sites More sharing options...
None 227 Author Share Posted May 10, 2017 Allow me to educate young grasshopper. The whole point of me using recursion is because it is guaranteed to reach the end-goal. I'm not saying that recursion is the solution (considering that is not how this type of API is constructed) as I'm sure that is what you're referring to but I have kept things in a singular "block" to respect the way you wrote it. I did not refer to splitting up as in splitting it up in control statements (if/else/else if), but as in splitting it up in different fields. One would be openSettings(SettingSubTab.CONTROLS) and the other would be activating the actual shift drop. Feel free to test it out, I think you'll find that yours is more prone to failure than mine. I dont mean to sound rude but if you think you have a snippit that is better than mine, please post it on a different thread. i dont have the energy to argue over 15 lines of code... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.