TaskScript Framework for state-based scripting #1466
Replies: 2 comments 13 replies
-
|
Hey ! I just wanted to let you know that I haven't forgot about this - our plugin hub feature has just been taking alot of my time. Personally, I do not want to directly rip-off dreambot's framework, and rather we take our own spin to it. We have been bashed before in the past for people attempting to take ideas from other places. so I figured lets save face now before we get too ahead of ourselves... https://github.com/g-mason0/Microbot/tree/feat/step-manager Here is what i've come up with thus far, I still need to finish up the docs & create some more abstract steps: but this works mostly the same outside of a few different things.
I'd be happy to collaborate on my fork if you would like to expand this further, again I just would like to not directly mimic how another client does things to avoid dealing with the backlash. |
Beta Was this translation helpful? Give feedback.
-
|
Nice! I am a big fan of branch-leaf based scripts. I've build and implemented the TreeScript design for PowBot and can do the same for Microbot in the near future. For my personal taste the power truly lies in adding generic references to the Plugin/Script in each tree component so you always have direct access to the main class (Plugin/Script) with all its fields and methods made available to you. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
#1416
Figured I'd start the discussion here. This PR includes two new classes, one of which extends the Microbot Script class. This can help developers write cleaner scripts and encourages abstracting out responsibilities into individual files. Instead of having a large switch statement and a function to determine an enum for which state we're in, a series of tasks can determine which state we're in. For example, a script that crafts water orbs could have the following Tasks declared in Plugin :
While developing, this simplifies the responsibilities of each task and makes the code easier to read. This is also how most Dreambot scripts are written. There also exists a branch-leaf architecture that abstracts this a layer further but I personally don't think that's necessary at this time. An example herb farming script would look like the following:
Again, not really suggesting we jump on this one nor is it in the PR above.
To use this, each task has the following two functions: accept() and execute().
accept() returns a boolean for when that task should run. execute() is what the script will do while plugin is running for a single loop and returns a value of time to be waited before the next loop. An example of a task that runs once and does nothing:
Beta Was this translation helpful? Give feedback.
All reactions