

liverare
Scripter II-
Posts
1300 -
Joined
-
Last visited
-
Days Won
3 -
Feedback
0%
Everything posted by liverare
-
Semantics. I wrote and released an API, not a MethodProvider. The initializeModule function doesn't need to be used, but I've used it in my other APIs. For instance, in my hunting API, I use it to reset values and variables, but also to find some other entities, so that I can completely reset the hunt each time I finish one. exchangeContext is required to be called, so the MethodProvider can capture an instance of your bot and work in relation to it. If you look at the methods I listed and look for the ones that don't contain "static" in their deceleration, that's because, for one reason or another, it depends on having access to the bot instance. If I only had static variables then I wouldn't need to pass in the bot instance, but I'd still call it, if only because I've got OCD and instantiating a new API and not giving it the bot context would trigger me.
-
https://www.youtube.com/watch?v=UvvoGTvuTmA
-
Can you actually turn a good profit botting?
liverare replied to d0nk3yk0ng12's topic in Botting & Bans
Ideally, you should write your own scripts so you can best capture how you do what you do and implement that into your script. Writing scripts that mimic your quirks and habits is key to build a successful antiban. A successful antiban is one that fools other players, because they're probably the number one reason why you get flagged. If your aim is to make loads of GP/$, then look into gold farming. You'll be creating throwaway accounts that'll probably last around a few months (at best) and then get banned. Hopefully the turnover's good enough to make this viable. If you want to make good profit but don't mind waiting a little longer, look into building up accounts. When they released the achievement diaries, I was one of the few to gain entry to the new red chinchompa area, which is an exclusive reward to the Western Provence(?) diary. That place is almost completely dead all the time because of the high requirements. I botted myself 80 hunter before moving on. But if you get caught...well fuck. Hopefully, with built up accounts, you'll get slapped with just a 2-day ban. -
Deprecated for internal use only. Building APIs is more of a developer's job than it is a scripters, so it's likely deprecated just to ward of those who don't know what they're doing.
-
Bob Ross would be so proud! Example code: import java.awt.Color; import java.awt.Graphics2D; import java.util.List; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import com.liverare.api.PaintAPI; @ScriptManifest(author = "", info = "", logo = "", name = "Test", version = 0) public class Test extends Script { PaintAPI paint; Area safeSpace; List<NPC> guards; @Override public void onStart() throws InterruptedException { paint = new PaintAPI(); paint.exchangeContext(bot); safeSpace = myPlayer().getArea(5); } @Override public int onLoop() throws InterruptedException { guards = npcs.filter(Test::isGuard); return 100; } private static boolean isGuard(NPC npc) { return npc.getName().equals("Guard"); } @Override public void onPaint(Graphics2D g) { g.setColor(Color.BLACK); g.setBackground(Color.PINK); // dont worry bout checks fam, i do dat paint.drawMinimapArea(g, safeSpace); paint.drawEntities(g, guards, Test::guardToString, true, false, false, false, false, false, true); } private static String guardToString(NPC npc) { return "Health: " + npc.getHealthPercent() + ", xyz: " + npc.getPosition().toString(); } } Functions: public void drawLink(Graphics2D g, Entity entity1, Entity entity2) public void drawMinimapArea(Graphics2D g, org.osbot.rs07.api.map.Area area) public <T extends Position> void drawString(Graphics2D g, Function<T, String> toString, T position) public void drawString(Graphics2D g, String aString, Position position) public void drawString(Graphics2D g, String aString, Entity entity) public void drawEntity(Graphics2D g, Entity entity, String aString, boolean labelTile, boolean click, boolean cube, boolean minimap, boolean tile, boolean box, boolean wireframe) public void drawEntity(Graphics2D g, Entity entity, Function<T, String> getDescription, boolean labelTile, boolean click, boolean cube, boolean minimap, boolean tile, boolean box, boolean wireframe) public <T extends Entity> void drawEntities(Graphics2D g, Collection<T> entities, Function<T, String> getDescription, boolean labelTile, boolean click, boolean cube, boolean minimap, boolean tile, boolean tileCube, boolean wireframe) private void drawBox(Graphics2D g, Entity entity) private void drawBox(Graphics2D g, Position bottomTile, Position topTile) private void drawWireframe(Graphics2D g, Entity entity) private void drawClickBounds(Graphics2D g, Entity entity) private void drawCube(Graphics2D g, Entity entity) public void drawMinimapPoint(Graphics2D g, Vector3D v) public void drawMinimapLink(Graphics2D g, Vector3D a, Vector3D b) public void drawTile(Graphics2D g, Entity entity) public void drawTile(Graphics2D g, Position position) public static void drawPoint(Graphics2D g, Point point, int size) public static void drawPoint(Graphics2D g, int x, int y, int size) public static void drawShape(Graphics2D g, Shape shape) public static void drawString(Graphics2D g, String aString, int x, int y) public static void drawString(Graphics2D g, String aString, Point point) public static void drawString(Graphics2D g, String aString, Rectangle rectangle) Source:
- 25 replies
-
- 11
-
-
Find people wearing stuff. Note: doesn't work with ammo and rings. Example code: import java.util.List; import org.osbot.rs07.api.def.ItemDefinition; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import com.liverare.api.AppearanceAPI; @ScriptManifest(author = "", info = "", logo = "", name = "Test", version = 0) public class Test extends Script { AppearanceAPI appearance; @Override public void onStart() throws InterruptedException { appearance = new AppearanceAPI(); appearance.exchangeContext(bot); } @Override public int onLoop() throws InterruptedException { pesterRichPeopleForFreeStuff(); return 100; } private void pesterRichPeopleForFreeStuff() { List<Player> richPeople = appearance.findPlayersWielding(Test::isExpensiveItem); if (richPeople != null && !richPeople.isEmpty()) { // rich people spotted! // prepare for pestering // in 3... } } private static boolean isExpensiveItem(ItemDefinition itemDefinition) { String itemName = itemDefinition.getName(); return itemName.equals("Twisted bow") || itemName.equals("3rd age longsword") || itemName.equals("3rd age pickaxe") || itemName.equals("3rd age axe") || itemName.equals("3rd age cloak") || itemName.equals("Elysian spirit shield") || itemName.equals("3rd age bow"); } } Methods: public List<Player> findPlayersWielding(List<Player> players, Predicate<ItemDefinition> itemDefinitionFilter) public List<Player> findPlayersWielding(Predicate<ItemDefinition> itemDefinitionFilter) public Player findPlayerWielding(List<Player> players, Predicate<ItemDefinition> itemDefinitionFilter) public Player findPlayerWielding(Predicate<ItemDefinition> itemDefinitionFilter) public static boolean isDefined(Player player, Predicate<ItemDefinition> itemDefinitionFilter) private static boolean isDefined(int[] appearance, Predicate<ItemDefinition> itemDefinitionFilter) Source:
- 3 replies
-
- 8
-
-
- appearance api
- appearance
-
(and 1 more)
Tagged with:
-
Let's work to make Wilderness bots great again! Example code: import java.util.List; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import com.liverare.api.WildernessAPI; @ScriptManifest(author = "", info = "", logo = "", name = "Test", version = 0) public class Test extends Script { WildernessAPI wilderness; @Override public void onStart() throws InterruptedException { wilderness = new WildernessAPI(); wilderness.exchangeContext(bot); } @Override public int onLoop() throws InterruptedException { Player workerBot = players.closest("W0rk3r B0t 5001"); handleRealThreats(); handlePotentialThreats(); saveWorkerBot(workerBot); return 100; } private void handleRealThreats() { List<Player> realThreats = wilderness.findRealThreats(); if (realThreats != null && !realThreats.isEmpty()) { // oh shit they can attack us // better check what they're wearing and what they're doing } } private void handlePotentialThreats() { List<Player> potentialThreats = wilderness.findPotentialThreats(); if (potentialThreats != null && !potentialThreats.isEmpty()) { // oh dear, we may be in trouble // we'd better not go deeper into the Wilderness, they may be // waiting for us to do exactly that! } } private void saveWorkerBot(Player workerBot) { List<Player> realThreatsToWorkerBot = wilderness.findRealThreats(workerBot); if (realThreatsToWorkerBot != null && !realThreatsToWorkerBot.isEmpty()) { // worker bot may be in trouble // perhaps we should attack baddie? lure them away? etc. } } } Methods: public int getSafeWildernessLevel(Player player) public int getSafeWildernessLevel(Player playerA, Player playerB) public List<Player> findPotentialThreats() public List<Player> findPotentialThreats(Player victim) public List<Player> findRealThreats() public List<Player> findRealThreats(Player victim) public static boolean canPlayerAFighterPlayerB(Player playerA, Player playerB) public static int calculateYCoordinate(Vector3D vector3d, boolean upperBound) public static int calculateYCoordinate(int wildernessLevel, boolean upperBound) public static int calculateWildernessLevel(Vector3D vector3d) public static int calculateWildernessLevel(int yCoordinate) Source:
- 7 replies
-
- 7
-
-
- wilderness api
- wilderness
-
(and 1 more)
Tagged with:
-
Does Jagex track the IP addresses you use when you log into the game? Yes. Can Jagex reasonably assume you're botting if you have 2 or more accounts active from the same device? Yes. Might Jagex reasonably assume you're operating a gold farm sweatshop if you have many computers all botting? Yes. Could Jagex wrongly ban a legit player who just so happens to be on the same host as a botter? Yes.
-
Yes. Firstly, you need to grab a bunch of tile data to work with. You can do this by creating a new Area object and using the getPositions function to get the tiles in that range. Then, you'll need to check those tiles' flags to see whether they can be walked on or not. You need to do this separately and still be able to filter out the 'bad tiles'. Thirdly, when you have all those 'walkable' tiles, you then need to figure out whether there are objects situated on those tiles. Objects such as cannons, flowers, fires, and others will prevent you from being able to light a fire in that spot. The MethodProvider has MethodProvider.objects, which links you to the Objects object. From there, you can use the Objects.get(x, y) function, or you could use a PositionFilter which filters out tiles that aren't occupied with 'bad objects.' I would chose the former, because your list of good tiles will work better if you can just check for objects at their coordinates.
-
The ExperienceTracker has a function start. You should run that for all of your skills onStart.
-
This seems like a script problem. Post your script.
- 2 replies
-
- bug
- memory use
-
(and 2 more)
Tagged with:
-
/** * Calculate how many casts you can perform. This takes infinite-rune items * (e.g. kodai wand/tomb of fire/staves) into consideration too. * * @param airRunesRequired - Air runes required * @param waterRunesRequired - Water runes required * @param earthRunesRequired - Earth runes required * @param fireRunesRequired - Fire runes required * @param bodyRunesRequired - Body runes required * @param mindRunesRequired - Mind runes required * @param cosmicRunesRequired - Cosmic runes required * @param chaosRunesRequired - Chaos runes required * @param natureRunesRequired - Nature runes required * @param lawRunesRequired - Law runes required * @param deathRunesRequired - Death runes required * @param astralRunesRequired - Astral runes required * @param bloodRunesRequired - Blood runes required * @param soulRunesRequired - Soul runes required * @return castCount - How many casts can be performed */ private long getCastCount( int airRunesRequired, int waterRunesRequired, int earthRunesRequired, int fireRunesRequired, int bodyRunesRequired, int mindRunesRequired, int cosmicRunesRequired, int chaosRunesRequired, int natureRunesRequired, int lawRunesRequired, int deathRunesRequired, int astralRunesRequired, int bloodRunesRequired, int soulRunesRequired ) { long castCount = Long.MAX_VALUE; long[][] amounts = new long[12][2]; long[] amount; boolean infiniteAirRunes = equipment.isWearingItemThatContains(EquipmentSlot.WEAPON, "Air", "Mist", "Dust", "Smoke"); boolean infiniteWaterRunes = equipment.isWearingItemThatContains(EquipmentSlot.WEAPON, "Water", "Mist", "Mud", "Steam", "Kodai"); boolean infiniteEarthRunes = equipment.isWearingItemThatContains(EquipmentSlot.WEAPON, "Earth", "Dust", "Mud", "Lava"); boolean infiniteFireRunes = equipment.isWearingItemThatContains(EquipmentSlot.WEAPON, "Fire", "Smoke", "Steam", "Lava") || equipment.isWearingItemThatContains(EquipmentSlot.SHIELD, "Tomb of fire"); long mistRuneCount = inventory.getAmount("Mist rune"); long dustRuneCount = inventory.getAmount("Dust rune"); long mudRuneCount = inventory.getAmount("Mud rune"); long smokeRuneCount = inventory.getAmount("Smoke rune"); long steamRuneCount = inventory.getAmount("Steam rune"); long lavaRuneCount = inventory.getAmount("Lava rune"); amounts[0][0] = airRunesRequired; amounts[1][0] = waterRunesRequired; amounts[2][0] = earthRunesRequired; amounts[3][0] = fireRunesRequired; amounts[4][0] = bodyRunesRequired; amounts[5][0] = mindRunesRequired; amounts[6][0] = cosmicRunesRequired; amounts[7][0] = chaosRunesRequired; amounts[8][0] = natureRunesRequired; amounts[9][0] = lawRunesRequired; amounts[10][0] = deathRunesRequired; amounts[11][0] = astralRunesRequired; amounts[12][0] = bloodRunesRequired; amounts[13][0] = soulRunesRequired; // ELEMENTAL RUNES if (infiniteAirRunes) { amounts[0][1] = -1; } else { amounts[0][1] += inventory.getAmount("Air rune"); amounts[0][1] += mistRuneCount; amounts[0][1] += dustRuneCount; amounts[0][1] += smokeRuneCount; } if (infiniteWaterRunes) { amounts[1][1] = -1; } else { amounts[1][1] += inventory.getAmount("Water rune"); amounts[1][1] += mistRuneCount; amounts[1][1] += mudRuneCount; amounts[1][1] += steamRuneCount; } if (infiniteEarthRunes) { amounts[2][1] = -1; } else { amounts[2][1] += inventory.getAmount("Earth rune"); amounts[2][1] += dustRuneCount; amounts[2][1] += mudRuneCount; amounts[2][1] += lavaRuneCount; } if (infiniteFireRunes) { amounts[3][1] = -1; } else { amounts[3][1] += inventory.getAmount("Fire rune"); amounts[3][1] += smokeRuneCount; amounts[3][1] += steamRuneCount; amounts[3][1] += lavaRuneCount; } // NON-ELEMENTAL RUNES amounts[4][1] = inventory.getAmount("Body rune"); amounts[5][1] = inventory.getAmount("Mind rune"); amounts[6][1] = inventory.getAmount("Cosmic rune"); amounts[7][1] = inventory.getAmount("Chaos rune"); amounts[8][1] = inventory.getAmount("Nature rune"); amounts[9][1] = inventory.getAmount("Law rune"); amounts[10][1] = inventory.getAmount("Death rune"); amounts[11][1] = inventory.getAmount("Astral rune"); amounts[12][1] = inventory.getAmount("Blood rune"); amounts[13][1] = inventory.getAmount("Soul rune"); for (int i = 0; i < amounts.length; i++) { amount = amounts[i]; long requiredCount = amount[0]; long runeCount = amount[1]; if (requiredCount > 0 && runeCount != -1) { castCount = Math.min(castCount, runeCount / requiredCount); } } return castCount; }
-
private boolean isMember; @Override public void onStart() throws InterruptedException { isMember = askIsMember(); } /** * * @return <tt>Account is member</tt> */ private boolean askIsMember() { return JOptionPane.showConfirmDialog(bot.getCanvas(), "Are you a member?", "Membership", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; } You're welcome.
-
I've checked it and it's safe. It's also very nice. Two little bits of constructive criticism: Don't bother grabbing stuff like bones and feathers until you're inside of the CHICKEN_AREA. Until then, just leave those variables null. Your main script logic is determined by the player's inventory state (whether it's full), which works well for a simple script. However, if you decide to tack on more for a bigger project in the future, you should consider making your main script logic be determined firstly by where your player is.
-
Make life easy for yourself and store them in a HashMap or something. Unless we're talking +20 values, then look into alternative options.
-
I've just found this snippet of code from here. Adapt and try it: String url = "jdbc:mysql://localhost:3306/javabase"; String username = "java"; String password = "password"; System.out.println("Connecting database..."); try (Connection connection = DriverManager.getConnection(url, username, password)) { System.out.println("Database connected!"); } catch (SQLException e) { throw new IllegalStateException("Cannot connect the database!", e); } If this doesn't work, then one option may be to create a PHP/ASP.NET website which handles the server stuff for you when you hit the URL with some URL parameters: http://myawesomebottracker.com/?howmanylogs=10&timeinminutes=2014213213121212 etc.
-
If you've tested the code and it works, but doesn't when applied to OSBot, then OSBot's at fault. Likely, the OSBot's SecurityManager is preventing you from running this. Check the OSBot logger for details; be sure to add logger.error(e) to your exception block, so that any errors that occur are logged out to OSBot's logger. :edit: I just spotted a Class.forName(driver); in your code, and I'm almost certain that's blocked in OSBot through my own trial and error.
-
Before we circlejerk ourselves into never using exist, here's why you need it: things disappear. A tree becomes a stump when cut down; a guard becomes a pile of bones when slayed; a fire burns itself to ashes. I don't think there's ever a case for calling getClosest more than once for the same entity. You should be caching the entities you've found, because they're known. Then you should validate that entity before scrapping it to find it again. If the entity's null, or the entity no longer exists, or the entity no longer tests true against the initial filters, then you should re-find that entity.
-
IF some condition THEN RETURN something ELSE IF some condition THEN RETURN something ELSE RETURN something RETURN something Look at this pseudo code. RETURN statements are the exit points to your code. That last ELSE statement is a catch-all for when the aforementioned conditions weren't met. Your program can't get to that very lats RETURN statement, because there's a RETURN in your last ELSE statement. :edit: Programming using states can be really useful if you know what you're doing. A few tips are: If you're going to have one routine (aka. "functions") that finds the state and another that acts upon the state, please for the love of god let those functions share what they already know! If both of those routine are having to find your fire, then you're doing it wrong. This is where field variables come in handy. Look it up. If you've got less than 5 states in total, this might not be the best approach; it's an unnecessary pile of extra lines of code for no actual beneficial outcome. Even though you're technically programming in Java, the end product is a script. So unless you're doing a complex project, just write a script like you would a script. Here's a quick ad hoc way of how I'd go about writing a script like the one you're doing: // ... RS2Object fire; @Override public int onLoop() { if ( isLightingAFire() ) { waitForFireToBeLit(); } else if ( isCooking() ) { sleepUntilWereOutOfFood(); } else if ( shouldBank() ) { goBank(); } else if ( isFireAvailable() ) { cookOnFire(); } return 100; } /* * Other methods */ private boolean isLightingAFire() { return myPlayer().getAnimation() == 0; // TODO - change to fire animation } private void waitForFireToBeLit() { // TODO } private boolean isCooking() { return myPlayer().getAnimation() == 0; // TODO - change to cooking animation } private void sleepUntilWereOutOfFood() { // TODO // use conditional sleep } private boolean shouldBank() { return !inventory.contains("Raw lobsters") || !inventory.contains("Logs") || !inventory.contains("Tinderbox"); } private void goBank() { // TODO } private void cookOnFire() { // TODO // Note: you can reference 'fire' as it's a field variable (aka. accessible to this function) // also we can assert that fire exists, becuase this function doesn't run unless it does } private boolean isFireAvailable() { if (fire == null || !fire.exists()) { fire = objects.closest("Fire"); } return fire != null && fire.exists(); } // ... I've padded it out with line-breaks to try make it visually clearer. But pay close attention to the onLoop function; that's effectively our header block for the script, and you can sit on the other side of the room and still be able to read exactly what the bot's doing. The onLoop function is so clearly laid out that nobody, no matter how new they are to scripting, should have an issue trying to understand that the bot's trying to do. It's direct, readable, and can be easily maintained.
-
Your question has been answered. But additionally, make fire a field variable. Otherwise, you're going to have to re-find the fire when you come to cooking on the fire. :edit: Be sure to set the fire variable in your getState function.
-
npc.isHitBarVisible() and npc.isUnderAttack() not working in filters?
liverare replied to Roast's topic in Scripting Help
Something like this: private boolean isChicken(NPC npc) { return npc.getName().equals("Chicken"); } private boolean isInFightingZone(NPC npc) { return chickenArea.contains(npc); } private boolean isNotFightingOrIsFightingMe(NPC npc) { Character<?> interactingWith = npc.getInteracting(); return interactingWith == null || !interactingWith.exists() || interactingWith.equals(myPlayer()); } private boolean fightableChicken(NPC npc) { return isChicken(npc) && isInFightingZone(npc) && isNotFightingOrIsFightingMe(npc); } public NPC getNextChicken() { return npcs.closest(this::fightableChicken); } If you wanted to take this to the next level, you could run through an entire list of players (excluding yourself) and figure out who's interacting with (aka. attacking) what. Then you could cross-reference that to see whether somebody's trying to steal your chicken. -
No. The SecurityManager will block stuff like this. But if you're looking to execute Jars programatically anyhow, then check this out. You could run your program which boots up OSBot.
-
How did you learn to put all your knowledge together?
liverare replied to weJ's topic in Software Development
C This is a pretty low procedural language. Perhaps you could build some hard, statistical algorithms. C#, HTML,CSS, JavaScript, MySQL, PHP, ASP.NET Go and become a full-stack developer. C# is used in ASP.NET to build dynamic webpages. MySQL is a basic database language to give that dynamic webpage some data to load and play with. HTML, CSS, and JS will help make that dynamic webpage even more aesthetically pleasing. Try pick up NoSQL, Oracle SQL, and some other querying languages; Handlebars, Angler JS and other templating libraries. Build yourself a portfolio website.