Jump to content

sudoinit6

Lifetime Sponsor
  • Posts

    353
  • Joined

  • Last visited

  • Feedback

    100%

Everything posted by sudoinit6

  1. Change the mac address on your power strip, few people know this but they log it.
  2. Yeah, I can figure out for a single session. I was hoping for the lifetime of the bot which it sounds like isn't possible. I can go to hans in lumby but I don't know how to capture that data and make decisions based on it. I don't think OSB can do that but I was hoping for a way I don't know about.
  3. As the title says, is there any way to programmatically determine how many hours an account has been logged in?
  4. I came up with something that works but yours is cleaner and I will convert to it. Here is what I did: I declared a static variable "br" in my Task class and added br = 1; to the end of each class. Then I changed my loop to this: int i; Task x; for (i = 0; i < tasks.size(); i++){ Task.br = 0; x = tasks.get(i); x.run(); if (Task.br == 1) { break; } } Like I said, yours is better, I just wanted to express that I am trying to learn and not just be spoonfed and I really appreciate your time and help.
  5. OK, I am a little closer, I changed the loop to this: for (i = 0; i < tasks.size(); i++){ x = tasks.get(i); x.run(); } Which works great, now I am having trouble with the "break;". No matter where I put it in the tasks classes I get syntax error or break cannot be used outside of a loop or a switch. Any hints?
  6. DHO! Thank you again for your time. I will fiddle with that and see if I can make it work.
  7. Thank you for your response. My Main class is the same as the one in the first post and I don't see a List.forEach method to change to a for loop. import java.util.ArrayList; import org.osbot.rs07.script.Script; public class Main extends Script{ //this is our array list which will contain our tasks ArrayList<Task> tasks = new ArrayList<Task>(); @Override public int onLoop() throws InterruptedException { return 700; } }
  8. Is there a way to have the script stop processing the task list once it matches on of the canProcess() criteria? Currently it keeps trying to process other tasks or at least matching them, but if there are two that qualify it runs them. For example I have a "Debug" task that I want to use if the script falls through and doesn't match any other canProcess() criteria. But the logs show "I am lost" on every single loop, even it it processes one of the other classes. Is there something that can be added to to "do" part of the class that will make it break out of the current loop and start from the top of the task list? The java keyword "continue" seems to be what I am looking for but no matter where I put it, Eclipse doesn't like it. Here is my debug class: import org.osbot.rs07.script.MethodProvider; public class Debug extends Task { public Debug(MethodProvider api) { super(api); } @Override public boolean canProcess() { return !api.myPlayer().isMoving(); } @Override public void process() { api.log("I am lost"); } }
  9. Looking for an account that can access Fossil Island which (obviously) means it needs 100 kudos and the quest Bone Voyage completed.
  10. Solved! Thank you all for your help! It was a combination of your advice, putting it in the main class and I was too far away so I started closer. Those did the trick!
  11. When I do this and call upon it, the IDE wants me to make longwalk static, and then I get an error on execute that say I can't make a static reference to a not static method from the type MethodProvider.
  12. Well damn, that could be my problem. Thanks mate! Gotcha, I will try starting from closer and this. You guys rock, thanks again!
  13. I am too dumb to do that. I will give that a try, thanks. How far is the "loaded area" I am trying to go from Varrock Bank West to Varrock East Mine.
  14. If you were to guess how this could be done, what would you guess?
  15. I have found some useful information about walking to exact position, for example this thread: Unfortunately I can't get the syntax correct and I think it is because I am using this method of writing: https://osbot.org/forum/topic/92612-tutorialindepth-a-better-take-on-task-based-scripts/ If I use the syntax found in the thread or try and make my own WalkingEvent: WalkingEvent digsite = new WalkingEvent(EVarrockMinePos); digsite.setMinDistanceThreshold(0); script.execute(digsite); It rejects it saying script can not be resolved. Nor does is like: api.script.execute(digsite) This code gets passed over, I don't get an error, nothing happens: WalkingEvent digsite = new WalkingEvent(EVarrockMinePos); digsite.setMinDistanceThreshold(0); api.execute(digsite); Anyone want to give me a hint as to what I am doing wrong?
  16. Root cause found PEBCAK error. It was processing the class, my code was just bad and I didn't have log entries in the code so it was just bypassing it.
  17. So following this guide I am writing a script: Mostly it works flawlessly, but some of my classes just wont work. For example I have a class where the condition check is:: @Override public boolean canProcess() { return VarWest.contains(api.myPlayer()) && !api.bank.isOpen(); } If this is true it is supposed to open the bank. Works great, when the bot is in the bank and the bank is not open, it opens it. Then I have another class that is supposed to withdraw specific items from the bank when the following is true: @Override public boolean canProcess() { return VarWest.contains(api.myPlayer()) && api.bank.isOpen(); } Does not work, it falls past that task all the way to my debug class where I have it checking if the above is true and if so to print "true" to the log. The script knows the condition has been met because the logs show this: [INFO][04/28 12:13:05 PM]: Started bot #1 [INFO][Bot #1][04/28 12:14:31 PM]: Loaded 1 built-in random solvers! [INFO][Bot #1][04/28 12:14:31 PM]: Started script : [INFO][Bot #1][04/28 12:14:32 PM]: Opening Varrock bank [INFO][Bot #1][04/28 12:14:37 PM]: Emptying inventory [INFO][Bot #1][04/28 12:14:37 PM]: true [INFO][Bot #1][04/28 12:14:38 PM]: true [INFO][Bot #1][04/28 12:14:40 PM]: true [INFO][Bot #1][04/28 12:14:41 PM]: true [INFO][Bot #1][04/28 12:14:42 PM]: true [INFO][Bot #1][04/28 12:14:42 PM]: Terminating script .. [INFO][Bot #1][04/28 12:14:42 PM]: Script has exited! I am not sure what to make of this, the script sees that the conditions are met but never executes the class, and I have checked to see that the task is in the list of tasks loaded onStart. Any thoughts?
  18. That is EXACTLY what I was looking for, thank you very much!
  19. Yeah, I do think the main class used onstart to build the list of tasks, and onloop to go through that list and try to match the current state of the game to the state statements at the beginning of all the other classes. If it matched then it executed the code and then started the loop over again, are you aware of any tutorials for scripting in this manner?
  20. I have tried following Explv's tutorial, he is a great guy and talented programmer. I don't know how to explain it, but I just don't "get" it. Something doesn't click. With the task based classes I get it a little, enough to get by anyway.
  21. Hey all, long time no see. I am thinking about doing some botting but I have a problem, I lost the laptop that had my ide on it and even though I wrote my own scripts I really don't know java (those that remember me should remember I said that often). Anyway, I had a "framework" that I found here on the forums and I used that as the base of my scripts. It consisted of one class that had a list of "tasks" to add to the list and the other classes were the actual tasks. The script would go through the class list and see if the "test" at the beginning of each "task" class matched the current state (if my player is in the bank and bank is not open). If it matched it would execute the code that followed, if not the script would move to the next task on the list. It worked similar to "state" scripts but many classes instead of one large one. I have been told this isn't good programming practice, and I understand that. The fact of the matter is this is the only way I know how to script and it works for me. Anyway, if anyone can point me in the direction of an open source script written this way I would appreciate it. I found the original one here years ago but can't seem to find one now. Thanks!
×
×
  • Create New...