Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Worthy

Node Framework Tutorial [increase efficiency and clarity]

75 posts in this topic

5% of my plans can be accomplished without making a new API or Framework, that's cool. At least when I finish my framework, I can code things quicker without having run into errors, and flawlessly integrate more and more tasks together, which play like me, and pickup playing after I stop playing. 

 

The code I'm making is used to run code alongside the tasks for the player to do. I think you're missing that wastedbro. It's not just a call to the api in some thread just because, it has to do with the task itself.

 

The skeleton will be straightforward and very involved, not just do this and that repeat.

 

Say you want to use states and such, but you also want to do some sort of state for moving the mouse, but you use it very often and it's not just moveMouse(position), it's change an item's position in your inventory, and then drag it back to where it was. It would be handled before continuing the tasks, rather than having all of these states to track where you are in the task. Without while loops or anything.

 

And as far as I know, when using the walking methods, all other method calls before the walking is complete, will not be processed until.

 

So......?

 

Multithreading is fine. But this would also add to simplicity, essentially doing the same thing, without adding a thread.

Edited by Karmik

Share this post


Link to post
Share on other sites

5% of my plans can be accomplished without making a new API or Framework, that's cool. At least when I finish my framework, I can code things quicker without having run into errors, and flawlessly integrate more and more tasks together, which play like me, and pickup playing after I stop playing. 

 

The code I'm making is used to run code alongside the tasks for the player to do. I think you're missing that wastedbro. It's not just a call to the api in some thread just because, it has to do with the task itself.

 

The skeleton will be straightforward and very involved, not just do this and that repeat.

 

Say you want to use states and such, but you also want to do some sort of state for moving the mouse, but you use it very often and it's not just moveMouse(position), it's change an item's position in your inventory, and then drag it back to where it was. It would be handled before continuing the tasks, rather than having all of these states to track where you are in the task. Without while loops or anything.

 

And as far as I know, when using the walking methods, all other method calls before the walking is complete, will not be processed until.

 

So......?

 

 

Multithreading. 

 

It's actually quite easy.

1 person likes this

Share this post


Link to post
Share on other sites

Looking over this the only thing i'm not understanding is under my scripts package do i create a sub package for the script alone and create other sub packages inside it for he nodes? or do i create a node package in my scripts package and leave the main in the scripts package.

E.g: .tribot > src > scripts > "script name" > nodes + main script. OR
E.g: .tribot  > src > scripts > nodes + main scripts.

Share this post


Link to post
Share on other sites

Looking over this the only thing i'm not understanding is under my scripts package do i create a sub package for the script alone and create other sub packages inside it for he nodes? or do i create a node package in my scripts package and leave the main in the scripts package.

E.g: .tribot > src > scripts > "script name" > nodes + main script. OR

E.g: .tribot  > src > scripts > nodes + main scripts.

Doesn't really matter, but I do it like so:

4a4f15a468.png

Share this post


Link to post
Share on other sites

Call me ignorant, but....

 

I'm really not seeing the real benefits of nodes. Could someone please tell me why people use them?

Share this post


Link to post
Share on other sites

Call me ignorant, but....

 

I'm really not seeing the real benefits of nodes. Could someone please tell me why people use them?

They provide an efficient and effective way to split up code in scripts.

As stated in the main post, you can additionally swap nodes in and out, interchangeably, depending on the circumstances of the script as well.

Share this post


Link to post
Share on other sites

They provide an efficient and effective way to split up code in scripts.

As stated in the main post, you can additionally swap nodes in and out, interchangeably, depending on the circumstances of the script as well.

 

But, it loops through each node even when not completely needed... I guess it's just for validation. I really do like the cleanness of it, especially when it comes to changing nodes and going back to projects. It'll help with my un-neat code.

 

I've found this very useful, thanks.

Share this post


Link to post
Share on other sites

But, it loops through each node even when not completely needed... I guess it's just for validation. I really do like the cleanness of it, especially when it comes to changing nodes and going back to projects. It'll help with my un-neat code.

 

I've found this very useful, thanks.

It just calls the validation method for each node. That's usually a simple boolean, so it is nothing strenuous.

Share this post


Link to post
Share on other sites

Really like this framework, very nice OOD. I will definitely be using this for future scripts. My woodcutting script is already closing in on completion so I'm not going to overhaul everything, but all future scripts will be designed with this framework. Thank you Worthy.

1 person likes this

Share this post


Link to post
Share on other sites

This framework is the best way to manage massive scripts in conjunction with your own API.

 

I'm really liking it for my newer projects. I can reuse code way more efficiently. 

1 person likes this

Share this post


Link to post
Share on other sites

This framework is the best way to manage massive scripts in conjunction with your own API.

 

I'm really liking it for my newer projects. I can reuse code way more efficiently.

Thanks brah

Share this post


Link to post
Share on other sites

I like this framework, looks a lot more structured and clear than the state one! Great tut keep it up mate : )

Share this post


Link to post
Share on other sites

They provide an efficient and effective way to split up code in scripts.

As stated in the main post, you can additionally swap nodes in and out, interchangeably, depending on the circumstances of the script as well.

Smh... Stop making tutorials. How will your Node framework be beneficial in circumstances where you need to immediately stop and go to another Node? No where did you elaborate on this.

Edited by swagger417

Share this post


Link to post
Share on other sites

Smh... Stop making tutorials. How will your Node framework be beneficial in circumstances where you need to immediately stop and go to another Node? No where did you elaborate on this.

If you are coding correctly, each node will know to stop execution if it is ever no longer valid. IE, if you have a "Walk" node, you set a timeout and check to make sure the location is still valid to walk.

 

Stop needlessly spreading your stupidity across the forums. You aren't helping anyone, and you don't sound smart or cool.

 


 

PS: Of course you can expand upon this framework to improve functionality and versatility. If you are doing that, however, you wouldn't need a tutorial to make the framework in the first place. That is what makes this tutorial useful.

1 person likes this

Share this post


Link to post
Share on other sites

Stop needlessly spreading your stupidity across the forums. You aren't helping anyone, and you don't sound smart or cool.

 

>Never said I was cool or smart, never was attempting to help anyone.

 

Your Java tutorials surely are intellectual and helpful.

Share this post


Link to post
Share on other sites

Your Java tutorials surely are intellectual and helpful.

Funny how they are.

 

Anyways, stop cluttering threads with your bullshit.

1 person likes this

Share this post


Link to post
Share on other sites

What a simple idea that is helpful in so many ways.

Thanks for sharing this, I am definitely going to use it for my first script!

1 person likes this

Share this post


Link to post
Share on other sites
On 12/2/2014 at 9:34 AM, Worthy said:

Good luck. When you create a good script using your advanced super amazing framework, tag me in the post and show me a long proggie and some (or all) of the source with your framework.

i like you haha  :P

Edited by sank2014

Share this post


Link to post
Share on other sites

hey I'm just wondering everytime i look at the script it's in a scrolling box, is there a way to change it so it displays the code as a page?

Share this post


Link to post
Share on other sites
On 4/21/2016 at 9:14 PM, darkjack7 said:

hey I'm just wondering everytime i look at the script it's in a scrolling box, is there a way to change it so it displays the code as a page?

Updated.

Share this post


Link to post
Share on other sites
On 9/8/2013 at 10:41 AM, Worthy said:

package scripts.powerminer.api; public abstract class Node { public abstract void execute(); public abstract boolean validate(); }

I really like this guide and would very much like to write my scripts like this. Thanks for the guide it totally helped me clear up a lot of confusion. I am a newbie at scripting and hope to complete my first script within a week. Currently reading these guides and examining source code to learn. 

Share this post


Link to post
Share on other sites
2 hours ago, 1brian3 said:

I really like this guide and would very much like to write my scripts like this. Thanks for the guide it totally helped me clear up a lot of confusion. I am a newbie at scripting and hope to complete my first script within a week. Currently reading these guides and examining source code to learn. 

:)

Share this post


Link to post
Share on other sites

Sequential nodes:

 

I am working on a rebuild class for when accounts are banned, obviously this is like one big quest script.  Each task is sequential: Tutorial island, train skill 1, train skill 2, quest 1, quest 2, etc.

 

When an account is first made, all task nodes' validate() methods would return true, since none of the tasks have been completed yet.  To prevent switching tasks prematurely, should the for-loop be modified? What is the best way to accomplish this? I was thinking:

 

for(final Node node : nodes) {

            if(node.validate()) {

                node.execute();

                //sleep for some amount
                
                break;

            } else {

                nodes.remove(node);

            }

        }

 

Is there a better way?  Sorry for being a total noob at node framework and tasking. 

Share this post


Link to post
Share on other sites

Why is

public static ArrayList<Node> nodes = new ArrayList<>();

static?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   1 member