Jump to content

Joseph

Trade With Caution
  • Posts

    4692
  • Joined

  • Last visited

  • Feedback

    91.3%

Everything posted by Joseph

  1. http://osbot.org/forum/topic/66897-basic-example-of-state-node-scripting/?p=735460 best example
  2. i had a few people questioning how State-Node scripting is different from regular getState() the method getState() loops through an array of a type<?> and finds the one type<?> that returns true. getState(): ~every single time onLoop reloops. GetState() is called which then has to loop through his own array of types<?> ~so pretty much its a double consistently . onLoop will execute another getState() loop. State-Node ~every since time onLoop reloops. It refs back to the TaskTracker class. If the private field return null or false. It will loop and find the correct task. ~so pretty much it a double loop every so often. Whenever the current task is null or false A Scripting Example. I really did not type to as much but very informative. ps: i hope you like my convention of having many nested classes Also you could have the tracker class in a different place. I put it inside this class was for example purposes
  3. nope. The only looping that actually happens in within the tracker class. Also it only happens once when the method getActivity() i call because of this if statement if (this.activeTask == null || !this.activeTask.validate()) { if that method returns true for any reason it will loop through the array of nodes and grab the new node
  4. It's like a regular node. Create a class, implement activity. Then override the methods. if you have an instance of script within the class then your good to go.Example: Private class Mine implements activity { Override status for name of task Override the boolean. If inventory is not full, mine Override the run method mining event (mentioned to be executed) make sure you have an active script instance } Ill release and example in a few mins
  5. great of you to ask. It has the same characteristics. the difference between mine and the getState is that. In getState you are always looping through all the task and grabbing the valid node. But with my Class you will loop through all nodes, grab the valid one. the class will set the valid node as a state in the class. The class will always ref back to the state. If the node is invalid the class will look for a new node. if the node is still active and valid the class will stay with that one node until it is invalid or null. I wanted to add in a void set node but I forgot to do that On top of that I already left my house so I'll change it later. Edit: you won't fully understand it until you actually implement it. for fun implement this frame work to an existing class that supports getState and you will understand what I mean. that's on my to do list
  6. The node interface is Activity public interface Activity { public String status(); public boolean validate() throws InterruptedException; public void run() throws InterruptedException; } The is the Task manager public class TaskTracker { private Activity activeTask; private Activity[] taskList; public TaskTracker(Activity[] taskList) { this.taskList = taskList; } public Activity getActive() throws InterruptedException { if (this.activeTask == null || !this.activeTask.validate()) { for (Activity task: taskList) { if (task != null && task.validate()) { this.activeTask = task; break; } } } return this.activeTask; } }
  7. ya you miss understood me a little, but i understand where your coming from. You have the abstract class there as the basic timer. Then you have the other classes extending the basic class so you can easily convert the timer into mili second and nano seconds and stuff. Personally i would just keep one class. Have the constructor with an argument. Which allow the user to set the current time (in mil secs ofc). All I need is this basic class. (i posted the code for the noobies, trust me your code might seem a bit confusing to them at first.) public class Timer { private long period; private long start; public Timer(long period) { this.period = period; this.start = System.currentTimeMillis(); } public long getElapsed() { return System.currentTimeMillis() - this.start; } public long getRemaining() { return this.period - this.getElapsed(); } public boolean isRunning() { return this.getElapsed() <= this.period; } public void reset() { this.start = System.currentTimeMillis(); } public void stop() { this.period = 0; } public static String format(long milliSeconds) { long secs = milliSeconds / 1000L; return String.format("%02d:%02d:%02d", new Object[] { Long.valueOf(secs / 3600L), Long.valueOf(secs % 3600L/ 60L), Long.valueOf(secs % 60L) }); } }
  8. then remove the abstract and add in an argument to the constructor to allow the input of the current time.
  9. Why did you make the basic timer class abstract?
  10. thanks for this you gave me the idea. thats exactly what im going to do. Thanks for the info i want it to be like the hover debug where it still me the current tile. i want the api version that returns a point the x and y of the mouse position
  11. also devs need to fix some stuff with the widgets. So that old scripts can be useabke again just wait it out
  12. Joseph

    Widgets

    Also bank. IsOpen doesn't work for now use widget. Bank. Isopen. Until the devs fixed that. Diviniry will make an official post about this later
  13. i thought i was the only one noticing that
  14. How would someone find the position that is under our mouse?
  15. firstie , oh shit i cant wait for the interface debugger
  16. nice to see you back
  17. Joseph

    Crafting 1-99?

    i would think if you can make dragon hide armour and get the hide cheap then you can make profit i believe
  18. I dont believe so Nope, not that I can see
  19. you can ingore randoms and after a while they will just disappear. Also now you can right click a random and dismiss them. On top of that alek disable all randoms so that he could redo them. Besides that did anybody not see this http://prntscr.com/6c8pmt
  20. join the cb and you will know why
  21. ok when you cook an inv of food in rs. You cook a fish (anim) stop for a sec (non-anim) and repeat. So that one sec of non-animating fucks you over with the method isAnimating(). what i do sometimes i use a boolean and a timer. Every time it animates it reset timer. And i do a simple if statement check saying if the timer > 3 then my player isnt doing anything. i use the boolean for something. Just be cleaver about it :p
  22. there a method within the mouse class
×
×
  • Create New...