Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Request "beginLoop" type method

Joined
Dec 28, 2013
Messages
190
There's quite a few things developers would probably want to do each loop that really wouldn't fit into a task/tree node. Especially when developing base frameworks it would be very useful and clean to run generic logic (ensure roofs are disabled, run is enabled if above a certain threshold, etc) before onLoop runs. Internally the first line of onLoop would literally just change to a call to "beginLoop".

Both Task/Tree bots literally extend from LoopingBot. We should be able to utilize this.

Or just simply allow us to override onLoop and assume developers will be smart enough to call the super method.
 
Last edited:
Joined
Mar 28, 2017
Messages
286
Well then, why not just make it your starting branch. You say you can't, but I'd figure you can.

Check to see your arguements you mention above (run & roofs)

yes? -> begin running bot
no? -> well, enable roofs and run, or jusut stop the bot

Personally, I don't see the problem, then again, I have yet to dev a bot
 
Joined
Dec 28, 2013
Messages
190
Well then, why not just make it your starting branch. You say you can't, but I'd figure you can.

Check to see your arguements you mention above (run & roofs)

yes? -> begin running bot
no? -> well, enable roofs and run, or jusut stop the bot

Personally, I don't see the problem, then again, I have yet to dev a bot
This goes against the entire point of the Tree/Task framework. Having an "entry" level branch you use in all your bots that executes some generic code (which would have to be done in the onValidate method mind you, I don't think I have to explain how terrible this is) would always return the same value to enter your bots main branch. This is literally an overcomplicated "beginLoop" method.

Granted you "could" use onValidate as a way to check your generic config is set properly and if not execute a specific leaf (and if so continue on with your bots core logic) but there are certain things that a developer may need to do that don't require checks and should be executed every loop. This runs back into the issue I stated above where you're executing code in onValidate.

Couldn't you use a TreeTask as your root and flag it as a leaf?
See my reply above.
 
Joined
Aug 23, 2015
Messages
1,961
You can just write what you need and put it at the beginning of each leaf. I don't see many, if any use cases for this though tbh. Stuff like run energy is already managed automatically behind the scenes, and most other things should/could just be their own leafs.
 
Joined
Dec 28, 2013
Messages
190
You can just write what you need and put it at the beginning of each leaf. I don't see many, if any use cases for this though tbh. Stuff like run energy is already managed automatically behind the scenes, and most other things should/could just be their own leafs.
You could but you'd end up duplicating code all over the place. Again, this is mainly for developing base frameworks (which I'm surprised it seems most people don't do) instead of extending RuneMates base TreeBot for every bot you write.

Run energy is only managed if you 1) pass the traversal option and 2) actually use step. You'll never call these methods (and therefore never have the bot toggle run) if you're in an enclosed place such as the blast furnace.
 
Top