Jump to content

Spazbau5

Members
  • Posts

    4
  • 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.

Spazbau5's Achievements

Newbie

Newbie (1/10)

2

Reputation

  1. Here is the first script I've ever made. I happened to be in Port Phasmatys at the time and had gold ore in my bank lol. All feedback is very appreciated. import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(name = "Gold Smelter", author = "Spazbau5", version = 0.1, info = "Smelts gold bars in Port Phasmatys", logo = "") public class main extends Script { private final Area FORGE_AREA = new Area(3689, 3481, 3682, 3477); private final Area BANK_AREA = new Area(3691, 3471, 3686, 3466); @Override public void onStart() { log(getName() + " v" + getVersion() + " has started!"); } @Override public void onExit() { log(getName() + " v" + getVersion() + " has stopped!"); } @Override public int onLoop() throws InterruptedException { switch (getState()) { case SMELT: log("Current state: SMELT"); RS2Object forge = getObjects().closest("Furnace"); if (forge != null) { if (!myPlayer().isAnimating()) { RS2Widget smeltButton = getWidgets().get(270, 19); if (smeltButton != null) { smeltButton.interact("Smelt"); getMouse().moveOutsideScreen(); } else { sleep(1000); if (!myPlayer().isAnimating()) { forge.interact("Smelt"); return random(4000, 5000); } } } } break; case WALK_TO_FORGE: log("Current state: WALK_TO_FORGE"); getWalking().webWalk(FORGE_AREA); break; case WALK_TO_BANK: log("Current state: WALK_TO_BANK"); getWalking().webWalk(BANK_AREA); break; case DEPOSIT: log("Current state: DEPOSIT"); if (bank.isOpen()) { bank.depositAll(); } else { RS2Object bankBooth = getObjects().closest("Bank booth"); if (bankBooth != null && bankBooth.interact("Bank")) { new ConditionalSleep(10000) { @Override public boolean condition() { return bank.isOpen(); } }.sleep(); } } break; case WITHDRAW: log("Current state: WITHDRAW"); if (bank.isOpen()) { bank.withdrawAll("Gold ore"); } else { RS2Object bankBooth = getObjects().closest("Bank booth"); if (bankBooth != null && bankBooth.interact("Bank")) { new ConditionalSleep(10000) { @Override public boolean condition() { return bank.isOpen(); } }.sleep(); } } break; case IDLE: log("Current state: IDLE"); } return random(700, 2300); } @Override public void onPaint(Graphics2D g) { } enum State { WALK_TO_BANK, DEPOSIT, WITHDRAW, WALK_TO_FORGE, SMELT, IDLE } private State getState() { if (!getInventory().contains("Gold ore")) { if (getInventory().isEmpty()) { log("Entering state: WITHDRAW"); return State.WITHDRAW; } else { log("Entering state: DEPOSIT"); return State.DEPOSIT; } } if (getInventory().contains("Gold ore")) { if (!FORGE_AREA.contains(myPlayer())) { log("Entering state: WALK_TO_FORGE"); return State.WALK_TO_FORGE; } else { log("Entering state: SMELT"); return State.SMELT; } } else if (getInventory().contains("Gold bar")) { if (!BANK_AREA.contains(myPlayer())) { log("Entering state: WALK_TO_BANK"); return State.WALK_TO_BANK; } else { log("Entering state: DEPOSIT"); return State.DEPOSIT; } } log("Entering state: IDLE"); return State.IDLE; } }
  2. Wow those were fast responses... Thanks!
  3. Hey there everyone, as you can tell I'm new here :p So, I'm wanting to learn how to write scripts for OSBot, but I don't have an extensive knowledge on Java, but I do have a basic understanding of it as well as a few years of experience with Python, so basic programming concepts aren't an issue for me. Is there a discord server or anywhere to discuss scripting? I'm probably going to need a little bit of help with structuring scripts, learning the API, and possibly some Java related stuff. I'm looking forward to joining this community, thanks for the help
×
×
  • Create New...