Mr def nerd Posted March 12, 2015 Share Posted March 12, 2015 (edited) Okay, so I just finished fairy rings for my web walker. I know there was a tutorial released a while back, but I can't seem to find it, so I am releasing this. I have an enum for the location codes, but its not done yet so I am not releasing it yet To see it in action, please visit this post The fairy ring class import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.MethodProvider; public class FairyRing { public static String[] LETTERS = {"a", "d", "c", "b", "i", "l", "k", "j", "p", "s", "r", "q"}; private MethodProvider ctx; public FairyRing(MethodProvider ctx) { this.ctx = ctx; } public boolean setRing(String combination) { if (ctx.widgets.isVisible(398)) { for (int i = 0; i < 3; i++) { long start = System.currentTimeMillis(); int value = getValue(""+combination.charAt(i)); while (getRowConfig(i) != value && System.currentTimeMillis() - start <= 4000) { RS2Widget w = ctx.widgets.get(398, 19 + (i * 2)); if (w != null) { if (w.interact("Rotate clockwise")) { try { MethodProvider.sleep(MethodProvider.random(1000, 1250)); } catch (InterruptedException e) {} } } } } if (isValid(combination)) { return clickTeleport(); } return false; } return false; } private boolean clickTeleport() { RS2Widget w = ctx.widgets.get(398, 26); if (w != null && w.isVisible()) { return w.interact("Confirm"); } return false; } public boolean isInterfaceOpen() { return ctx.widgets.isVisible(398); } public boolean isValid(String combination) { for (int i = 0; i < 3; i++) { int value = getValue(""+combination.charAt(i)); if (getRowConfig(i) != value) return false; } return true; } public int getValue(String letter) { for (int i = 0; i < LETTERS.length; i++) { if (letter.toLowerCase().equals(LETTERS[i])) { return i % 4; } } return -1; } public int getRowConfig(int row) { switch(row) { case 0: return ctx.configs.get(816) & 0x3; case 1: return (ctx.configs.get(816) >> 2) & 0x3; case 2: return (ctx.configs.get(816) >> 4) & 0x3; } return 0; } } Use as instance.setRing("dkr"); Edited March 12, 2015 by Mrsdefnerd 8 Quote Link to comment Share on other sites More sharing options...
Czar Posted March 12, 2015 Share Posted March 12, 2015 Nice to see somebody else with fairy rings :P 1 Quote Link to comment Share on other sites More sharing options...