-
Posts
763 -
Joined
-
Last visited
-
Feedback
100%
Everything posted by Flamezzz
-
Never really coded in java, where to start
Flamezzz replied to archiebaker's topic in Scripting Help
If you have some programming experience you can download Core Java Volume 1, which is a nice introduction to java imo. Then just read some of the open source scripts and use the api docs and you should be fine. -
(double) currentDist
-
Script implements all listeners: abstract class Script extends MethodProvider implements Painter, MessageListener, ConfigListener, LoginResponseCodeListener, AudioListener So you just need to override public void onMessage(Message m) in your script
-
Instead you could grab the buffer logger.getBuffer(), split each line and copy the result to the clipboard.
-
You can just create one right? RS2Widget w = widgets.get(0,0); new WidgetDestination(bot, w);
-
Usually you just want to use bank.open() but to select a booth yourself you could do List<RS2Object> booths = objects.filter(new ContainsNameFilter("bank booth")); RS2Object rndBooth = booths.get(random(0, booths.size()-1));
-
They use reCAPTCHA now, so I don't think it's that easy anymore...
-
Right now you always get the closest door (open or closed), so if you open one the next time closest will still return the same door. Instead you could use a filter: objects.closest("Door", o -> o.hasAction("Open")) << this will always give you a closed door. You could do something like if knight is not null { if doorHandler.handleNextObstacle(knight) return // door handled, loop after else do pickpocket stuff } Doorhandler API
-
I think this worked for me, openjdk stuff failed sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer
-
Yeah ur running with java < 8, confirm you're using the correct one by running java -version.
-
What happens when you put some log statements in there? Is the clickContinue part executed? IsPendingContinuation() checks for the "Please wait..." message as far as I know, so I doubt it even gets executed Edit, try this ^^ RS2Widget w = getWidgets().getWidgetContainingText(162, "Click to continue"); if (w != null && w.isVisible()) { log("a"); if (!getDialogues().isPendingContinuation()){ log("b"); w.interact(); } }
-
Are you using dialogues.clickContinue() ? This doesn't actually click continue anymore, but just does typeString(" "). So if pressing space doesn't cause it to continue, it's not going to work and you would have to implement it yourself using widgets.getWidgetContainingText("Click to continue") then interacting or something similar.
-
I'm not sure if it's still possible to unregister or hook autologin, I used to do that but it stopped working at some point. However, you can do something hacky like: try { Field f = bot.getClass().getSuperclass().getDeclaredField("account"); f.setAccessible(true); f.set(bot, new RSAccount()); } catch (NoSuchFieldException e) { log("bad mkay"); } catch (IllegalAccessException e) { log("bad mkay"); } Which makes sure the autologin doesn't trigger. You definitely don't want to push something like that to the SDN, but it's fine for private usage. At this point nothing happens because the scriptexecutor doesn't call onLoop() when the client is not logged in. To solve this you could create a Thread in onStart which runs in the background new Thread(() -> { while(running && !Thread.interrupted()) { if(!client.isLoggedIn()) { log("Logging in!"); try { mouse.click(460, 290, false); getKeyboard().typeString("USERNAME HERE", true); sleep(random(500, 1500)); getKeyboard().typeString("PASSWORD HERE", true); sleep(random(4000,5000)); mouse.click(380, 330, false); sleep(random(4000,5000)); } catch (InterruptedException e) { } } try { Thread.sleep(1000); } catch (InterruptedException e) { } } }).start(); Seems to work for me
-
Previously it was player.accessor.getSkullIcon() != -1 but I think getSkullIcon was added to Player recently, so you could use that as well.
-
Well it makes no sense to port OSRS to their super fancy new rendering engine (it wouldn't look 'Old School' anymore).
-
NXT is not for osrs right?
-
Anyone knows how to stop spam clicking an npc?
Flamezzz replied to Sebastian's topic in Scripting Help
Yeah I remember it always says in dialogue because it shows the progress. I found this in my tut script, perhaps it's helpful: if(dialogues.inDialogue() && (widgets.get(372,0) == null || !widgets.get(372,0).isVisible()) && (widgets.get(231,1) != null && widgets.get(231,1).isVisible()) || widgets.get(219,0) != null && widgets.get(219,0).isVisible()) // tutorial messages { // in dialogue } For the stages you want to use configs. configs.get(281) returns the current stage of tut island. You could then use the config debugger to determine the values. -
mouse.click(false) or just mouse.click(new MiniMapTileDestination(bot, p))
-
You probably need to enable it in your IDE.
-
To determine DMM worlds dynamically you could use for(XWorld w : client.accessor.getWorldArray()) { if( (w.getType() & 0x20000000) != 0) // this is a DMM world, parse world ID from w.getDomain() }
-
It's a fun project but bezier curves have been used in public bots for over 5 years, so if jagex does anything with the data they gather I assume the first thing they would do is try to fit a bezier curve. If you want human-like mouse movements I suggest you start with collecting actual human mouse data and train a model from there.
-
How to dynamically add jar to classpath at runtime
Flamezzz replied to Brian's topic in Scripting Help
I think you can just copy the jar in OSBot\Data EDIT: nvm I remember now, I ragequitted and just copied the whole jar (I was using libgrowl) in my script jar. I guess dynamic loading isn't going to work since the classloader loads the script first and then tries to resolve any references. -cp isn't going to work either cuz osbot launches a new process... -
Small API for the new attack option stuff they introduced in the update today. Usage: AttackOptions.setNPC(this, AttackOptions.Option.HIDDEN); AttackOptions.setPlayer(this, AttackOptions.Option.HIDDEN); AttackOptions.getNPC(this) AttackOptions.getPlayer(this) import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.utility.ConditionalSleep; import java.util.List; /** * Created by Flamezzz on 12/11/2015. */ public class AttackOptions { public enum Option { DEPENDS_ON_COMBAT("Depends on combat levels"), ALWAYS_RIGHT_CLICK("Always right-click"), LEFT_CLICK_WHERE_AVAILABLE("Left-click where available"), HIDDEN("Hidden"); String str; Option(String str) { this.str = str; } } private static boolean DEBUG = true; private static int[] CONFIGS = {1107, 1306}; private static final int CONTROLS_ROOT = 261; private static void debug(MethodProvider api, String str) { if (DEBUG) api.log(str); } private static boolean openControls(MethodProvider api) { RS2Widget controls = api.widgets.singleFilter( CONTROLS_ROOT, w -> w.getInteractActions() != null && w.getInteractActions().length > 0 && "Controls".equals(w.getInteractActions()[0])); if (controls == null || !controls.isVisible()) return false; return controls.getSpriteIndex1() == 762 || controls.interact("Controls"); } public static Option getNPC(MethodProvider api) { return Option.values()[api.configs.get(CONFIGS[1])]; } public static Option getPlayer(MethodProvider api) { return Option.values()[api.configs.get(CONFIGS[0])]; } public static boolean setNPC(MethodProvider api, Option o) { return getNPC(api).equals(o) ? true : set(api, o, "NPC 'Attack' options:", 1); } public static boolean setPlayer(MethodProvider api, Option o) { return getPlayer(api).equals(o) ? true : set(api, o, "Player 'Attack' options:", 0); } private static List<RS2Widget> getOptions(MethodProvider api) { return api.widgets.filter( CONTROLS_ROOT, w -> w.isVisible() && w.getInteractActions() != null && w.getInteractActions().length > 0 && "Select".equals(w.getInteractActions()[0])); } private static boolean set(MethodProvider api, Option o, String searchStr, int idx) { if (api.tabs.open(Tab.SETTINGS) && openControls(api)) { debug(api, "Opened controls"); RS2Widget child = api.widgets.singleFilter(CONTROLS_ROOT, w -> w.getMessage().equalsIgnoreCase(searchStr)); if (child == null || !child.isVisible()) return false; debug(api, "Found child [" + child.getRootId() + "," + child.getSecondLevelId() + "," + child.getThirdLevelId() + "]"); RS2Widget openOptions = api.widgets.get(child.getRootId(), child.getSecondLevelId(), 1); if(openOptions == null || !openOptions.isVisible()) { debug(api, "openoptions can not be found"); return false; } List<RS2Widget> options = getOptions(api); debug(api, "Found " + options.size() + " options"); if(options.size() != Option.values().length) { openOptions.interact(); debug(api, "Opening option list"); if (!new ConditionalSleep(5000) { public boolean condition() throws InterruptedException { return getOptions(api).size() == Option.values().length; } }.sleep()) { return false; } } debug(api, "Clicking option"); RS2Widget selectOption = options.get(o.ordinal()); return selectOption.interact() && new ConditionalSleep(5000) { public boolean condition() throws InterruptedException { return api.configs.get(CONFIGS[idx]) == o.ordinal(); } }.sleep(); } return false; } }
-
They sample mouse movements every 50ms according to this deob.