Everything posted by computor
-
Way to add font stroke in paint?
...thanks
-
Way to add font stroke in paint?
Is there a way to add a stroke around your font in a paint?? This is an example:
-
GUI starting positions relative to each other
I tried adding those into setLocationRelativeTo(getOwner()); But it didn't work.....what's the correct format?
-
Computor's Auto-AFKer (for combat)
You just go out of bounds and come back in again. It's a very simple bot, eats + displays a paint. It's not going to fight things, move, walk. It keeps you logged in, warns you if you're out of food, makes noises if you're out of food and at low health, and has a paint. No more, no less. Thank you Molly, you just saved me a lot of space :P
-
GUI starting positions relative to each other
Is there a way to start a script, and have GUIs position themselves relative to each other? For example, the bot starts off like this: But I want the bot to start off with its GUIs next to each other, like this:
-
Hiding/showing paint
I've tried using the tutorial on how to hide/show paints, but for some reason it just crashes my bot. Could anyone give me a WORKING example of it? It being: when you click an area on screen your paint is hidden/shown.
-
How to check ground for array items?
Problem was solved by apaec.
-
How to check ground for array items?
@Apaec, it still only takes the last item on the list. Here's my GUI: private void thisWindowClosed(WindowEvent e) { //use this handler to check to see if the window is closed or not. temp = itemsToPickUp.getText().split("\n"); //on closing, it sets the values in itemsToPickUP to the temp[] array (defined above) after every split (new line). } private void initComponents() { itemsToPickUp = new JTextPane(); //======== scrollPane1 ======== { scrollPane1.setViewportView(itemsToPickUp); } contentPane.add(scrollPane1); scrollPane1.setBounds(25, 60, 215, 105); and here is my array: public String[] temp; and my loop: for (String s : temp) { GroundItem item = this.groundItems.closest(s); if (item != null) if(item.interact("Take")) sleep(random(600,1000)); } Have I done something wrong? I know all the variables are stored into the array that the user puts into the scroll box because I've painted them onscreen to test to see if they were being stored correctly. I just don't know why the loop is only searching for the last item on the list.
-
How to check ground for array items?
How does one change that? (i thought it was grabbing all data, so clearly i'm wrong) Here's my code: http://pastebin.com/h56xBi2t
-
How to check ground for array items?
It still only picks up the last item in the list.
-
How to check ground for array items?
Something like this??? (but this doesn't work) for (int i = 0; i < temp.length; i++){ GroundItem loot = groundItems.closest(temp[i]); loot.interact("Take"); }
-
How to check ground for array items?
I have an array that stores every string value a person puts into it. public String[] temp; temp = itemsToPickUp.getText().split("\n"); (itemsToPickUp is a text box in my GUI) so if the user puts in: Lobster Bones Coins Fire runes it is stored in the array as: temp[0] = "Lobster"; temp[1] = "Bones"; temp[2] = "Coins"; temp[3] = "Fire runes"; and so on for however many items they decide to add into the text box. My problem now is, how do I get the bot to pick the items up off the ground. I've tried: GroundItem loot = groundItems.closest(temp); if (!myPlayer().isAnimating()) { loot.interact("Take"); } but for some reason it only picks up the LAST item in the array, and doesn't check for any other items. So in this instance it would pick up fire runes, and nothing else. How do I get the bot to check for EVERY item in the array?
-
Getting a string from a GUI, and turning it into an Array list
PROBLEM SOLVED ON MY OWN. SOLUTION: public String[] temp; temp = itemsToPickUp.getText().split("\n");
-
Getting a string from a GUI, and turning it into an Array list
I have made a GUI, and I want to take whatever is in the textbox, and turn it in to an array, separated by every new line. Example: In the textbox you would put a variety of items: Lobster Fire rune Bones Coins and then have every single one of those items be the next value in an array. So value 0 in the array would be "Lobster", value 1 would be "Fire rune", and so on. However, I'm running in to a problem where I can only take the ENTIRE string from the textbox. At that point the string has been trimmed (only the indents have been removed). Is there a way to make this happen?? I'm trying to use the split function somehow, but I don't quite get how to put the splitted items into an array, or how to split after every new line. item.split("/n"); does this work???
-
Computor's Auto-AFKer (for combat)
Hello all, I have created (using snippets of code from other people) a bot that AFKs and eats. I'm hoping it's less-bannable than normal AIO fighters. All you have to do is input what you want to train (strictly for GUI purposes) and what food you want to eat (case-sensitive, but recognizes ALL food (not drinks)). It will alert you if there is no food in your inventory, and your health is below 50%. The bot eats food at 50% health. It's great for bandits, and red-spiders, and ankous. I will be adding a "drop collection" GUI to it soon, so it will pick up items off the ground. Code: import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; import java.io.IOException; import java.net.URL; import java.util.concurrent.TimeUnit; import javax.imageio.ImageIO; import java.awt.event.*; import javax.swing.*; @ScriptManifest(name = "AFKer", author = "Computor", version = 1.0, info = "", logo = "") public class AFKer extends Script { private long timeBegan; private int xpPerHour; boolean test = true; //GUI botGUI g = new botGUI(); public boolean guiWait = true; public String foodToEat; public int skillDisplay; private int beginningAttack; private int currentAttackXp; private int currentAttackLevel; private int attackXpGained; private double nextAttackLevelXp; private long timeAttackTNL; private double xpTillNextAttackLevel; private int beginningHitpoints; private int currentHitpointsXp; private int hitpointsXpGained; private int beginningStrength; private int currentStrengthXp; private int currentStrengthLevel; private int strengthXpGained; private double nextStrengthLevelXp; private long timeStrengthTNL; private double xpTillNextStrengthLevel; private int beginningDefense; private int currentDefenseXp; private int currentDefenseLevel; private int defenseXpGained; private double nextDefenseLevelXp; private long timeDefenseTNL; private double xpTillNextDefenseLevel; final int[] XP_TABLE = { 0, 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, 200000000 }; //paint background private final Image bg = getImage("http://s12.postimg.org/wty7h6sb1/AFKer.png"); private final Image bg1 = getImage("http://s1.postimg.org/hoow91tdb/Untitled_1.png"); private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) {} return null; } //end paint background @Override public void onStart() { //Code here will execute before the loop is started timeBegan = System.currentTimeMillis(); beginningAttack = skills.getExperience(Skill.ATTACK); beginningHitpoints = skills.getExperience(Skill.HITPOINTS); beginningStrength = skills.getExperience(Skill.STRENGTH); beginningDefense = skills.getExperience(Skill.DEFENCE); timeAttackTNL = 0; timeStrengthTNL = 0; timeDefenseTNL = 0; g.setVisible(true); } @Override public void onExit() { //Code here will execute after the script ends } @Override public int onLoop() throws InterruptedException { int currentHP = skills.getDynamic(Skill.HITPOINTS); final int timeToEat = skills.getStatic(Skill.HITPOINTS) / 2; if (currentHP <= timeToEat) if(foodToEat != null){ inventory.interact("Eat", foodToEat); if(!inventory.contains(foodToEat)){ Toolkit.getDefaultToolkit().beep(); } } return random(0, 123); } @Override public void onPaint(Graphics2D g) { //This is where you will put your code for paint(s) //background paint Graphics2D gr = g; g.drawImage(bg, 4, 341, null); if (test == false){ if(!inventory.contains(foodToEat)){ g.drawImage(bg1, 1, 1, null); } } //attack currentAttackXp = skills.getExperience(Skill.ATTACK); currentAttackLevel = skills.getStatic(Skill.ATTACK); attackXpGained = currentAttackXp - beginningAttack; xpPerHour = (int)( attackXpGained / ((System.currentTimeMillis() - this.timeBegan) / 3600000.0D)); nextAttackLevelXp = XP_TABLE[currentAttackLevel + 1]; xpTillNextAttackLevel = nextAttackLevelXp - currentAttackXp; if (attackXpGained >= 1) { timeAttackTNL = (long) ((xpTillNextAttackLevel / xpPerHour) * 3600000); } if (skillDisplay == 1){ g.drawString("" + ft(timeAttackTNL), 377, 427); } g.drawString("" + attackXpGained, 203, 427); //strength currentStrengthXp = skills.getExperience(Skill.STRENGTH); currentStrengthLevel = skills.getStatic(Skill.STRENGTH); strengthXpGained = currentStrengthXp - beginningStrength; xpPerHour = (int)( strengthXpGained / ((System.currentTimeMillis() - this.timeBegan) / 3600000.0D)); nextStrengthLevelXp = XP_TABLE[currentStrengthLevel + 1]; xpTillNextStrengthLevel = nextStrengthLevelXp - currentStrengthXp; if (strengthXpGained >= 1) { timeStrengthTNL = (long) ((xpTillNextStrengthLevel / xpPerHour) * 3600000); } if (skillDisplay == 2){ g.drawString("" + ft(timeStrengthTNL), 377, 427); } g.drawString("" + strengthXpGained,220, 458); //Defence currentDefenseXp = skills.getExperience(Skill.DEFENCE); currentDefenseLevel = skills.getStatic(Skill.DEFENCE); defenseXpGained = currentDefenseXp - beginningDefense; xpPerHour = (int)( defenseXpGained / ((System.currentTimeMillis() - this.timeBegan) / 3600000.0D)); nextDefenseLevelXp = XP_TABLE[currentDefenseLevel + 1]; xpTillNextDefenseLevel = nextDefenseLevelXp - currentDefenseXp; if (defenseXpGained >= 1) { timeDefenseTNL = (long) ((xpTillNextDefenseLevel / xpPerHour) * 3600000); } if (skillDisplay == 3){ g.drawString("" + ft(timeDefenseTNL), 377, 427); } g.drawString("" + defenseXpGained, 432, 401); //hitpoints currentHitpointsXp = skills.getExperience(Skill.HITPOINTS); hitpointsXpGained = currentHitpointsXp - beginningHitpoints; g.drawString("" + hitpointsXpGained, 439, 458); int totalxp = attackXpGained + strengthXpGained + hitpointsXpGained + defenseXpGained; g.drawString("" + totalxp, 249, 401); } private String ft(long duration) { String res = ""; long days = TimeUnit.MILLISECONDS.toDays(duration); long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS .toHours(duration)); long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS .toMinutes(duration)); if (days == 0) { if (minutes < 10 && seconds < 10){ res = (hours + ":0" + minutes + ":0" + seconds); } if (minutes < 10 && seconds >= 10){ res = (hours + ":0" + minutes + ":" + seconds); } if (minutes >= 10 && seconds < 10){ res = (hours + ":" + minutes + ":0" + seconds); } if (minutes >= 10 && seconds >= 10){ res = (hours + ":" + minutes + ":" + seconds); } } if (days > 0) { if (minutes < 10 && seconds < 10){ res = (days + ":" + hours + ":0" + minutes + ":0" + seconds); } if (minutes < 10 && seconds >= 10){ res = (days + ":" + hours + ":0" + minutes + ":" + seconds); } if (minutes >= 10 && seconds < 10){ res = (days + ":" + hours + ":" + minutes + ":0" + seconds); } if (minutes >= 10 && seconds >= 10){ res = (days + ":" + hours + ":" + minutes + ":" + seconds); } } return res; } class botGUI extends JFrame { public botGUI() { initComponents(); } private void startButtonActionPerformed(ActionEvent e) { foodToEat = whatToEat.getText().toString(); if (whatToAttack.getText().equalsIgnoreCase("Attack")){ skillDisplay = 1; } if (whatToAttack.getText().equalsIgnoreCase("Strength")){ skillDisplay = 2; } if (whatToAttack.getText().equalsIgnoreCase("Defence")){ skillDisplay = 3; } g.dispose(); test = false; } private void initComponents() { startButton = new JButton(); label1 = new JLabel(); whatToEat = new JTextField(); label2 = new JLabel(); whatToAttack = new JTextField(); //======== this ======== setAlwaysOnTop(true); setResizable(false); setTitle("Computor's AFKer"); Container contentPane = getContentPane(); contentPane.setLayout(null); //---- startButton ---- startButton.setText("Start"); startButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startButtonActionPerformed(e); } }); contentPane.add(startButton); startButton.setBounds(87, 175, 210, 65); //---- label1 ---- label1.setText("What are you going to train? (Attack, Strength, Defence)"); contentPane.add(label1); label1.setBounds(new Rectangle(new Point(35, 40), label1.getPreferredSize())); contentPane.add(whatToEat); whatToEat.setBounds(35, 120, 130, whatToEat.getPreferredSize().height); //---- label2 ---- label2.setText("Enter any food name here:"); contentPane.add(label2); label2.setBounds(new Rectangle(new Point(35, 100), label2.getPreferredSize())); contentPane.add(whatToAttack); whatToAttack.setBounds(35, 60, 140, 20); contentPane.setPreferredSize(new Dimension(400, 300)); pack(); setLocationRelativeTo(getOwner()); } private JButton startButton; private JLabel label1; private JTextField whatToEat; private JLabel label2; private JTextField whatToAttack; } } Screen shots (submit your own proggies): File download: https://mega.co.nz/#!B1cghSyL!zhStG_InfUFR5TrPmTs89b4xrbtUF2e5z7mP2xh_MgI File Scan: https://www.virustotal.com/en/file/13cdc3d912b7a50371a0ad2744b8f36067da817b9404f595e9ed0cbd0d0c66a6/analysis/1418607684/
- Hitpoints help
-
Way to alert user?
Is there a way to alert the user that something is wrong? For example: if the player is low health, can you play a bell?
-
Hitpoints help
How do you check the hitpoints level of the character in attack. Not the actual level (skills.HITPOINTS) but the current hitpoints that the character has out of its total level, say 50/99. I want my bot to eat if hitpoints is at 50% of normal.
-
Help using GUIs
Still doesn't work, maybe I'm doing it wrong? If i remove the code: String chosen = whatToEat.getSelectedText().toString(); if (chosen.equals("Lobster")){ foodToEat = chosen; } if (chosen.equals("Shark")){ foodToEat = chosen; } if (chosen.equals("Tuna")){ foodToEat = chosen; } if (chosen.equals("Monkfish")){ foodToEat = chosen; } if (chosen.equals("Swordfish")){ foodToEat = chosen; } else{ } String chosen2 = whatToAttack.getSelectedText().toString(); if (chosen2.equals("Attack")){ skillDisplay = 1; } if (chosen2.equals("Strength")){ skillDisplay = 2; } if (chosen2.equals("Defence")){ skillDisplay = 3; } else{ } it closes the window when I hit start. Maybe the chosen and chosen2 stuff is wrong?
-
Help using GUIs
I'm trying to get my GUI to run at all. Why doesn't it close when I click the start button. I thought i added the correct event handlers. The GUI opens, and I can interact with it, but when I click on the "start" button, nothing happens. Why? Here's my code, I know it's shitty: import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; import java.io.IOException; import java.net.URL; import java.util.concurrent.TimeUnit; import javax.imageio.ImageIO; import java.awt.*; import java.awt.event.*; import javax.swing.*; @ScriptManifest(name = "AFKer", author = "Computor", version = 1.0, info = "", logo = "") public class AFKer extends Script { private long timeBegan; private int xpPerHour; //GUI botGUI g = new botGUI(); public boolean guiWait = true; public String foodToEat; public int skillDisplay; private int beginningAttack; private int currentAttackXp; private int currentAttackLevel; private int attackXpGained; private double nextAttackLevelXp; private long timeAttackTNL; private double xpTillNextAttackLevel; private int beginningHitpoints; private int currentHitpointsXp; private int currentHitpointsLevel; private int hitpointsXpGained; private double nextHitpointsLevelXp; private double xpTillNextHitpointsLevel; private int beginningStrength; private int currentStrengthXp; private int currentStrengthLevel; private int strengthXpGained; private double nextStrengthLevelXp; private long timeStrengthTNL; private double xpTillNextStrengthLevel; private int beginningDefense; private int currentDefenseXp; private int currentDefenseLevel; private int defenseXpGained; private double nextDefenseLevelXp; private long timeDefenseTNL; private double xpTillNextDefenseLevel; final int[] XP_TABLE = { 0, 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, 200000000 }; //paint background private final Image bg = getImage("http://s12.postimg.org/wty7h6sb1/AFKer.png"); private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) {} return null; } //end paint background @Override public void onStart() { //Code here will execute before the loop is started timeBegan = System.currentTimeMillis(); beginningAttack = skills.getExperience(Skill.ATTACK); beginningHitpoints = skills.getExperience(Skill.HITPOINTS); beginningStrength = skills.getExperience(Skill.STRENGTH); beginningDefense = skills.getExperience(Skill.DEFENCE); timeAttackTNL = 0; timeStrengthTNL = 0; timeDefenseTNL = 0; g.setVisible(true); if (guiWait == false ){ g.dispose(); } } @Override public void onExit() { //Code here will execute after the script ends } @Override public int onLoop() throws InterruptedException { if(foodToEat != null){ inventory.interact(foodToEat, "Eat"); } return 123; } @Override public void onPaint(Graphics2D g) { //This is where you will put your code for paint(s) //background paint Graphics2D gr = g; g.drawImage(bg, 4, 341, null); //attack currentAttackXp = skills.getExperience(Skill.ATTACK); currentAttackLevel = skills.getStatic(Skill.ATTACK); attackXpGained = currentAttackXp - beginningAttack; xpPerHour = (int)( attackXpGained / ((System.currentTimeMillis() - this.timeBegan) / 3600000.0D)); nextAttackLevelXp = XP_TABLE[currentAttackLevel + 1]; xpTillNextAttackLevel = nextAttackLevelXp - currentAttackXp; if (attackXpGained >= 1) { timeAttackTNL = (long) ((xpTillNextAttackLevel / xpPerHour) * 3600000); } if (skillDisplay == 1){ g.drawString("" + ft(timeAttackTNL), 377, 427); } g.drawString("" + attackXpGained, 203, 427); //strength currentStrengthXp = skills.getExperience(Skill.STRENGTH); currentStrengthLevel = skills.getStatic(Skill.STRENGTH); strengthXpGained = currentStrengthXp - beginningStrength; xpPerHour = (int)( strengthXpGained / ((System.currentTimeMillis() - this.timeBegan) / 3600000.0D)); nextStrengthLevelXp = XP_TABLE[currentStrengthLevel + 1]; xpTillNextStrengthLevel = nextStrengthLevelXp - currentStrengthXp; if (strengthXpGained >= 1) { timeStrengthTNL = (long) ((xpTillNextStrengthLevel / xpPerHour) * 3600000); } if (skillDisplay == 2){ g.drawString("" + ft(timeStrengthTNL), 377, 427); } g.drawString("" + strengthXpGained,220, 458); //Defence currentDefenseXp = skills.getExperience(Skill.DEFENCE); currentDefenseLevel = skills.getStatic(Skill.DEFENCE); defenseXpGained = currentDefenseXp - beginningDefense; xpPerHour = (int)( defenseXpGained / ((System.currentTimeMillis() - this.timeBegan) / 3600000.0D)); nextDefenseLevelXp = XP_TABLE[currentDefenseLevel + 1]; xpTillNextDefenseLevel = nextDefenseLevelXp - currentDefenseXp; if (defenseXpGained >= 1) { timeDefenseTNL = (long) ((xpTillNextDefenseLevel / xpPerHour) * 3600000); } if (skillDisplay == 3){ g.drawString("" + ft(timeDefenseTNL), 377, 427); } g.drawString("" + defenseXpGained, 432, 401); //hitpoints currentHitpointsXp = skills.getExperience(Skill.HITPOINTS); currentAttackLevel = skills.getStatic(Skill.HITPOINTS); hitpointsXpGained = currentHitpointsXp - beginningHitpoints; xpPerHour = (int)( hitpointsXpGained / ((System.currentTimeMillis() - this.timeBegan) / 3600000.0D)); nextHitpointsLevelXp = XP_TABLE[currentHitpointsLevel + 1]; xpTillNextHitpointsLevel = nextHitpointsLevelXp - currentHitpointsXp; g.drawString("" + hitpointsXpGained, 439, 458); int totalxp = attackXpGained + strengthXpGained + hitpointsXpGained + defenseXpGained; g.drawString("" + totalxp, 249, 401); } private String ft(long duration) { String res = ""; long days = TimeUnit.MILLISECONDS.toDays(duration); long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS .toHours(duration)); long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS .toMinutes(duration)); if (days == 0) { res = (hours + ":" + minutes + ":" + seconds); } else { res = (days + ":" + hours + ":" + minutes + ":" + seconds); } return res; } class botGUI extends JFrame { public botGUI() { initComponents(); } private void startButtonActionPerformed(ActionEvent e) { String chosen = whatToEat.getSelectedText().toString(); if (chosen.equals("Lobster")){ foodToEat = "Lobster"; } if (chosen.equals("Shark")){ foodToEat = "Shark"; } if (chosen.equals("Tuna")){ foodToEat = "Tuna"; } if (chosen.equals("Monkfish")){ foodToEat = "Monkfish"; } if (chosen.equals("Swordfish")){ foodToEat = "Swordfish"; } else{ } String chosen2 = whatToAttack.getSelectedText().toString(); if (chosen2.equals("Attack")){ skillDisplay = 1; } if (chosen2.equals("Strength")){ skillDisplay = 2; } if (chosen2.equals("Defence")){ skillDisplay = 3; } else{ } guiWait = false; g.dispose(); } private void initComponents() { startButton = new JButton(); label1 = new JLabel(); whatToEat = new JTextField(); label2 = new JLabel(); whatToAttack = new JTextField(); //======== this ======== setAlwaysOnTop(true); setResizable(false); setTitle("Computor's AFKer"); Container contentPane = getContentPane(); contentPane.setLayout(null); //---- startButton ---- startButton.setText("Start"); startButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startButtonActionPerformed(e); } }); contentPane.add(startButton); startButton.setBounds(87, 175, 210, 65); //---- label1 ---- label1.setText("What are you going to train? (Attack, Strength, Defence)"); contentPane.add(label1); label1.setBounds(new Rectangle(new Point(35, 40), label1.getPreferredSize())); contentPane.add(whatToEat); whatToEat.setBounds(35, 120, 130, whatToEat.getPreferredSize().height); //---- label2 ---- label2.setText("Enter food here:"); contentPane.add(label2); label2.setBounds(new Rectangle(new Point(35, 100), label2.getPreferredSize())); contentPane.add(whatToAttack); whatToAttack.setBounds(35, 60, 140, 20); contentPane.setPreferredSize(new Dimension(400, 300)); pack(); setLocationRelativeTo(getOwner()); } private JButton startButton; private JLabel label1; private JTextField whatToEat; private JLabel label2; private JTextField whatToAttack; } }
-
Computor's Shrimp/anchovy Power Fisher!
You were right, I've updated the script, but not the .jar file.
-
Computor's Shrimp/anchovy Power Fisher!
Hmmm, I'll test it out tomorrow, give me a few hours. Make sure when you run it that you are right next to the fishing spots, it won't walk to them from the bank.
-
Help With Simple Fishing Bot. (Beginner)
I know it would be a burden, but mind giving me an example?
-
Computor's Shrimp/anchovy Power Fisher!
Hello everyone! I have just completed my first script ever!!! I'm really happy, because I've always wanted to make a bot. Anyway, this script is fairly simple, but it's aesthetically pleasing. It has a nice paint (my opinion) and power-fishes shrimp/anchovies. It will run anywhere as long as you have a small net in your inventory. The script has really bad anti-ban at the moment, so I will be updating that soon. Please enjoy the script, and GIVE FEEDBACK! I really want to learn, and feedback is the best way to learn. Please tear my code to shreds if you want to, it just helps me learn. Thanks! (The script has been updated, and the file has not been. The only change was in the timer, no big deal) Thank you to: Pug, ESPECIALLY Apaec, Divinity, igetbanned -Computor .jar file (and file scan) https://mega.co.nz/#!MsdEUBgR!url1xPQVslKHkHLyFRayGg0OX6oIBlXlTVCVI4NPehY https://www.virustotal.com/en/file/ff16d4c146470a9175d8ad31e46dd86b0154f3311d56c5a60d426b7f29917792/analysis/1413455531/ Code: import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.api.ui.Message.MessageType; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Tab; import java.text.DecimalFormat; import java.util.concurrent.TimeUnit; import java.awt.*; import java.io.IOException; import java.net.URL; import java.awt.Font; import javax.imageio.ImageIO; @ScriptManifest(author = "Computor", info = "My first script. Has bugs still. Anti-ban sucks. " + "Start \nnear ANY shrimp location, have a small fishing net in \nyour inventory", name = "Simple Power-Shrimper", version = 1.0, logo = "") public class shrimpPowerFisher extends Script { private static final int[] FISHING_ID = {1528 , 1525}; //declarations for the paint (used in math) private static final int xpPerShrimp = 10; private static final int xpPerAnchovie = 40; private int shrimpCaught = 0; private int xpGained = 0; private int xpPerHour; private int totalXpPerHour; private long timeBegan; private long timeRan; private String logInfo; @Override public void onStart() { log("Simple power-fisher for anchovies and shrimps. Run anywhere."); timeBegan = System.currentTimeMillis(); logInfo = "None"; } private enum State { FISH, DROP }; private State getState() { if (inventory.isFull()){ logInfo = "Dropping."; //changes status on paint return State.DROP; } return State.FISH; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case FISH: if (!myPlayer().isAnimating()) { NPC Fishing_spot = npcs.closest(FISHING_ID); if(Fishing_spot != null) { if (!inventory.isFull()) { Fishing_spot.interact("Net"); logInfo = "Casting net."; sleep(random(800,1200)); antiban(); } } } break; case DROP: inventory.dropAllExcept(303); break; } logInfo = "Fishing."; //changes status on paint return random(0, 50); } @Override public void onMessage(Message m) { if (m.getType() == MessageType.GAME) { String c = m.getMessage().toLowerCase(); //not sure if this helped anything, didn't test taking this out. try { if (c.contains("you catch some shrimps.") || c.contains("You catch some shrimps.")) { shrimpCaught++; //stuff for paint xpGained += xpPerShrimp;} //stuff for paint else if (c.contains("you catch some anchovies.") || c.contains("You catch some anchovies.")){ shrimpCaught++; xpGained += xpPerAnchovie; } } catch (Exception e) { //not sure if I need the catch, it works fine. e.printStackTrace(); } } } private void antiban() throws InterruptedException { if(myPlayer().isAnimating()) { //shitty anti-ban, needs updating. logInfo = "Antiban."; //changes status on paint getTabs().open(Tab.SKILLS); sleep(100 + random(300, 700)); getSkills().hoverSkill(Skill.FISHING); sleep(100 + random(3000, 4000)); getTabs().open(Tab.INVENTORY); sleep(100 + random(500, 700)); getMouse().moveRandomly(); } } // PAINT VARIABLE DECLARATIONS private final Image bg = getImage("http://s14.postimg.org/wvkn4w3cx/Untitled_3.png"); private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) {} return null; } @Override public void onExit() { log("End of fishing script."); //logs in console, not paint } @Override public void onPaint(Graphics2D g) { Font SansSerif = new Font ("SansSerif", Font.BOLD, 16); timeRan = System.currentTimeMillis() - this.timeBegan; DecimalFormat df = new DecimalFormat("#"); Graphics2D gr = g; g.drawImage(bg, 2, 277, null); g.setFont (SansSerif); //changes font type to SansSerif g.setColor(Color.BLACK); //changes font color to black g.drawString(ft(timeRan), 111, 465); g.setFont (SansSerif); //possibly don't need this again? haven't tested. g.setColor(Color.BLACK); g.drawString("" + df.format(xpGained) , 274, 424); g.setFont (SansSerif); g.setColor(Color.BLACK); g.drawString("" + df.format(shrimpCaught) , 111, 424); xpPerHour = (int)(xpGained / ((System.currentTimeMillis() - timeBegan) / 3600000.0D)); totalXpPerHour = xpPerHour; g.drawString("" + df.format(totalXpPerHour) + "/hr", 274, 379); g.drawString(logInfo, 111, 379); } // FORMAT TIME METHOD (code used from Apaec, thank you Apaec.) private String ft(long duration) { String res = ""; long days = TimeUnit.MILLISECONDS.toDays(duration); long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)); long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)); if (days == 0) { if (minutes < 10){ res = (hours + ":0" + minutes + ":" + seconds); if (seconds < 10){ res = (hours + ":0" + minutes + ":0" + seconds); } } else res = (hours + ":" + minutes + ":" + seconds); } else { res = (days + ":" + hours + ":" + minutes + ":" + seconds); } return res; } } Screenshot (short runtime I know, just wanted to upload a screenshot):
-
Help With Simple Fishing Bot. (Beginner)
I still am running in to the same problem however. Every time the bot runs the antiban, it finishes the entire antiban before fishing again. How do I interrupt the antiban process AS SOON AS the character stops animating?