-
Posts
7986 -
Joined
-
Last visited
-
Days Won
58 -
Feedback
100%
Everything posted by Swizzbeat
-
Not gonna lie that's really good. Ever consider going out to an audition? Something like the X Factor or America's Got Talent? Never know what could happen from getting that publicity.
-
Never realized how much I love the tab key until I saw this But anyway it looks nice, I'll work this into one of my scripts somewhere!
-
3
-
My first java project (Rock Crab killer)
Swizzbeat replied to GiimpeN's topic in Software Development
I'm new to scripting myself so I can't really offer to much advice! But one thing I noticed is that you don't have a check to see if the rock crab still exists or not. I'm working on a cow script and it consistently was messing up and the mouse would hover over the same spot even though the cow was dead. Not sure if its a client or script issue, but to combat it I added a while loop to check for if the crab still existed. Here's what I would do: public int attackCrab() throws InterruptedException { Entity rockcrab = closestAttackableNPCForName("Rock Crab"); Player player = client.getMyPlayer(); while (rockcrab.exists()) { if (!rockcrab.isVisible()) { client.moveCameraToEntity(rockcrab); } if (!player.isUnderAttack()) { rockcrab.interact("Attack"); sleep(random(1000, 2000)); } } return 50; } What I did here was add your code to a while loop to constantly check if the rock crab is still a thing or not. What if you hit a lag spike and the crab dies during that lag? Your script would still be stuck looking for the crab even though it isn't there anymore. With the while loop if that crab ever does not exist then it won't execute any of the code in its brackets. The next thing I did was add your if-visible check to BEFORE the attack statement. This way the crab is definitely on screen before it tries to click anything! and lastly I added a "!" to before the player.isUnderAttack() to check for if the player IS NOT under attack, then ATTACK and sleep for a random amount of time between 1000 and 2000 milliseconds (or 1 and 2 seconds). Honestly the best way to become better is to practice. Your script won't work the first time you try it, you have to keep changing things up and from making mistakes you learn quite a lot. Just keep trying and with enough persistence you'll complete a successful script in no time -
My first java project (Rock Crab killer)
Swizzbeat replied to GiimpeN's topic in Software Development
You have two onLoop methods but ones called onLoop1....how does the script know to run that code? The bot is looking for a method called onLoop to start the regular loop, onLoop and onLoop1 are two completely different things. If you want you could set the script to call your onLoop1 method once it completes the original code (getting the player to wake up the crab) like this: public int onLoop() throws InterruptedException { Player player = client.getMyPlayer(); Entity rockcrab = closestAttackableNPCForName("Rock Crab"); Entity Rocks = closestNPC(73, 71); if (Rocks != null) { if (!Rocks.isVisible()) { client.moveCameraToEntity(Rocks); if (!player.isMoving()) { if (!player.isAnimating()) { Rocks.interact("Walk here"); sleep(random(700, 800)); if (rockcrab.exists()) { attackCrab(); } } } } } return 50; } And change your onLoop1 to attackCrab so it makes more sense. The final code would then be: package killer; import java.awt.Graphics; import org.osbot.script.Script; import org.osbot.script.ScriptManifest; import org.osbot.script.rs2.model.Entity; import org.osbot.script.rs2.model.Player; @ScriptManifest(author = "GiimpeN", info = "Kills RockCrabs", name = "CrabKiller", version = 0.1) public class CrabKiller extends Script { public void onStart() { log("Script Started."); } public void onExit() { } public int onLoop() throws InterruptedException { Player player = client.getMyPlayer(); Entity rockcrab = closestAttackableNPCForName("Rock Crab"); Entity Rocks = closestNPC(73, 71); if (Rocks != null) { if (!Rocks.isVisible()) { client.moveCameraToEntity(Rocks); if (!player.isMoving()) { if (!player.isAnimating()) { Rocks.interact("Walk here"); sleep(random(700, 800)); if (rockcrab.exists()) { attackCrab(); } } } } } return 50; } public int attackCrab() throws InterruptedException { Entity rockcrab = closestAttackableNPCForName("Rock Crab"); Player player = client.getMyPlayer(); if (player.isUnderAttack()) { rockcrab.interact("Attack"); if (!rockcrab.isVisible()) { client.moveCameraToEntity(rockcrab); } } return 50; } public void onPaint(Graphics g) { } } Only change I did was rename your onLoop1 method to attackCrab, add an if statement to only call attackCrab if a rockcrab exists, and if it doesn't it will go and repeat the main loop again. -
2
-
http://www.youtube.com/watch?v=Mdil7v1J5es Only good video I've ever been able to find about coding for OSBot. Really helped me out with the basics. If you already know how to write a script then just watch the first few minutes where he shows you how to download Eclipse, set up a new class, etc.
-
27
-
I really want to begin writing basic scripts for OSBot but have no idea where to start. I have a basic understanding of Java so I'm not looking to script anything huge, but I would like to start at least somewhere with maybe a basic chicken killer or something along those lines. Are there any tutorials out there for making a basic script, or can someone point me in the right direction? Any help is much appreciated!
-
Sounds awesome. RS3 support would definitely bring a lot more people to the bot aswell! Only thing is you'd have to change the name to something other then OSBot
-
will Really wasn't that hard ;)
-
Thanks for all the tips guys! I'm currently looking around for C++ tutorials as I think getting an understanding of that down will help me with everything else.
-
Isn't Python a little bit old? I could be wrong but I think I heard somewhere that Python was more a of play around kind of language and not actually useful when it came to real world situations.
-
So for about a month now I've been learning Javascript along with CSS and a little JQuery. I'm advancing in that pretty well but as I'm entering my senior year of high school and programming is something I want to do as a full time job I'm going to need to learn other things besides just that. Does anyone have useful advice on what I can start looking into, or if I should even just stay with what I'm doing right now? In the end by the end of this school year I want to have a general knowledge of all the major languages that I would need as a programmer. I don't mean just one, like Java, I mean literally THEM ALL as I'd like to help my dad (who's been a consultant for 30+ years) start up a software business and be able to complete any task that a company would give. I know it sounds far fetched but I'm going to put my mind to this and make it a reality. Please just leave any advice you have for me
-
Looks cool, but you should add a "save" option so people don't have to reset what they want to say every time they reload the bot :p
-
Good luck big boys, and thanks for giveaway GTi
-
You have a lot of grammar errors, such as replacing the word "you" with the letter "u" and not capitalizing certain things that need capitalization. I know it sounds grammar nazi like but it would add to the guide as a whole and make it look cleaner
-
Congrats
-
Same problem but for me its "z" instead of "p"
-
Looks great, thanks for the update!
-
Agreed
-
Collecting red spiders eggs is about 150-200k per hour and can be botted.
-
Full support, but I'm pretty sure randoms are handled by the client so if its offline randoms won't work.
-
4
-
black people