1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Daemons

Discussion in 'Programming & Hardware' started by Exile, Aug 7, 2014.

  1. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    Is it possible to create a daemon within a script bot in RuneMate?

    For example:
    In a combat script bot you have 2 tasks, "attack", and "loot".
    In combat you need food, you can solve this by creating a 3rd task called "eat".
    The only problem is that if using this, you can only eat before/after the fight, and sometimes it's necessary to eat in the middle of a fight.

    It woud be ideally to create a daemon called "EatDaemon", that basically activates whenever the condition is met, and even interrupts the current actions.
    Something like the Interface closer.
     
  2. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    If you're using the ExecutorScript as your framework you can easily submit concurrent tasks, and since the mouse and keyboard both force synchronization your new task will be activated as soon as it's possible.
     
  3. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    Can you give some little example code? :p

    I'm using LoopingScript, and in the onLoop I got this:

    Code (Text):
    1. @Override
    2. public void onLoop() {
    3. if(abortScript) {
    4. stop();
    5. } else {
    6. for(Task task : tasksList) {
    7. if(task.activate()) {
    8. task.execute();
    9. }
    10. }
    11. }
    12. }
     
  4. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    https://gist.github.com/IITC/e3e77f31defc0b450e3d
     
  5. Ian C

    Joined:
    Jul 6, 2014
    Messages:
    24
    Likes Received:
    16
    Create a health monitor, once it reaches danger levels, execute the task using the timed executor. You can always check if the task queue contains the current task, to avoid resubmissions. You can even add the health monitor to the timed executor to run it. Lol
     
  6. frazboyz

    Joined:
    Nov 15, 2013
    Messages:
    339
    Likes Received:
    56
    I wrote a fairly basic framework which allows certain tasks to cancel the future of other tasks and execute itself.
     

Share This Page

Loading...