Jump to content

fckcruz

Members
  • Posts

    1
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

fckcruz's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. I'm trying to write a script for myself so I can craft green dragon hide body armour. So far it works fine, but there's one issue with the script. Sometimes after clicking "make all" it uses the needle with the green dragonhide leather so the widget pops up again. This happens randomly and even after I don't have enough green dragon leather in my inventory left it still does it once. Can someone help me out? package fckcruz.test1; import java.awt.Color; import java.awt.Graphics2D; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "fckcruz", info = "", logo = "", name = "Green dhide body maker", version = 0) public class Test1 extends Script { @Override public int onLoop() throws InterruptedException { getInventory(); myPlayer(); getObjects(); getWidgets(); if (leatherleft()) { craft(); }else { bank(); } while(myPlayer().isAnimating()) { sleep(1000); } return 1000; } private void bank() throws InterruptedException { if (!getBank().isOpen()) { getBank().open(); } else if (!leatherleft()) { getBank().depositAll(1135); if (getBank().contains("Green dragon leather")) { getBank().withdrawAll("Green dragon leather"); bank.close(); } } else { stop(true); } } private boolean leatherleft() { if(getInventory().getAmount("Green dragon leather") > 3) { return true; }else { return false; } } private boolean CraftScreenVisible() { RS2Widget makewidget = getWidgets().getWidgetContainingText("How many do you wish to make?"); return makewidget != null && makewidget.isVisible(); } public void craft() { if (!myPlayer().isAnimating()) { if (getInventory().contains("Thread") && getInventory().contains("Needle")) { if (getInventory().getSelectedItemName() == null && !CraftScreenVisible()) { if (getInventory().interact("Use", "Needle")) { getInventory().interact("Use", "Green dragon leather"); } } else { getInventory().deselectItem(); } } if(CraftScreenVisible()) { RS2Widget makeBody = getWidgets().get(270, 14); if(makeBody != null) { if(makeBody.isVisible()) { log("visible"); makeBody.interact(); mouse.moveOutsideScreen(); } } } } } public void onStart() { } public void onExit() { } @Override public void onPaint(Graphics2D g) { if (getClient().isLoggedIn()) { Color tanColor = new Color(204, 187, 154); g.setColor(tanColor); g.fillRect(9, 459, 91, 15); } } }
×
×
  • Create New...