Vag Posted April 16, 2015 Share Posted April 16, 2015 (edited) Hello, I am here to release my first OSBot Script ever. Writing this took me no more than 5 minutes. It is very basic, where I was just testing out OSBot Scripting.. This seems like something I might be doing more @Future. Script has no antiban, except random idle timer after killing a monster. Did a test run with this, and it does attack the chicken. Script can/must be started out @Any Chicken Spawn in RuneScape. Source code //OSBot API import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; //Importing Java AWT import java.awt.*; //Script Details @ScriptManifest(name = "VAGs Chicken Blaster", author = "VAG", version = 1.0, info = "Public BETA", logo = "") public class main extends Script { @Override public void onStart() { //Defines actions during startup log("VAGs Chicken Blaster 1.0 - Welcome!"); } @Override public void onExit() { //Executed after the script ends log("Thank-you for using VAGs Chicken Blaster!"); } @Override public int onLoop() throws InterruptedException { //Script on loop NPC chicken = npcs.closest("Chicken"); if(!myPlayer().isAnimating() && !myPlayer().isMoving()) { if(chicken != null) { if (chicken.isVisible()) { chicken.interact("Attack"); sleep(random(300, 600)); } else { camera.toEntity(chicken); } } } else { sleep(random(300, 600)); } return(random(100, 300)); //Random(?) Loop timer } @Override public void onPaint(Graphics2D g) { //Loading paint super.onPaint(g); g.setColor(Color.GREEN); g.drawString("VAG's Chicken Blaster ", 28, 175); } } Rewrote. Edited May 13, 2015 by Finland 1 Quote Link to comment Share on other sites More sharing options...
ProxDox Posted April 28, 2015 Share Posted April 28, 2015 L000000000000000000000000000000L This is so fucking bad l0000000000000000000000000l r0flr0flr0flr0frlf dying lma0 please learn some java b4 next attempt lma000000000000000000000000000000000 l000000000000000000l 1 Quote Link to comment Share on other sites More sharing options...
Roshe Posted May 4, 2015 Share Posted May 4, 2015 L000000000000000000000000000000L This is so fucking bad l0000000000000000000000000l r0flr0flr0flr0frlf dying lma0 please learn some java b4 next attempt lma000000000000000000000000000000000 l000000000000000000l Why be an ignorant asshole? 3 Quote Link to comment Share on other sites More sharing options...
Tropic Psycho Posted May 10, 2015 Share Posted May 10, 2015 It's a start, next i recommend you learn how to loot and bury bones ;) Quote Link to comment Share on other sites More sharing options...
Joseph Posted May 10, 2015 Share Posted May 10, 2015 It's a start, next i recommend you learn how to loot and bury bones ;) Quote Link to comment Share on other sites More sharing options...
Vag Posted May 13, 2015 Author Share Posted May 13, 2015 Rewrote the script. Quote Link to comment Share on other sites More sharing options...
SirVodka Posted May 13, 2015 Share Posted May 13, 2015 nice try bruh, no one start knowing everything. Just dont give up! Quote Link to comment Share on other sites More sharing options...
Foulwerp Posted May 14, 2015 Share Posted May 14, 2015 (edited) import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(info = "", name = "Chickens", logo = "", version = 1.00, author = "Foulwerp" ) public class Chickens extends Script { public int onLoop() { if (myPlayer().getInteracting() != null) { //This check at the start saves resources, because you don't do useless things like find new npcs while in combat return random(500, 1000); } NPC chicken = npcs.closest(new Filter<NPC>() { public boolean match(NPC npc) { //Multiple checks using a filter to find the best npc to attack. I guess, optimizing this to do the least //resource intensive checks first, leading up the the most intensive. If one of the first checks returns //false, you didn't waste a bunch of resources. If you check if the npc is reachable first you would waste a lot //of resources on an A* algorithm on a mob you may not even want to attack. This is because you are polling //all the mobs till one of these returns true to all checks. return npc.getName().equals("Chicken") && npc.getHealth() > 0 && npc.isAttackable() && map.canReach(npc); } }); if (chicken == null) { //If chicken is null just return so you wait for one to spawn return random(500, 1000); } if (!chicken.isOnScreen() { //Try to get the chicken on the screen by turning to it camera.toEntity(chicken); //Returning after doing an action return (500, 1000) } //Attack the chicken then return net iteration should see that I'm interacting which is the first check chicken.interact("Attack"); //Default return but again returned after I completed an action return random(500, 1000); } } I know how hard it can be to learn when you have no reference so I decided to give you one, and a few tips. Once you learn how to use filters life will be a lot easier. You can use multiple checks to find the perfect npc to attack, and not just the closest one to you. Filters can be applied to not only npcs but items, ground items, etc. Instead of checking if your player is moving or animating check if it is interacting with something. In most cases if it is your player is in combat. Try to write your code logically so that you don't have to use sleep. If you return it's better and what you return is how long in milliseconds it waits till it enters the loop again. When your script runs through the loop you want it to do 0 to 1 action and return. So every loop iteration should either have no actions done meaning the default is returned, or do 1 action in which you return a specified amount. Not action sleep another action sleep then return. In a sense returning is sleeping, but a much better way allowing the bot to do what it needs to before you enter the loop again. Randoms aren't a big deal on oldschool but returning allows the bot to check for them and do other background things, sleeping doesn't. Edited May 14, 2015 by Foulwerp 2 Quote Link to comment Share on other sites More sharing options...
Zoubiey Posted May 14, 2015 Share Posted May 14, 2015 public int onLoop() { if (myPlayer().getInteracting() != null) { //If my player is interacting I return because there is no point in doing any more checks till I'm out of combat return random(500, 1000); } NPC chicken = npcs.closest(new Filter<NPC>() { public boolean match(NPC npc) { //Multiple checks using a filter to find the best npc to attack return npc.getName().equals("Chicken") && npc.getHealth() > 0 && npc.isAttackable() && map.canReach(npc); } }); if (chicken == null) { //If chicken is null just return so you wait for one to spawn return random(500, 1000); } if (!chicken.isOnScreen() { //Try to get the chicken on the screen by turning to it, and returning after the action camera.toEntity(chicken); return (500, 1000) } //Attack the chicken then return net iteration should see that I'm interacting and not proceed //further than the first check saving CPU because you're not constantly doing every check in the loop chicken.interact("Attack"); return random(500, 1000); } I know how hard it can be to learn when you have no reference so I decided to give you one, and a few tips. Once you learn how to use filters life will be a lot easier. You can use multiple checks to find the perfect npc to attack, and not just the closest one to you. Filters can be applied to not only npcs but items, ground items, etc. Instead of checking if your player is moving or animating check if it is interacting with something. In most cases if it is your player is in combat. Try to write your code logically so that you don't have to use sleep. If you return it's better and what you return is how long in milliseconds it waits till it enters the loop again. When your script runs through the loop you want it to do 0 to 1 action and return. So every loop iteration should either have no actions done meaning the default is returned, or do 1 action in which you return a specified amount. Not action sleep another action sleep then return. In a sense returning is sleeping, but a much better way allowing the bot to do what it needs to before you enter the loop again. Randoms aren't a big deal on oldschool but returning allows the bot to check for them and do other background things, sleeping doesn't. Thanks for that, trying to do my own chicken killer. This will come in handy! Quote Link to comment Share on other sites More sharing options...
Foulwerp Posted May 14, 2015 Share Posted May 14, 2015 Thanks for that, trying to do my own chicken killer. This will come in handy! NP I did edit my post to explain a little more about what I did and why. 1 Quote Link to comment Share on other sites More sharing options...
RickyD Posted May 15, 2015 Share Posted May 15, 2015 import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(info = "", name = "Chickens", logo = "", version = 1.00, author = "Foulwerp" ) public class Chickens extends Script { public int onLoop() { if (myPlayer().getInteracting() != null) { //This check at the start saves resources, because you don't do useless things like find new npcs while in combat return random(500, 1000); } NPC chicken = npcs.closest(new Filter<NPC>() { public boolean match(NPC npc) { //Multiple checks using a filter to find the best npc to attack. I guess, optimizing this to do the least //resource intensive checks first, leading up the the most intensive. If one of the first checks returns //false, you didn't waste a bunch of resources. If you check if the npc is reachable first you would waste a lot //of resources on an A* algorithm on a mob you may not even want to attack. This is because you are polling //all the mobs till one of these returns true to all checks. return npc.getName().equals("Chicken") && npc.getHealth() > 0 && npc.isAttackable() && map.canReach(npc); } }); if (chicken == null) { //If chicken is null just return so you wait for one to spawn return random(500, 1000); } if (!chicken.isOnScreen() { //Try to get the chicken on the screen by turning to it camera.toEntity(chicken); //Returning after doing an action return (500, 1000) } //Attack the chicken then return net iteration should see that I'm interacting which is the first check chicken.interact("Attack"); //Default return but again returned after I completed an action return random(500, 1000); } } I know how hard it can be to learn when you have no reference so I decided to give you one, and a few tips. Once you learn how to use filters life will be a lot easier. You can use multiple checks to find the perfect npc to attack, and not just the closest one to you. Filters can be applied to not only npcs but items, ground items, etc. Instead of checking if your player is moving or animating check if it is interacting with something. In most cases if it is your player is in combat. Try to write your code logically so that you don't have to use sleep. If you return it's better and what you return is how long in milliseconds it waits till it enters the loop again. When your script runs through the loop you want it to do 0 to 1 action and return. So every loop iteration should either have no actions done meaning the default is returned, or do 1 action in which you return a specified amount. Not action sleep another action sleep then return. In a sense returning is sleeping, but a much better way allowing the bot to do what it needs to before you enter the loop again. Randoms aren't a big deal on oldschool but returning allows the bot to check for them and do other background things, sleeping doesn't. I love you Quote Link to comment Share on other sites More sharing options...
Judi QQ Posted May 15, 2015 Share Posted May 15, 2015 lmao Quote Link to comment Share on other sites More sharing options...