Jump to content

dampoe40

Members
  • Posts

    3
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

dampoe40's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. Thanks for some feedback, wondering what you would do different without implementing a lot more to this script. I'm still relative new to writing methods and so i'm not sure if they are written correct, and are usefull the way they are. This is also my first script after reading through the tutorial. Edit: There's also some useless imports im pretty sure since this was also the class i made to fool around ;/ package core; import java.awt.*; import Utils.MouseCursor; import org.osbot.rs07.input.mouse.InventorySlotDestination; import org.osbot.rs07.input.mouse.MouseDestination; import org.osbot.rs07.api.Mouse; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.input.mouse.MouseDestination; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import org.osbot.rs07.api.Camera; import java.util.function.BooleanSupplier; import javax.imageio.ImageIO; @ScriptManifest(author = "You", info = "My first script", name = "WoodcuttingV2", version = 2, logo = "") public class WoodcuttingV2 extends Script { private MouseCursor cursor = new MouseCursor(255, 1, Color.white, this); int invValue = 28; int i = 0; boolean canChop = false; @Override public int onLoop() throws InterruptedException { if (inventoryFull()) { drop(getRs2ObjectTree()); } else { chop(); } return random(150, 200); } private void chop() throws InterruptedException { RS2Object tree = getRs2ObjectTree(); moveMouseOutsideScreen(); Sleep.sleepUntil(this::isPlayerAnimating,3000); if (areaHasTree(tree) && !isPlayerAnimating()) { sleep(random(1000, 5000)); if (!isVisible(tree)) { panCameraToObject(tree); hoverObject(tree); interactWithObject(); Sleep.sleepUntil(this::isPlayerAnimating,3000); } else if (hoverObject(tree)) { interactWithObject(); Sleep.sleepUntil(this::isPlayerAnimating,3000); } moveMouseOutsideScreen(); } } private void drop(RS2Object tree) throws InterruptedException { sleep(random(1000,11000)); dropRowInventory1(); dropRowInventory2(); dropRowInventory3(); dropRowInventory4(); hoverObject(tree); interactWithObject(); } private void interactWithObject() { Sleep.sleepUntil(this::isChopDownVisible, random(73,192)); clickLeftButton(); } private boolean isChopDownVisible() { return getWidgets().getWidgetContainingText("Chop down") != null; } private boolean isPlayerAnimating() { return myPlayer().isAnimating(); } private boolean moveMouseOutsideScreen() { return mouse.moveOutsideScreen(); } private boolean clickLeftButton() { return mouse.click(false); } private boolean hoverObject(RS2Object tree) { return tree.hover(); } private void panCameraToObject(RS2Object tree) { getCamera().toEntity(tree); } private boolean isVisible(RS2Object tree) { return tree.isVisible(); } private boolean areaHasTree(RS2Object tree) { return (getRadius().contains(tree)); } private boolean inventoryFull() { return getInventory().isFull(); } private Area getRadius() { Area radius = myPlayer().getArea(10); return radius; } private RS2Object getRs2ObjectTree() { RS2Object tree = getObjects().closest("Oak"); return tree; } @Override public void onPaint(Graphics2D g) { cursor.paint(g); } private void dropRowInventory1() { keyboard.pressKey(16); for (i = 3; i < 28; i += 4) { if (mouse.move(new InventorySlotDestination(getBot(), i))) { new ConditionalSleep(24, 191) { @Override public boolean condition() { return !mouse.move(new InventorySlotDestination(getBot(), i)); } }.sleep(); mouse.click(false); } } } private void dropRowInventory2() { for (i = 26; i > 1; i -= 4) { if (mouse.move(new InventorySlotDestination(getBot(), i))) { new ConditionalSleep(12, 241) { @Override public boolean condition() { return !mouse.move(new InventorySlotDestination(getBot(), i)); } }.sleep(); mouse.click(false); } } } private void dropRowInventory3() { for (i = 1; i <= 25; i += 4) { if (mouse.move(new InventorySlotDestination(getBot(), i))) { new ConditionalSleep(2, 112) { @Override public boolean condition() { return !mouse.move(new InventorySlotDestination(getBot(), i)); } }.sleep(); mouse.click(false); } } } private void dropRowInventory4() { for (i = 24; i >= 4; i -= 4) { if (mouse.move(new InventorySlotDestination(getBot(), i))) { new ConditionalSleep(7, 192) { @Override public boolean condition() { return !mouse.move(new InventorySlotDestination(getBot(), i)); } }.sleep(); mouse.click(false); } } keyboard.releaseKey(16); } } class Sleep extends ConditionalSleep { private final BooleanSupplier condition; public Sleep(final BooleanSupplier condition, final int timeout) { super(timeout); this.condition = condition; } @Override public final boolean condition() throws InterruptedException { return condition.getAsBoolean(); } public static boolean sleepUntil(final BooleanSupplier condition, final int timeout) { return new Sleep(condition, timeout).sleep(); } }
  2. @GunmanI thought by being able to do this you deviate your script from other scripts since ( I assume) most wil use the drop api for this task. However maybe I'm naïve and believe things rather quick without having experience in scripting/botting. I'm not able to conclude for myself wether it would make sense to implement or not. If going by Preventing RS Botting Bans V3, it wouldn't make sense to add this. But yeah, the reason for wanting to do it this way is antiban.
  3. Is it possible to fetch the coordinates for each item in inventory after it has checked if the previous item has been dropped. What i suggest is, get X,Y from "Oak-logs" (in boundaries of clickable box) move mouse to x,y drop item check if item has dropped get x y from second item etc.. What i currently have for this is only 1 inventory slot, by using the mousehover debug setting and randomzing X/Y in those boundaries. I could do it manually for each and every inventory slot but it seems to me this is a really ineffective way of coding. Conditional sleeps is something I have trouble understanding, if (tree.hover() == true) { new ConditionalSleep(73, 1352) { @Override public boolean condition() { return mouse.click(false); } }.sleep(); } Does it start sleeping after the click? or before the click? And something I also want to ask can i increase the clickspeed/mousevelocity of newmouse? It feels slower which might be better but at the same time if dropping it feels really inefficient. Im not asking for you to provide a solution, rather to send me in the right direction.
×
×
  • Create New...