Jump to content

CloudCode

Members
  • Posts

    9
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male
  • Location:
    Canada

Contact Methods

  • Skype
    bigmanskyhigh

Recent Profile Visitors

1182 profile views

CloudCode's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. Just recently finished adding a closestBank method and ever since my bot won't load. Eclipse doesn't give many errors or nothing, i'm so confused as to what's is causing it. import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.map.Area; import java.awt.*; import javax.swing.*; @ScriptManifest(name = "MaxChopper", author = "Cloudcode", version = 1.0, info = "", logo = "") public class Main extends Script { public Main() { lastTimeCalled = System.currentTimeMillis() - 900000; } public int wCutLvl; public int attackLvl; public Area closestBank = Bank.getClosestBank(this);; public int highestUsableHatchet; public int highestWieldableHatchet; private long lastTimeCalled; public Area grandExchange = new Area(3162, 3486, 3167, 3486); private JFrame gui; @SuppressWarnings("unused") private String selectedMethod; // Global String variable to store selected option private boolean started = false; // Declared at the top of the script (Global) public void onStart() { log("Script Started..."); createGUI(); } public int getLvls() { wCutLvl = skills.getStatic(Skill.WOODCUTTING); return attackLvl = skills.getStatic(Skill.ATTACK); } @[member='Override'] public int onLoop() throws InterruptedException { if(started){ getHighestUsableHatchet(); getHighestWieldableAxe(); if(highestUsableHatchet == highestWieldableHatchet && inventory.contains(highestUsableHatchet)) { getInventory().interact("Wield", highestWieldableHatchet); } else if (getInventory().equipment.contains(highestWieldableHatchet)) { } else if(!inventory.contains(highestUsableHatchet) || (!getInventory().equipment.contains(highestWieldableHatchet))) { getHatchet(); } if(System.currentTimeMillis() - lastTimeCalled > 900000) { randomizer(); } } return random(200, 300); } @[member='Override'] public void onExit() { log("Stopping Script..."); if(gui != null) { // If the JFrame has been created gui.setVisible(false); // Hide it gui.dispose(); // Dispose } } @[member='Override'] public void onPaint(Graphics2D g) { if(started){ // If the user has started the script // Rest of the paint code } } public void getHatchet() { getWalking().webWalk(closestBank); } public void getHighestUsableHatchet () { if(wCutLvl < 6) { highestUsableHatchet = 1349; } else if(wCutLvl >= 6 && wCutLvl < 11) { highestUsableHatchet = 1353; } else if(wCutLvl >= 11 && wCutLvl < 21) { highestUsableHatchet = 1361; } else if(wCutLvl >= 21 && wCutLvl < 31) { highestUsableHatchet = 1355; } else if(wCutLvl >= 31 && wCutLvl < 41) { highestUsableHatchet = 1357; } else if(wCutLvl >= 41 && wCutLvl < 61) { highestUsableHatchet = 6739; } } public void getHighestWieldableAxe() { if(attackLvl < 5) { highestWieldableHatchet = 1349; } else if(attackLvl >= 5 && attackLvl < 10) { highestWieldableHatchet = 1353; } else if(attackLvl >= 10 && attackLvl < 20) { highestWieldableHatchet = 1361; } else if(attackLvl >= 20 && attackLvl < 30) { highestWieldableHatchet = 1355; } else if(attackLvl >= 30 && attackLvl < 40) { highestWieldableHatchet = 1357; } else if(attackLvl >= 40 && attackLvl < 60) { highestWieldableHatchet = 6739; } } public void randomizer() { } private void createGUI(){ // Declare two constants for width and height of the GUI final int GUI_WIDTH = 350, GUI_HEIGHT = 200; // Get the size of the screen Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // Calculating x and y coordinates final int gX = (int) (screenSize.getWidth() / 2) - (GUI_WIDTH / 2); final int gY = (int) (screenSize.getHeight() / 2) - (GUI_HEIGHT / 2); // Create a new JFrame with the title "GUI" gui = new JFrame("GUI"); // Set the x coordinate, y coordinate, width and height of the GUI gui.setBounds(gX, gY, GUI_WIDTH, GUI_HEIGHT); gui.setResizable(false); // Disable resizing // Create a sub container JPanel JPanel panel = new JPanel(); // Add it to the GUI gui.add(panel); JLabel label = new JLabel("Select a method:"); // Create a label label.setForeground(Color.white); // Set text color to white panel.add(label); // Add it to the JPanel // Create a select box for tree options JComboBox<String> methodSelector = new JComboBox<>(new String[]{"Quickest Method(PowerChopping)", "Profitable Method (Banking)"}); // Add an action listener, to listen for user's selections, assign to a variable called selectedTree on selection. methodSelector.addActionListener(e -> selectedMethod = methodSelector.getSelectedItem().toString()); // Add the select box to the JPanel panel.add(methodSelector); JButton startButton = new JButton("Start"); startButton.addActionListener(e -> { started = true; gui.setVisible(false); }); panel.add(startButton); // Make the GUI visible gui.setVisible(true); } }
  2. What exactly did you do? I am having the same issue as you and i can't seem to figure out what the problem is.
  3. Thank you, no my interest very much lies with learning and having the ability to code without the help of others but i can't get there without somebody i can go to when i get stuck.
  4. Hello user reading this post, i have started using OSBot for about a week now in hopes it will help me further develop my java skills before i head off to college to become a game developer, i have quite a few ideas in mind for scipts and i hope at least a few of them will pan out in the next few months or so. Now to get down to it, i am struggling, the api for me is hard to understand and finding some resources are not easy. I come here in hopes that any of you will be willing to help me, i am looking for somebody i can contact whether it be on this site or skype or even discord, it would really mean alot to me as i work alot better when i have someone i can go to for help, i would even be willing to pay. I love programming and making things come to life and all i need is a little push to get started. Thank you for taking the time to read this post.
  5. CloudCode

    Stealth Quester

    Impressive work being done here.. mind if i test it?
  6. import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.input.mouse.MouseDestination; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.util.ItemContainer; import org.osbot.rs07.api.Equipment; import java.awt.*; @SuppressWarnings("unused") @ScriptManifest(author = "CloudCode", info = "Simple Treecutting script", name = "Logger", version = 1, logo = "") public class Main extends Script { private long timeStart; private String state = "Initializing.."; private int invCount = 0; private int LogsChopped = 0; private int lastMA = 0; int staticLevel = getSkills().getStatic(Skill.WOODCUTTING); Area westBank = new Area( new Position(3167,3414,0), new Position(3184,3435,0)); Area VarrockOak = new Area( new Position(3185, 3436, 0), new Position(3168, 3418, 0)); @Override public void onStart() { log("Welcome to 'Logger' by CloudCode"); log("Submit any Errors to me on the forums and i'd be happy to take a look."); timeStart = System.currentTimeMillis(); getExperienceTracker().start(Skill.WOODCUTTING); } @Override public void onPaint(Graphics2D g) { long timeElapsed = System.currentTimeMillis() - timeStart; long seconds = (timeElapsed / 1000) % 60; long minutes = (timeElapsed / (1000 * 60)) % 60; long hours = (timeElapsed / (1000 * 60 * 60)) % 24; g.setFont(new Font("Trebuchet MS", Font.PLAIN, 14)); g.setColor(Color.white); g.drawString("x", (int)getMouse().getPosition().getX() - 4, (int)getMouse().getPosition().getY() + 5); g.drawString(state, 8, 50); g.drawString("Time Running: " + (hours >= 10 ? "" + hours : "0" + hours) + ":" + (minutes >= 10 ? "" + minutes : "0" + minutes) + ":" + (seconds >= 10 ? "" + seconds : "0" + seconds), 8, 65); g.drawString("XP Gained: " + getExperienceTracker().getGainedXP(Skill.WOODCUTTING) + " (" + getExperienceTracker().getGainedLevels(Skill.WOODCUTTING) + ")", 8, 80); g.drawString("Logs Chopped " + LogsChopped, 8, 95); } @Override public int onLoop() throws InterruptedException { if (getInventory().isFull() && !westBank.contains(myPlayer()) && !getBank().isOpen()) { state = "Banking..."; getWalking().webWalk(new Position(Banks.VARROCK_WEST.getRandomPosition())); if (staticLevel < 6 && !getInventory().contains(1349, 1350,1351, 1352)) { getWalking().webWalk(new Position(Banks.VARROCK_WEST.getRandomPosition())); bank.open(); bank.withdraw(1349, 1350); } } if (getInventory().isFull() && westBank.contains(myPlayer()) && !getBank().isOpen()) { RS2Object bank = getObjects().closest("Bank booth"); state = "Opening bank"; if (bank != null) { if (bank.interact("Bank")) { state = "Depositing items"; sleep(1000); } } } if (getInventory().isFull()) { getWalking().webWalk(new Position(Banks.VARROCK_WEST.getRandomPosition())); bank.open(); bank.depositAll(1521, 1522); } if (!getInventory().contains(1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362)) { state = "Getting a hatchet..."; getWalking().webWalk(new Position(Banks.VARROCK_WEST.getRandomPosition())); getBank().open(); bank.withdraw(1349 | 1350, 1); } if (getInventory().isFull() && westBank.contains(myPlayer()) && getBank().isOpen()) { getBank().depositAllExcept("Axe"); while (getInventory().contains("Logs, Oak Logs, Yew Logs")) { sleep(100); } state = "Closing bank"; getBank().close(); } if (!getInventory().isFull() && !VarrockOak.contains(myPlayer()) && !getBank().isOpen() ) { state = "Walking to Oak Trees"; getWalking().webWalk(new Position(3168 + random(3), 3418 + random(3), 0)); } if (!getInventory().isFull() && VarrockOak.contains(myPlayer())) { NPC spot = getNpcs().closest("Oak"); state = "Finding Tree"; Entity tree = getObjects().closestThatContains("Oak"); if (tree != null){ if (tree.isVisible()){ if (!myPlayer().isMoving() && !myPlayer().isAnimating()){ tree.interact("Chop down"); sleep(random(500,800)); } } } } while (myPlayer().isAnimating()) { state = "Chopping Tree.."; if (getInventory().getEmptySlots() != invCount && VarrockOak.contains(myPlayer())) { invCount = getInventory().getEmptySlots(); LogsChopped += 1; } sleep(random (500, 1000)); } return random (200, 300); } @Override public void onExit() { } } Am i missing something? My code won't run at all. I can select it as a local script but when i hit start it does nothing.
×
×
  • Create New...