Jump to content

Search the Community

Showing results for tags 'Java'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • OSBot
    • News & Announcements
    • Community Discussion
    • Bot Manager
    • Support Section
    • Mirror Client VIP
    • Script Factory
  • Scripts
    • Official OSBot Scripts
    • Script Factory
    • Unofficial Scripts & Applications
    • Script Requests
  • Market
    • OSBot Official Voucher Shop
    • Currency
    • Accounts
    • Services
    • Other & Membership Codes
    • Disputes
  • Graphics
    • Graphics
  • Archive

Product Groups

  • Premium Scripts
    • Combat & Slayer
    • Money Making
    • Minigames
    • Others
    • Plugins
    • Agility
    • Mining & Smithing
    • Woodcutting & Firemaking
    • Fishing & Cooking
    • Fletching & Crafting
    • Farming & Herblore
    • Magic & Prayer
    • Hunter
    • Thieving
    • Construction
    • Runecrafting
  • Donations
  • OSBot Membership
  • Backup

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location:


Interests

  1. import java.applet.*; import java.awt.*; import java.awt.event.*; public class Bezier extends Applet implements MouseListener, MouseMotionListener, Runnable { double[] [] point = new double [5] [2]; int dragged; Thread t; Graphics b; Image offscreen; int mode; public void init () { mode = 3; dragged = -1; for (int i = 0 ; i < point.length ; i++) { point [i] [0] = (int) (Math.random () * 800); point [i] [1] = (int) (Math.random () * 600); } setFocusable (true); addMouseListener (this); addMouseMotionListener (this); t = new Thread (this); t.start (); offscreen = createImage (800, 600); b = offscreen.getGraphics (); } // init method public void update (Graphics g) { paint (g); } public void run () { while (true) { repaint (); try { t.sleep (10); } catch (InterruptedException e) { } } } public void paint (Graphics g) { b.setColor (Color.white); //clears the buffer b.fillRect (0, 0, 800, 600); b.setColor (Color.red); b.fillRect (0, 0, 100, 30); b.setColor (Color.black); switch (mode) { case 1: b.drawString ("Adding nodes", 10, 20); break; case 2: b.drawString ("Deleting nodes", 10, 20); break; case 3: b.drawString ("Moving nodes", 10, 20); break; } for (int i = 0 ; i < point.length ; i++) { b.fillOval ((int) (point [i] [0] - 10), (int) (point [i] [1] - 10), 20, 20); } b.setColor (Color.blue); for (int i = 0 ; i < point.length - 1 ; i++) { b.drawLine ((int) (point [i] [0]), (int) (point [i] [1]), (int) (point [i + 1] [0]), (int) (point [i + 1] [1])); } double[] current = new double [2]; b.setColor (Color.green); for (double t = 0 ; t <= 1 ; t += 0.0005) { current = Bez (t, point); b.fillOval ((int) current [0] - 2, (int) current [1] - 2, 4, 4); } g.drawImage (offscreen, 0, 0, this); } // paint method public double[] Bez (double t, double[] [] point) { if (point.length == 1 /*|| t < 0 || t > 1*/) { double[] New = new double [2]; New [0] = point [0] [0]; New [1] = point [0] [1]; return New; } double[] [] New = new double [point.length - 1] [2]; for (int i = 0 ; i < New.length ; i++) { New [i] [0] = ((1 - t) * point [i] [0]) + (t * point [i + 1] [0]); New [i] [1] = ((1 - t) * point [i] [1]) + (t * point [i + 1] [1]); } return Bez (t, New); } public void mouseClicked (MouseEvent e) { } public void mouseMoved (MouseEvent e) { } public void mouseReleased (MouseEvent e) { dragged = -1; } public void mouseEntered (MouseEvent e) { } public void mouseExited (MouseEvent e) { } public void mousePressed (MouseEvent e) { if (e.getX () >= 0 && e.getX () <= 100 && e.getY () >= 0 && e.getY () <= 30) { // red button was clicked switch (mode) { case 1: mode = 2; break; case 2: mode = 3; break; case 3: mode = 1; break; } // switch (mode) } // if (e.getX () >= 0 && e.getX () <= 100 && e.getY () >= 0 && e.getY () <= 30) // mode: 1=add; 2=delete; 3=move else if (mode == 1) { dragged = -1; double[] [] temp = point; point = new double [temp.length + 1] [2]; for (int i = 0 ; i < temp.length ; i++) { point [i] [0] = temp [i] [0]; point [i] [1] = temp [i] [1]; } // for (int i = 0 ; i < temp.length ; i++) point [point.length - 1] [0] = e.getX (); point [point.length - 1] [1] = e.getY (); } // if (mode == 1) else if (mode == 2) { dragged = -1; for (int i = 0 ; i < point.length ; i++) { if (Dist ((double) e.getX (), (double) e.getY (), point [i] [0], point [i] [1]) <= 10) { // delete this index for (int j = i ; j < point.length - 1 ; j++) { point [j] [0] = point [j + 1] [0]; point [j] [1] = point [j + 1] [1]; } // for (int j = i ; j < point.length ; j++) double[] [] temp = point; point = new double [temp.length - 1] [2]; for (int j = 0 ; j < point.length ; j++) { point [j] [0] = temp [j] [0]; point [j] [1] = temp [j] [1]; } // for (int j = 0 ; j < point.length ; j++) } // if (Dist ((double) e.getX (), (double) e.getY (), point [i] [0], point [i] [1]) <= 10) } // for (int i = 0 ; i <= point.length ; i++) } // else if (mode == 2) else if (mode == 3) { for (int i = 0 ; i <= point.length ; i++) { try { if (Dist ((double) e.getX (), (double) e.getY (), point [i] [0], point [i] [1]) <= 10) { dragged = i; } // if (Dist ((double) e.getX (), (double) e.getY (), point [i] [0], point [i] [1]) <= 10) } // try catch (Exception ex) { } // catch (Exception ex) } // for (int i = 0 ; i <= point.length ; i++) } } public double Dist (double x1, double y1, double x2, double y2) { return Math.pow (Math.pow (x2 - x1, 2) + Math.pow (y2 - y1, 2), 0.5); } public void mouseDragged (MouseEvent e) { if (dragged != -1) { point [dragged] [0] = e.getX (); point [dragged] [1] = e.getY (); } } }
  2. This time on a different botting site.. spent $200 usd on sponsor there aswell lolol LEDgend!
  3. Here is a simple world map app I would like to share with you guys. I personally hate having to go to runescape website every time to look at the map so I made this to save time. You can save it anywhere you want and run it, note this is not a script, it's a standalone app. It lets you zoom in/out and pan around. http://up.ht/19XDlpp Reuploaded 10/21/13
  4. Rah

    SwiftFlax

    SwiftFlax Current version: N/A Date started: 29/09/2013 Hello reader, I'm creating a script called "SwiftFlax". The script will obviously pick flax, and then proceed to bank them once the bots inventory is full. So far, I have created the picking part of the script. I wish to improve my proficiency with scripting a bot, so I will start with a pretty basic script. If you wish to leave your support, a tip, or anything that could potentially help me, I would greatly appreciate it. So far, I have created a way for the bot to pick the flax. This is all made off the top of my head, I do not have an account for me to test it with because of the bans that took place on three of my accounts last night. I'll leave this here, and build off on it whenever I get a chance to. I believe in open-sourcing your work, to an extent. This is just the class to execute "picking" the flax. I would like to thank exuals for providing the node tutorial. I really like the organization, and this way helps me understand how to structure things properly. package swiftflax.nodes; import org.osbot.script.Script; import org.osbot.script.rs2.model.Entity; import org.osbot.script.rs2.utility.Area; import swiftflax.api.Node; public class PickNode extends Node { private Area FLAX_FIELD = new Area(0000, 0000, 0000, 0000); // Get the coordinates. private Entity flax; public PickNode(Script script) { super(script); } @Override public boolean validate() throws InterruptedException { return !inventoryIsFull(); } @Override public boolean execute() throws InterruptedException { return pickFlax(); } private boolean inventoryIsFull() { return s.client.getInventory().isFull(); } private boolean playerBusy() { return s.client.getMyPlayer().isUnderAttack() || s.client.getMyPlayer().isMoving(); } private boolean inFlaxField() { return s.client.getMyPlayer().isInArea(FLAX_FIELD); } private boolean flaxAvailable() { flax = s.closestObjectForName("Flax"); return flax.exists() && flax.isVisible() && flax.isInArea(FLAX_FIELD) && flax != null; } private boolean pickFlax() throws InterruptedException { flax = s.closestObjectForName("Flax"); if (!playerBusy()) { if (inFlaxField()) { if (flaxAvailable() && flax.interact("Pick")) { return true; } } else { s.log("Not in flax field."); // Walk to the flax field. } } else { s.log("Busy."); return false; } return false; } }
  5. I hate retyping the basic script layout every time I write a new script so I made this class. I figured it could also benefit new scripters if I released it on the forums. I'll explain the code in notes. import java.awt.Graphics; import org.osbot.script.Script; import org.osbot.script.ScriptManifest; @ScriptManifest(author = "Cloudnine", info = "TemplateScript v0.1", name = "TemplateScript", version = 0.1)//How the script will show up when you go to start it public class TemplateScript extends Script { long startTime; long runTime; public void onStart() {//This code executes when the script is started log("TemplateScript v0.1 by Cloudnine has initialized!"); startTime = System.currentTimeMillis(); } public void onExit() {//This code executes when the script is stopped log("Thank you for using TemplateScript v0.1 by Cloudnine!"); log("Ran for " + runTime / 1000 + " seconds."); } public void onPaint(Graphics g) {//This is to "paint", or display, content on the screen runTime = System.currentTimeMillis() - startTime; g.drawString("TemplateScript v0.1", 450, 345);//X: 450 (left and right), Y: 345 (up and down) g.drawString("by Cloudnine", 450, 360); g.drawString("Run Time: " + (runTime / 1000), 450, 385); } public int onLoop() throws InterruptedException { /* * Place Code Here */ return 100;//sleeps for 100ms, then restarts this loop } } Even if you don't need the explanation, you can put this in Eclipse and do Ctrl+F, Replace TemplateScript with ScriptName, rather than retyping this over and over. If you want to see the functions OSBot provide you with, visit the api. http://osbot.org/api If you are new to java, and want to learn enough to begin scripting, you can try out the Oracle Java Tutorials. That's where I learned. (Look it up on Google, it's easy to find). Also, for the beginner programmers, download an IDE if you don't use one. That will help you script 10x more efficiently. It's practically impossible to program efficiently without an IDE. An IDE is a text editor made for programmers. Ex: Eclipse, Netbeans, etc.. I prefer Eclipse. Random Tip: If you use Eclipse, press Ctrl+Shift+F to automatically format your code neatly.
  6. Selling this great league account for pp$ or 07 gold. It has 133 skins. Missing the 9 followed champions: Tresh, Elise, Nami, Lucian, Sejuani, Lissandra, Aatrox, Zac & Viktor. Gold Frame! Legendary skins: Pulsefire Ezreal, Gentleman Cho'gath, Demonblade Tryndamere, Brolaf, Corporate Mundo. Pics: http://tinypic.com/r/2vvjt6x/5 http://tinypic.com/r/opzk0/5 Rune pics: http://tinypic.com/r/2wf46jk/5 http://tinypic.com/r/2cqno7b/5 http://tinypic.com/r/aenxpe/5 http://tinypic.com/r/14c7hjr/5 http://tinypic.com/r/v75q3r/5 Contact: Skype: Simondaugaard
  7. This code will show all the item IDs in your inventory and equipment when you view that tab. Imports & Overriding... >>> Add imports: import org.osbot.script.*; import org.osbot.script.rs2.model.Item; import org.osbot.script.rs2.ui.EquipmentSlot; import org.osbot.script.rs2.ui.EquipmentTab; import org.osbot.script.rs2.ui.Tab; import java.awt.*; >>> The override: @Override public void onPaint(Graphics g) { } Step 1 In the onPaint method cast the current Graphics to 2D Graphics and call the method showItemIDs. @Override public void onPaint(Graphics g) { Graphics2D g2 = (Graphics2D)g; showItemIDs(g2); } Step 2 Add the following methods... public void showItemIDs(Graphics2D g2) { Composite old = g2.getComposite(); if(currentTab() == Tab.INVENTORY) { Item[] items = client.getInventory().getItems(); for(int i = 0; i < items.length; i++) { if(currentTab() != Tab.INVENTORY) return; if(items[i] != null) { Rectangle r = client.getInventory().getDestinationForSlot(i); if(r != null) drawItemData(g2, r, items[i].getId()); } } } else if(currentTab() == Tab.EQUIPMENT) { for(Item item : equipmentTab.getItems()) { if(currentTab() != Tab.EQUIPMENT) return; if(item != null) { Rectangle r = client.getInterface(387).getChild(equipmentTab.getSlotForId(item.getId()).childId).getRectangle(); if(r != null) drawItemData(g2, r, item.getId()); } } } g2.setComposite(old); } private void drawItemData(Graphics2D g2, Rectangle r, int id) { int nx = (int) r.getX(), ny = (int) r.getY(), h = g2.getFontMetrics().getHeight(); String s = "" + id; g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.60f)); g2.setColor(Color.WHITE); g2.fillRect(nx + (int) ((r.getWidth() - g2.getFontMetrics().stringWidth(s)) / 2) - 2, ny + h / 4, g2.getFontMetrics().stringWidth(s) + 4, h); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.00f)); g2.setColor(Color.BLACK); g2.drawString(s, nx + (int) ((r.getWidth() - g2.getFontMetrics().stringWidth(s)) / 2), ny + h); } The Result...
  8. Hey, I'm looking for a money making methode for around 200k+/h , 100k+/h would be fine too. But since i don´t have any cash or items ,it shouldn´t have any requierments like gear or capital. It can have any skill or quest requierments ,but would be usefull if its bottable. would be very very nice ,if someone would share one with me (just pm or comment) Thanks!
  9. Hello OSBot scripters, Today I bring to you, a new store class library. I plan to maintain and modify this to work flawlessly. Until the OSBot team is able to add it into their API. I happen to know that there is already an library like this. However that library wasn't maintained or offered support for which I plan to do. Any feedback given will be appreciated and considered. 1. Setting up: A. You add the class files to your source and compile them with it. B. You import the Jar as an external library and include it with your script for usage. 2. Store example: //Make a store instance Store store = new Store(this.bot.getAPI()); //Check if store is open if(store.isOpen()){ //Buy something }else{ //Open the store } 3. Item example: //get item from the store StoreItem item = store.getStoreItem("Bronze arrow"); //interacting with the item if(item != null && item.getAmount>0){ item.interact("Buy 10"); sleep(1000); } Link: Store.java StoreItem.java Releases: v0.2 - Store.jar v0.1 - Store.jar Changelogs:
  10. Hey guys, I'm having a little trouble today and its not been a very good day for me. I lost void and a dbow today to a rushed and got void blocked. I want to get it back as quickly as possibly. For some reason, OSBOT loads on my mac but i cant open a new tab, load any scripts and its just giving me a hard time. If someone can help with this it would be really appreciated. And plus my birthday was yesterday so please help :P Thanks!!
  11. package org.rabrg.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; /** * Grabs prices from the Zybez RuneScape 2007 marketplace. * @author Ryan Greene * */ public final class PriceGrabber { /** * The base of the URL used to grab prices. */ private static final String BASE_URL = "http://forums.zybez.net/runescape-2007-prices/api/"; /** * Gets the price of the item with the specified name. * @param itemName The name of the item. * @return The price of the item. * @throws IOException If an IOException occurs. */ public static Price getPrice(final String itemName) throws IOException { try (final BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(BASE_URL + itemName).openStream()))) { String line = reader.readLine().replaceAll("" + '"', ""); int id = Integer.parseInt(line.split("id:")[1].split(",")[0]); String name = line.split("name:")[1].split(",")[0]; String image = line.split("image:")[1].split(",")[0]; float recentHigh = Float.parseFloat(line.split("recent_high:")[1].split(",")[0]); float recentLow = Float.parseFloat(line.split("recent_low:")[1].split(",")[0]); float average = Float.parseFloat(line.split("average:")[1].split(",")[0]); int highAlch = Integer.parseInt(line.split("high_alch:")[1].split(",")[0]); return new Price(id, name, image, recentHigh, recentLow, average, highAlch); } } /** * Represents a single price of an item. * @author Ryan Greene * */ public static final class Price { /** * The id of the item. */ private final int id; /** * The name of the item. */ private final String name; /** * The image of the item. */ private final String image; /** * The recent high price of the item. */ private final float recentHigh; /** * The recent low price of the item. */ private final float recentLow; /** * The average price of the item. */ private final float average; /** * The high alch value of the item. */ private final int highAlch; /** * Constructs a new price. * @param id * @param name * @param image * @param recentHigh * @param recentLow * @param average * @param highAlch */ private Price(int id, String name, String image, float recentHigh, float recentLow, float average, int highAlch) { this.id = id; this.name = name; this.image = image; this.recentHigh = recentHigh; this.recentLow = recentLow; this.average = average; this.highAlch = highAlch; } /** * Gets the id of the item. * @return The id of the item. */ public int getId() { return id; } /** * Gets the name of the item. * @return The name of the item. */ public String getName() { return name; } /** * Gets the image of the item. * @return The image of the item. */ public String getImage() { return image; } /** * Gets the recent high price of the item. * @return The recent high price of the item. */ public float getRecentHigh() { return recentHigh; } /** * Gets the recent low price of the item. * @return The recent low price of the item. */ public float getRecentLow() { return recentLow; } /** * Gets the average price of the item. * @return The average price of the item. */ public float getAverage() { return average; } /** * Gets the high alch value of the item. * @return The high alch value of the item. */ public int getHighAlch() { return highAlch; } } }
  12. Th3 AIO Tab Maker Update: Progress 1. GUI - Done 2. Auto Locate Study Room and find a way inside. It will attempt to open doors. - Done 3. Fail-safe from combat randoms, makes sure a door is open in the study room to allow OSBot to run to safe spot - Done 4. Locate butler and request more soft clay - Done 5. Pay butler when needed - done 6. Join home portal back in case it ends up logging out - Done 7. Paint - done 8. Join host home - Not done 9. Sell and buy soft clay from general store - Not done 10. Fail-safe - Use dinning room bell to summon butler in case butler is too far away - Not done 11. Make it bit more efficient it gets 600-800 tabs P/H I want to make it a solid 700-900. - Not done Trial download for bug testing. http://up.ht/14EezxG For the time being it will only work with a butler and stop after 30 minutes, until the release status is decided. Please post any bugs you find. Personally I want to release the script for free; however, I'm curious what you guys think.
  13. i just downloaded this bot, i keep getting a grey screen on my OSBOT beta 1.7.28, and this error " Failed to load client".... help I tried opening new tabs, and all that good stuff... whats going on? does the bot need a update? has rs updated again?! helpppp
  14. everytime i get on it says "error loading java scripts" which is all but one of my scripts. please help this error is making osbot useless for me.
  15. I´ve got hacked yesterday, first realized it now (yesterday was my birthday so i wasnt playing or botting. I´m not sure how i got hacked , i´ve not doing anything else then bot and check facebook since 2 weeks. Also i never got hacked befor. Does anyone know if you can get hacked from a script? I failed once typening my rs username and passsword instead of my osbot os username and password ,while logging on a cmhs script. I´m sorry for all misstakes
  16. I have been coding a couple of basic scripts to get me used to writing, and if you're looking for bots, you usually find them spinning flax non-stop. So I figured I'd give writing a Flax-spinner a shot I'm looking for advice on how to improve, so please be critical. package spinner; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import org.osbot.script.Script; import org.osbot.script.ScriptManifest; import org.osbot.script.rs2.map.Position; import org.osbot.script.rs2.model.Entity; import org.osbot.script.rs2.model.Player; import org.osbot.script.rs2.skill.Skill; import org.osbot.script.rs2.ui.Bank; import org.osbot.script.rs2.ui.Inventory; import org.osbot.script.rs2.utility.Area; @ScriptManifest(author = "Hobroski", info = "Spins flax at Lumbridge", name = "Spinner", version = 1.0D) public class Spinner extends Script { final Area SPIN_AREA = new Area(3208, 3212, 3210, 3213); final Area BANK_AREA = new Area(2307, 3218, 3210, 3220); final Area NFLAT_AREA = new Area(3205, 3209, 3205, 3209); final Area DFLAT_AREA = new Area(3206, 3208, 3206, 3208); final Area ODOOR_AREA = new Area(3207, 3214, 3207, 3214); final Position NSTAIR_POS = new Position(3205, 3208, 2); final Position DSTAIR_POS = new Position(3204, 3207, 1); int NSTAIR_ID = 1316; int DSTAIR_ID = 2718; int CDOOR_ID = 20857; static Timer runtime; int sEXP; int sLVL; int flaxSpun = 0; boolean init = true; private int experienceToNextLevel(Skill skill) { int[] xpForLevels = new int[] { 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333, 111945, 123660, 136594, 150872, 166636, 184040, 203254, 224466, 247886, 273742, 302288, 333804, 368599, 407015, 449428, 496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895, 1096278, 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818, 2421087, 2673114, 2951373, 3258594, 3597792, 3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614, 8771558, 9684577, 10692629, 11805606, 13034431 }; int xp = client.getSkills().getExperience(skill); for (int i = 0; i < 99; i++) { if (xp < xpForLevels[i]) { return (xpForLevels[i] - xp); } } return (200000000 - xp); } public void onStart() { runtime = new Timer(0); } private void init() { if (client.getLoginState() == 30 && init) { sEXP = client.getSkills().getExperience(Skill.CRAFTING); sLVL = client.getSkills().getLevel(Skill.CRAFTING); try { client.rotateCameraPitch(random(25, 32)); } catch (InterruptedException e) { } init = false; } } public int onLoop() { Player player = client.getMyPlayer(); Bank bank = client.getBank(); Inventory inven = client.getInventory(); try { init(); if (inven.contains("Flax") && !player.isMoving()) { if (BANK_AREA.contains(player)) { client.moveCameraToPosition(NSTAIR_POS); if (NSTAIR_POS.isVisible(bot) && BANK_AREA.contains(player)) { NSTAIR_POS.interact(bot, "Climb-down"); sleep(random(400, 800)); } } if (DFLAT_AREA.contains(player) || SPIN_AREA.contains(player) || ODOOR_AREA.contains(player) && !player.isMoving()) { Entity spinningWheel = closestObjectForName("Spinning wheel"); client.moveCameraToEntity(spinningWheel); if (spinningWheel.isVisible()) { if (spinningWheel.interact("Spin")) { sleep(random(2000,3000)); } else { Entity closedDoor = closestObject(CDOOR_ID); closedDoor.interact("Open"); } } } if (this.client.getInterface(459).getChild(89).isVisible()) { sleep(random(900, 2000)); this.selectInterfaceOption(459, 89, "Make X"); sleep(random(900, 2000)); client.typeString("28"); } } else { if (SPIN_AREA.contains(player) && !player.isMoving()) { if (DSTAIR_POS.isVisible(bot)) { DSTAIR_POS.interact(bot, "Climb-up"); } else { client.moveCameraToPosition(DSTAIR_POS); } } if (NFLAT_AREA.contains(player) && !player.isMoving()) { Entity bankBooth = closestObjectForName("Bank booth"); if (bankBooth.isVisible()) { bankBooth.interact("Bank"); } else { client.moveCameraToEntity(bankBooth); } } if (BANK_AREA.contains(player) && !player.isMoving()) { if (!bank.isOpen()) { Entity bankBooth = closestObjectForName("Bank Booth"); bankBooth.interact("Bank"); sleep(1000); } if (inven.isEmpty()) { bank.withdrawAll(1779); bank.close(); } if (inven.contains("Bow string")) { bank.depositAll(); } } } } catch (Exception e) { } return 50; } public void onExit() { } public void onPaint(Graphics g) { int gLVL = client.getSkills().getCurrentLevel(Skill.CRAFTING) - sLVL; int cLVL = client.getSkills().getCurrentLevel(Skill.CRAFTING); int cEXP = client.getSkills().getExperience(Skill.CRAFTING); flaxSpun = (cEXP - sEXP) / 15; Graphics2D gr = (Graphics2D) g; gr.setColor(Color.WHITE); gr.setFont(new Font("Arial", Font.PLAIN, 10)); gr.drawString("Time ran : " + Timer.format(runtime.getElapsed()), 25, 50); gr.drawString("Flax spun : " + flaxSpun, 25, 65); gr.drawString("Flax spun per hour : " + getPerHour(flaxSpun), 25, 80); gr.drawString("Profit gained : " + flaxSpun * 45, 25, 95); gr.drawString("Profit per hour : " + getPerHour(flaxSpun * 45), 25, 110); gr.drawString("Experience gained : " + (cEXP - sEXP), 25, 125); gr.drawString("Experience per hour : " + getPerHour(cEXP - sEXP), 25, 140); gr.drawString( "Starting Level / Current level : " + sLVL + " / " + cLVL, 25, 155); gr.drawString("Levels gained : " + gLVL, 25, 170); gr.drawString("Experience to next level : " + experienceToNextLevel(Skill.CRAFTING), 25, 185); } public static int getPerHour(int value) { if (runtime != null && runtime.getElapsed() > 0) { return (int) (value * 3600000d / runtime.getElapsed()); } else { return 0; } } public static long getPerHour(long value) { if (runtime != null && runtime.getElapsed() > 0) { return (long) (value * 3600000d / runtime.getElapsed()); } else { return 0; } } }
  17. V1.1 Released! Hello, For all my scripts I require a walking class so I made this class that DOESN'T glitch/pause on breaks. Example (V1.1): This class/package is able to: Manage the run energy Open doors (ONLY closed ones) Clicks next Position when it is in range for smooth walking Path randomization which can be turned of for each position DOESN'T glitch/stop Easy to use! Has a debug paint Requirements/How to implement: Import the jar first (You can also open the JAR with 7Zip and go to the walker folder for the source) States makes this alot easier. First you need to make a new PathTile, a PathTile is a class that extends Position so you can use it as a Position aswell. By not specifying the randomize boolean it will be true (so randomized) PathTile tile = new PathTile(Entity ent); PathTile tile = new PathTile(Entity ent, boolean randomize); PathTile tile = new PathTile(int x, int y, int z); PathTile tile = new PathTile(int x, int y, int z, int randomize); Then you make a PathTile array PathTile[] pathTiles = new PathTile[] { new PathTile(3186, 3429, 0), new PathTile(3191, 3429, 0), new PathTile(3196, 3429, 0), new PathTile(3196, 3424, 0), new PathTile(3197, 3419, 0, false) }; // By not specifying the randomize boolean it will be true (so randomized) After that you can make a new Path Path path = new Path(Script s, PathTile[] pathtiles, int maxRandom); // For example Path path = new Path(this, pathTiles, 2); // This will make a new Path with the Path Tiles we made before and the randomization value is 2. (So the x can vary between -2 and 2) Then we need to make our walker class Walker walker = new Walker(Script s, int doorDistance); // For example Walker walker = new Walker(this, 2); So how do we combine these things? Because it doesn't glitch on breaks you should use states. if (State.START_WALK) { path.start(); } if (State.IS_WALKING) { walker.walkPath(path); } // For the IS_WALKING state you can use path.isWalking(); // For the START_WALK state you could use an area for example. If you want to draw the debug paint then put this in your onPaint: //Make walker and your path public/private/protected public void onPaint(Graphics g) { this.walker.drawDebug(g, this.path); } If you want to draw the path on screen then put this in your onPaint: public void onPaint(Graphics g) { this.walker.drawPath(g, this.path, Color.CYAN, Color.RED); } If you don't understand it watch this very basic implementation video: --Updating Changelog; ---------------V1.2--------------- Added Walker.recover(); It will try to find the closest PathTile of the last path and start walking from there. Useful to put in your Idle state (where nothing happens so your bot is stuck) ---------------V1.1--------------- Added drawPath(Graphics g, Path p, Color c1, Color c2) - Credits to jelknab Added doorDistance to the Walker constructor: Walker w = new Walker(Script s, int doorDistance) : if doorDistance is 0 then it won't detect doors! Changed the randomization, the path will be randomized when you use Path.start() and not when getting new points. Source is now in the Walker folder. ---------------V1.0--------------- Release Download V1.2: http://uppit.com/8vp0h4o867xc/AIOWalker.jar Source (Pastebin) V1.2: Path.java: http://pastebin.com/hcUjnafE PathTile.java: http://pastebin.com/4FB7nqYk Walker.java: http://pastebin.com/37tjiZ4g Download V1.1: http://uppit.com/vwqn9srba1k1/AIOWalker.jar Source (Pastebin) V1.1: Path.java: http://pastebin.com/hcUjnafE PathTile.java: http://pastebin.com/4FB7nqYk Walker.java: http://pastebin.com/60M51rcu Download V1.0: http://uppit.com/tlub9ozv2t3o/AIOWalker.jar Source (Pastebin) V1.0: Path.java: http://pastebin.com/y7GdDZLG PathTile.java: http://pastebin.com/VBK0cTnR Walker.java: http://pastebin.com/FV013cG9
  18. Alright, so when I began to get curious about Java.. Like any other person who is familiar with the internet I decided to search Google.. yet there were tons of thing that I didn't know already and I kept getting lost no matter what I found.. so I decided to take a day out and be bound and determined to find something that helped.. I did. I found this guy on YouTube named thenewboston (aka Bucky Roberts) he is a YouTuber from years ago who has made many different videos on different programs and programming languages including Python, jQuery, C++, and JAVA! I began to watch his tutorials, and although they are slow.. they provide a lot of hands on work with the language itself which really helps (in my opinion) to teach you the language.. He has two different difficulties (that I could find at the moment, I believe he has one higher..) and I will be linking you to each playlist now.. Beginner Intermediate Other than Bucky, there ARE some sites out there that can help teach you the basics of some other languages.. one such site is: http://www.codecademy.com/ If this thread does help you, please leave me a comment and let me know, I figured that if I share my knowledge of sources I could help build up the community of Scripters we all would like to have one day. I apologize if this thread seems a bit messy, it does to me for some reason.. I don't know why, might be because I'm running on 48hrs without sleep.. Please let me know if anything is not working/broken. Thanks!
  19. can someone explain to me this \/ catch try {...................} catch (interruptedException e) // TODO Auto-generated catch block e.printStackTrace(); } im trying to create a farming script, and on the onStart() i want it to do more then one action. But i don't fully understand the (catch............). do i only need one (Catch..........), or more then one, if my onStart() has more then one action. public void onStart(){ if (client.getInventory().contains(ectophial) && !EctoArea.contains(myPlayer())){ try { this.client.getInventory().interactWithId(ectophial, "Empty"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (myPlayer().getAnimation()== 714) { while(myPlayer().getAnimation()== 714) { try { sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } state = State.WALKTOECTOHERB; } } }
  20. Link to my simple BCEL bot example with the canvas hooked. https://github.com/HouseMD/HBot There is no updater so the hooks.txt probably contains outdated hooks however if updated, this code would function fine). Example of using Canvas hook (derp mode, painting directly on RS Canvas):
×
×
  • Create New...