Jump to content

Ragboys is back

Members
  • Posts

    120
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by Ragboys is back

  1. I've been working on my first GUI but I have NO idea on how to start my script. I'm a little mind-kcuf'd right now since I'm working with two classes, the GUI and the Main where everything happens. I know I should be using a listener for my button "start" but then I have no idea what should be inside the action-listener body. Should I call the onLoop() method? If so, how? I have searched a lot of GUI tutorials on this forums & google in general but cant seem to find anything. Would love to get any help possible.
  2. Yeah, I thought my script's speed performance would've been fixed once I had the spell selected & mouse hovered over the spawn, and that's what I did in those lines: if(magic.isSpellSelected()) { log("The telekinetic spell is selected"); mouse.move(418, 164); camera.moveYaw(186); camera.movePitch(67); Couldn't find a better way to hover the mouse but the code I wrote seems to be working just fine. I didn't think about using the respawn time to instant grab the wine, but it's definetely a great suggestion. I'll for sure check that out, thanks.
  3. I've been working on a wine grabber to learn more about programming, the tools from API and so on. However, I realized there are some wine grabber scripts that will react to wine respawn and grab it faster than mine, about 1-2 ticks or so. This means I can NEVER grab the wine before the other bot, making my script useless. Are there any ways that I can optimize the 'reaction time/speed' of my script? Is the structure of my code wrong? Let me know, taking any suggestions & constructive criticism. A part of the code: I also need some tips on using conditional sleep, tried using it but couldn't make it work/don't understand it all. Yes, I've read tutorials about them but for somehow I still can't be able to implement it within my script.
  4. Before creating something you need to use on any of your script, make sure to search it in the API. Mostly like what you need will be there and it'll save you a lot of time. However, if you wanna go the hard & long way, you could make your own methods, which personally will just make you lose time.
  5. I'm not sure if this will helps, but anyways, here's we go. I'll keep this scripting-related. When I started learning about programming, I used to think I would have to do everything by myself. Everything from scratch. That is NOT the case in programming, especially java. In java, there are always classes already created by other people that you can import and use whatever "tools" there is in that class. When I started programming I always thought of myself making scripts for runescape, but I thought it was something hard to do, because I kept thinking about "How am I going to make the character walk?" , "How am I going to make the character attack, eat, teleport, etc". That's when I found out about the OsBot API. The definition of API is the following: The API will provide you with tools (methods, actions) that you can use to make your scripts. With the API, I found the solution for my questions mentioned above. How to walk? - Use the WebWalking class from the API walking.webWalk(Location); How to check if my inventory is full? - Use the inventory class from the API getInventory().isFull(); How do I check my magic level? getSkills().getDynamic(Skill.MAGIC); And so on... What I'm trying to say is, someone else have made the tools for you, you don't have to worry about making them. Now you have to think about how your script is going to run. What should it do? What should it check? This is where logic comes in. This is where pseudo-code is useful. For a simple tree cutting script, this is what I think of my character to do: If I have the wc lvl, go to next if. Else, log out. If I am wielding the axe, go to the next if. Else, wield the axe. If my inventory is not full, cut the trees. Else, clear my inventory. Turning that into pseudo-code (basically the same thing but with the correct structure): Check if I have the woodcutting level needed Check if I am wielding the axe Check if my inventory is not full Cut the trees else Clear inventory (bank or drop items) else Wield the axe else Log out because have no woodcutting level And turning that into actual java code private void woodcuttingTest() throws InterruptedException{ if(getSkills().getDynamic(Skill.WOODCUTTING) > 1) { if (equipment.isWearingItem(EquipmentSlot.WEAPON, "Bronze Axe")){ if (!getInventory().isFull()){ Entity tree = getObjects().closest("Tree"); tree.interact("Chop down"); } else{ getInventory().dropAll(); } } else{ inventory.getItem("Bronze Axe").interact("Wield"); } } else{ logoutTab.logOut(); } } I used to be very confused when I first started, so hopefully this clear your mind out. This post is more related to scripting, if you want to learn more about java I suggest reading books, looking up JAVA guides on youtube to learn how the language works. This tutorial will help you A LOT in your scripting questions:
×
×
  • Create New...