-
Posts
479 -
Joined
-
Last visited
-
Feedback
100%
Everything posted by Ricky Dactyl
-
Much love to the team for the new release
-
Made 2 characters and got banned within 2 houres..
Ricky Dactyl replied to Hichambaas's topic in Botting & Bans
Please continue.... -
Get current object myPlayer is interacting with
Ricky Dactyl replied to pigfarmer's topic in Snippets
Did this work? -
The usage of states is actually something that I've never worked with before, I thought I'd give it a shot and it turned out to work out allot better than I had hoped, however I'm next looking into Task based scripts, so I'll be delving into that tomorrow ^_^
-
I actually didn't test how much per hour I was getting, I only made this script with the intent of getting from 5-20 crafting so I could bot sapphire rings, sorry my dude, if I get time tomorrow I'll add an overlay for it to display rings/hour
-
This script was made with the intent for the crafting of Gold Rings in AlKharid. I made this for my own personal use, if you're going to use it then I recommend the following to ensure it works as intended. Start the script in AlKharid Ensure gold bars are visible in the bank Ensure mould is visible in the bank Download Jar : Crafter.jar For anyone interested the code is below package com.shrykur.craft; import java.util.ArrayList; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.input.mouse.RectangleDestination; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Shrykur", info = "Crafting", logo = "", name = "Crafting", version = 0) public class Node extends Script { private Area bankArea; private Area furnaceArea; private Position position; private Boolean isSmelting; private Integer level; public ArrayList<Integer> items; private enum State { IN_BANK, BANKING, WALKING, IN_FURNACE, SMELTING; } @Override public void onStart() { this.setIsSmelting(false); this.setLevel(this.getSkills().getStatic(Skill.CRAFTING)); items = new ArrayList<>(); items.add(1592); items.add(2357); items.add(1635); // Setting AlKharid Areas this.position = this.myPosition(); this.setBankArea(new Area(3271, 3162, 3269, 3170)); this.setFurnaceArea(new Area(3279, 3184, 3274, 3186)); } @Override public int onLoop() throws InterruptedException { this.position = this.myPosition(); int chance = random(0, 2500); if (this.getLevel() != this.skills.getStatic(Skill.CRAFTING)) { this.setLevel(this.getSkills().getStatic(Skill.CRAFTING)); this.setIsSmelting(false); chance = 0; } if (chance == 0) { this.getTabs().open(Tab.SKILLS); if (this.widgets.isVisible(320, 13)) { RectangleDestination craftingTab = new RectangleDestination(bot, this.widgets.get(320, 13).getBounds()); this.mouse.move(craftingTab); sleep(random(1000, 5000)); this.getTabs().open(Tab.INVENTORY); } } switch (getState()) { case IN_BANK: { if (!this.inventory.contains(items.get(0)) || !this.getInventory().contains(items.get(1))) { this.getBank().closest().interact("Bank"); } break; } case BANKING: { if (!this.getInventory().contains(items.get(0))) { if (this.getBank().contains(items.get(0))) { this.getBank().withdraw(items.get(0), 1); } } if (!this.getBank().contains(items.get(1))) { stop(); } if (this.getInventory().contains(items.get(2))) { this.getInventory().getItem(items.get(2)).interact("Deposit-All"); } if (!this.getInventory().contains(items.get(1))) { this.getBank().withdrawAll(items.get(1)); } this.getWalking().webWalk(this.getFurnaceArea()); break; } case WALKING: { if (!this.myPlayer().isMoving()) { if (this.getBankArea().contains(this.closestPositionToPlayer())) { this.getWalking().webWalk(this.getBankArea()); } else { if (this.getObjects().closest(1535) != null) { RS2Object door = this.getObjects().closest(1535); if (door.getPosition().equals(new Position(3279, 3185, 0))) { door.interact("Open"); } } this.getWalking().webWalk(this.getFurnaceArea()); } } break; } case IN_FURNACE: { if (!this.inventory.contains(items.get(1))) { this.getWalking().webWalk(this.bankArea); } if (!this.myPlayer().isAnimating()) { Entity furnace = this.getObjects().closest("Furnace"); while (!furnace.isVisible()) { this.getCamera().toEntity(furnace); } if (furnace.isVisible() && this.getMap().canReach(furnace)) { furnace.interact("Smelt"); sleep(2000); RS2Widget bronzeWidget = getWidgets().get(446, 7); if (bronzeWidget != null) { bronzeWidget.interact("Make-All"); this.setIsSmelting(true); } } } break; } case SMELTING: { if (!this.getInventory().contains(this.items.get(1))) { this.setIsSmelting(false); } break; } default: break; } return 500; } private Position closestPositionToPlayer() { Position closest_destination = null; for (Position p : this.getFurnaceArea().getPositions()) { if (closest_destination != null) { if (p.distance(this.position) < closest_destination.distance(this.position)) { closest_destination = p; } } else { closest_destination = p; } } for (Position p : this.getBankArea().getPositions()) { if (closest_destination != null) { if (p.distance(this.position) < closest_destination.distance(this.position)) { closest_destination = p; } } else { closest_destination = p; } } return closest_destination; } public State getState() { if (this.getBank().isOpen()) { return State.BANKING; } else if (this.bankArea.contains(position)) { return State.IN_BANK; } else if (getIsSmelting().equals(true)) { return State.SMELTING; } else if (this.furnaceArea.contains(position)) { return State.IN_FURNACE; } return State.WALKING; } public Area getBankArea() { return bankArea; } public void setBankArea(Area bankArea) { this.bankArea = bankArea; } public Area getFurnaceArea() { return furnaceArea; } public void setFurnaceArea(Area furnaceArea) { this.furnaceArea = furnaceArea; } public Boolean getIsSmelting() { return isSmelting; } public void setIsSmelting(Boolean isSmelting) { this.isSmelting = isSmelting; } public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } }
-
Your momma's so fat she's got enough chins for 99 range
-
I respect your input and thank you for doing so, I'd rather you just tell me straight up rather than mock any work that anyone contributes, it's more productive that way. I completely agree with everything you said however for me this was just a quick fix for an issue I was having while suicide bottling some seeds, thank you though!
-
I mean more or less the whole reason for this class was to do with this portion of the code, but okay. public void withdrawItem(String name, int amount) { if (!this.isVisible(name)) { // Moves scroll bar to the top of the bank this.mouse.click(new RectangleDestination(bot, new Rectangle(482, 99, 10, 1))); // Holds left click on downward arrow until item is visible RectangleDestination rd = new RectangleDestination(bot, new Rectangle(482, 280, 3, 10)); this.mouse.continualClick(rd, new Condition() { @Override public boolean evaluate() { return isVisible(name); } }, false); } switch (amount) { case 1: { this.getItem(name).interact("Withdraw-1"); break; } case 5: { this.getItem(name).interact("Withdraw-5"); break; } case 10: { this.getItem(name).interact("Withdraw-10"); break; } default: { try { this.getItem(name).interact("Withdraw-X"); this.script.sleep(1000); this.script.getKeyboard().typeString(String.valueOf(amount)); } catch (InterruptedException e) { e.printStackTrace(); } break; } } }
-
I took what you @Alek into consideration about widgets and based it purely from client mouse location (updated the class btw), the class no longer uses widgets and uses a less bot like withdraw method while catering for specific amounts of items being withdrawn. Encase someone stumbles upon this thread in the future with the same issue as mine, it should futureproof them. Also worth mentioning, I was using a getItemSlot method within the OSBot API alongside the isSlotVisible method also from the OSBot API, I'm sure on sub-level it was something I was misusing in some shape or form. Thanks for the thoughts on Widgets
-
Hey my dude, Hopefully I can shed some light, the built in Bank within OSBot was open/closing repeatedly without finding the slot requested, the only widget ID I've used is the one for this specific widget I wasn't aware widget ID's changed (I've only been developing for Runescape scripts for a few days.) this.mouse.click(new RectangleDestination(bot, new Rectangle(482, 99, 10, 0))); was specifically to ensure that the slider in the bank is moved to the top most possible point. The drawing out of items singularly was used because it's a personal class I've developed, I was simply putting it here encase anyone had a similar problem to mine then it would help them, either by taking the class as a whole and changing it to their needs or simply taking a specific set of code. Hopefully this has cleared up any questions you had @Alek, I'd like to hear back about the widget ID's if you don't mind ^_^
-
For whatever reason I couldn't get the OSBot's allocated API section regarding finding items in the bank to work, so I came up with my own method to do so. Calling the BankManager object within your main script class. The Class package com.shrykur.bots.thieving; import java.awt.Rectangle; import org.osbot.rs07.Bot; import org.osbot.rs07.api.Bank; import org.osbot.rs07.api.Mouse; import org.osbot.rs07.api.model.Item; import org.osbot.rs07.input.mouse.RectangleDestination; import org.osbot.rs07.script.Script; import org.osbot.rs07.utility.Condition; public class BankManager { private Bot bot; private Mouse mouse; private Bank bank; private boolean canSee; private Script script; public BankManager(Script script) { this.script = script; this.bot = script.getBot(); this.mouse = script.getMouse(); this.bank = script.getBank(); canSee = false; } public boolean containsItem(String name) { if (this.bank.contains(name)) { return true; } return false; } public boolean isVisible(String name) { this.canSee = this.bank.isSlotVisible(bot, getSlot(name), getSlot(name)); return this.canSee; } @SuppressWarnings("static-access") public void withdrawItem(String name, int amount) { if (!this.isVisible(name)) { // Moves scroll bar to the top of the bank this.mouse.click(new RectangleDestination(bot, new Rectangle(482, 99, 10, 1))); // Holds left click on downward arrow until item is visible RectangleDestination rd = new RectangleDestination(bot, new Rectangle(482, 280, 3, 10)); this.mouse.continualClick(rd, new Condition() { @Override public boolean evaluate() { return isVisible(name); } }, false); } switch (amount) { case 1: { this.getItem(name).interact("Withdraw-1"); break; } case 5: { this.getItem(name).interact("Withdraw-5"); break; } case 10: { this.getItem(name).interact("Withdraw-10"); break; } default: { try { this.getItem(name).interact("Withdraw-X"); this.script.sleep(1000); this.script.getKeyboard().typeString(String.valueOf(amount)); } catch (InterruptedException e) { e.printStackTrace(); } break; } } } public void depositInventory() { if (this.bank.isOpen()) { this.mouse.click(new RectangleDestination(bot, new Rectangle(430, 297, 24, 30))); } } public Item getItem(String name) { return this.bank.getItem(name); } public int getSlot(String name) { return this.bank.getSlot(name); } public void close() { this.bank.close(); } } Notes: WithdrawItem(String, Integer) will automatically find the item within your bank. This class is not completed, it's simply what I came up and use for the specific problem of finding and withdrawing a particular item from the bank. BankManager.java