-
Posts
67 -
Joined
-
Last visited
-
Feedback
0%
Everything posted by computor
-
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
-
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:
-
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.
-
Problem was solved by apaec.
-
@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 does one change that? (i thought it was grabbing all data, so clearly i'm wrong) Here's my code: http://pastebin.com/h56xBi2t
-
It still only picks up the last item in the list.
-
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"); }
-
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
computor replied to computor's topic in Scripting Help
PROBLEM SOLVED ON MY OWN. SOLUTION: public String[] temp; temp = itemsToPickUp.getText().split("\n"); -
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???
-
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/
-
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?
-
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.
-
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?
-
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; } }
-
I know it would be a burden, but mind giving me an example?
-
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?
-
Thank you both very much! Apaec, the client antiban isn't that good in my opinion, and I wanted to make a few more options.
-
Hey guys, I created a simple fishing bot that clicks on the Net fishing spot for shrimp and anchovies. It's really simple, but I'd like to try and make it more complex. Right now, when I run it, the bot gets to the antiban section under "while (myPlayer().isAnimating())" section under the FISH enum state. Every time it hits the antiban, the chacter is animating, but sometimes the character stops animating mid-antiban. The bot runs through the entire antiban loop, and then clicks on the fishing spot. How can I keep it constantly updating, and override the antiban? I want it to immediately click the fishing spot if it stops fishing, not wait for the antiban to end. PLEASE HELP! Thanks. Code below: 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.Skill; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.MethodProvider; import java.awt.*; @ScriptManifest(author = "Computor", info = "My first script", name = "Simple Power-Shrimper", version = 1.0, logo = "") public class main extends Script { private static final int[] FISHING_ID = {1528}; @Override public void onStart() { log("Simple power-fisher for anchovies and shrimps. Run anywhere."); } private enum State { FISH, DROP, WAIT }; private State getState() { if (inventory.isFull()) 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 (!inventory.isFull()){ Fishing_spot.interact("Net"); sleep(random(800,1200)); } while (myPlayer().isAnimating()){ sleep(MethodProvider.gRandom(6000, 13000)); getTabs().open(Tab.SKILLS); sleep(MethodProvider.gRandom(300, 1200)); getSkills().hoverSkill(Skill.FISHING); sleep(MethodProvider.gRandom(3000, 4000)); getTabs().open(Tab.INVENTORY); sleep(MethodProvider.gRandom(7000, 12000)); getMouse().moveRandomly(); } } break; case DROP: inventory.dropAllExcept(303); break; case WAIT: sleep(random(500, 700)); break; } return random(200, 300); } @Override public void onExit() { log("End of fishing script."); } @Override public void onPaint(Graphics2D g) { } }