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.

Red_Spark

[Release]Red_ClayMaster(First Script)

20 posts in this topic

The script has been release(no longer in beta).The official topic is HERE.This thread will be left for technical discussions and for the scrip source code.
 

 
Script Repository Link
 
Here is the source core for the script:
New V2:
Completely redid the script form the ground up.Made is so I can expand on it with ease.Tried to correct as many mistakes as I could form V1 :)
https://gitlab.com/Red_Spark/Red_ClayMasterV2.git
 
 
Old V1:
https://gitlab.com/Red_Spark/Red_ClayMaster.git
 
Please feel free to tell me what I'm doing wrong and how can I improve.
 

Edited by Red_Spark
1 person likes this

Share this post


Link to post
Share on other sites

Congratulations on your first release. Looks like we have a promising future scripter on our hands.

1 person likes this

Share this post


Link to post
Share on other sites

UPDATES:

1.2: Date Added 24/11/2015

Made script click faster(some miss-click happen, will be fixed next update)

Added GUI with some settings

 

Still trying to figure some stuff out.

Will be adding Anti-Ban(at least some of it) next

Know bug are:Miss-clicks on items and Bank-Booth(I think I know how to fix it, but don't have the time now)

 

If you find any bugs or have suggestion please leave a comment and I will get back to you.

Share this post


Link to post
Share on other sites

UPDATES:

1.3 Date Added 25/11/2015

Minor changes to speed it up and reduce miss-clicking

Anti-Ban ADDED(still being tested)!!!!!

 

Going to work on the Paint now :)

 

I would love it if some scripters could check my anti-ban compliance to see if I'm implementing it correctly :).

Thank you.

Edited by Red_Spark

Share this post


Link to post
Share on other sites

UPDATES:

1.4 Date Added 25/11/2015

Fixed some logic errors and out of bound arrays exceptions

Added a basic pain

 

Going to try to improve the performance of the script and flush out as many errors and logic mistakes as I can.

 

Should I work on More locations next or GE support?

Share this post


Link to post
Share on other sites

Working on GE support.It will probably take a few more days(maybe even more, because my weekend is full of stuff I need to do =[ ) until I can release a test version of it to the community.

Share this post


Link to post
Share on other sites

Spent around 10 minutes looking through your code before I got distracted. Here are some things that I noticed:

  • Use Github or Bitbucket as a repository for source code
  • Version can go in the ScriptManifest, and you can store the manifest in an object, as so:

    • final ScriptManifest MANIFEST = (ScriptManifest)this.getClass().getAnnotation(ScriptManifest.class);
  • As a general rule of thumb: Program to an interface, not the implementation. An example of this is where you declared:
    • ArrayList<Node> nodes = new ArrayList<>();
    • Instead, you should declare it is a List, as so:
      • List<Node> nodes = new ArrayList<>();
  • I know it's very common to see in TRiBot scripts, but having a static Variables class (or something like it) can be detrimental to your script (if used recklessly)
    • It's important to understand the difference between static and non-static data, and how it effects your script.
      • For example, if you were to run your script on multiple tabs in the same client, some weird bugs would pop up. This is due to the fact that static data belongs to the actual class, and not the instances of it (So each tab running the same script would be sharing data).
    • If you're going to stick with a static Variables class, there really is no point in having getters and setters for all of your variables. Might as well just make them all public.
  • In your main Script class, you can simply use println(String) as opposed to General.println(String)
  • Your startTime constant in the main script class should be named START_TIME
  • Looking through your Banker.java class, some of the methods are extremely long and hard to follow.
    • You should shorten / break methods up into separate methods to help readability / maintainability.
      • It's generally accepted that methods should be ~30 lines long max, although this is pretty subjective.
    • Each method should have one specific task, don't try to do too many things in one method
  • You're null-checking a lot of null-safe arrays. You simply have to length check these. (It will say in the API which arrays are null safe)

 

Most of those details are very minor, and I was just splitting hairs.

 

Overall this is a pretty quality display for a first script, I was pleasantly surprised.

 

Nice job!

1 person likes this

Share this post


Link to post
Share on other sites

@Final Calibur

 

final ScriptManifest MANIFEST = (ScriptManifest)this.getClass().getAnnotation(ScriptManifest.class);

 

Thank you for that.I will use it.

 

  • ArrayList<Node> nodes = new ArrayList<>();
  • Instead, you should declare it is a List, as so:
    • List<Node> nodes = new ArrayList<>();

 

 Noted :).

For example, if you were to run your script on multiple tabs in the same client, some weird bugs would pop up. This is due to the fact that static data belongs to the actual class, and not the instances of it (So each tab running the same script would be sharing data).

I will defiantly change my Variables.class.

Looking through your Banker.java class, some of the methods are extremely long and hard to follow.

I know the Banker.class is a huge mess.I'm going to rework the methods.I am kind of embarrassed by it.The problem was that this was my first script and I lacked structure, so  I just kept on adding and adding things and well you can see then end result.

It's generally accepted that methods should be ~30 lines long max, although this is pretty subjective.

I will keep this in the back of my head as a general guideline.

 

I'm very grateful you took the time and looked over my core.Thank you!

PS:The one big thing I'm curios about is.How was my anti-ban?

1 person likes this

Share this post


Link to post
Share on other sites

PS:The one big thing I'm curios about is.How was my anti-ban?

 

When it comes to Anti-Ban, all you have to do is follow this guide.

 

That being said, I did notice this piece of code in a few different classes:

AntiBan.pickUpMouse();//will try to pick up mouse is its out of the game windowif(working){//AntiBanAntiBan.examineObject();AntiBan.moveCamera();AntiBan.leaveGame();AntiBan.mouseMovement();AntiBan.rightClick();}

I would probably use the timedActions method in your AntiBan class as opposed to each individual method call.

 

Your anti-ban is probably fine. As long as your script has a high ABCL rating, you don't have to worry about adding more (unless you want to).

Share this post


Link to post
Share on other sites

@Final Calibur I guess i didn't want to use some of the actions like check friends list(need make it only check it, if the account has actual friends in the list Xb ) and stuff like that.

 

I will probably rewrite the timedActions method, so could exclude some of the actions form being performed Xb.

 

PS:Already fixed the Variables class :).I made most of the values non-static(apart from few like BANK_AREA) and created it in the RedClayMaster(Main) class. :public static Variables variables = new Variables();.Is it ok that the object I made here is static?Since every new instance of the script(every new tab) will created a new instance of Variables.class, correct?

Edited by Red_Spark

Share this post


Link to post
Share on other sites

PS:Already fixed the Variables class :).I made most of the values non-static(apart from few like BANK_AREA) and created it in the RedClayMaster(Main) class. :public static Variables variables = new Variables();.Is it ok that the object I made here is static?Since every new instance of the script(every new tab) will created a new instance of Variables.class, correct?

 

All instances of RedClayMaster will share the same instance of Variables now. This is due to the fact that since variables is static, it's bound to the class, not separate instances.

 

A solution would be to simply make it this:

private Variables variables = new Variables();public Variables getVars() {    return variables;}

To access it in your other nodes, you'll have to provide a constructor in each as so:

private RedClayMaster script;public ExampleNode(RedClayMaster script){    this.script = script;}

Then you will change this line: 

 Collections.addAll(nodes, new Banker(), new BucketFiller(), new SoftClayMaker());

To this:

 Collections.addAll(nodes, new Banker(this), new BucketFiller(this), new SoftClayMaker(this));

You only have to do this for nodes that need to access data in the main script class.

 

So then to access Variables from within a node, you would simply do something like this:

script.getVars().BANK_AREA

I hope this helps.

 

Edit: Alternatively, you can simply pass the Variables class to each node that needs it, instead of the script. It really depends on if you need some data from the script class as well, or if it all is contained in Variables.

Edited by Final Calibur
1 person likes this

Share this post


Link to post
Share on other sites

Just an update:Still working on the script.I was away for a week so couldn't do much.Did a lot of re-writing of the methods and classes to make it function better.Will be posting and update in a few day(1-2Max).I might even include a beta version of the GE pert of the script(will walk to the GE, sell you soft clay and buy more clay, than go back to the spot where it was making soft-clay(Edgeville is the only location supported for now,will be adding lumb basement(memb area)).

Share this post


Link to post
Share on other sites

Sorry for the huge delay.I lost my hard drive to and unfortunate accident and i did not have any recent back up of my scripts.So trying to recover as much stuff as i can, but it will take me a lot of time to redo all of it(had all the classes re-done =[ ).Good lesson for me XD. Starting to use GitLab from now on

Share this post


Link to post
Share on other sites

I didn't have time to look through everything, but at a glance I can tell that you need to implement dynamic sleeping. Example:

// Okay, our items should get deposited. Let's wait and make sure they// get deposited.General.sleep(500, 1500);

You have the right idea in your documentation, but you then provide a static sleep. I'm noticing this a lot throughout your code.

Share this post


Link to post
Share on other sites

I didn't have time to look through everything, but at a glance I can tell that you need to implement dynamic sleeping. Example:

// Okay, our items should get deposited. Let's wait and make sure they// get deposited.General.sleep(500, 1500);

You have the right idea in your documentation, but you then provide a static sleep. I'm noticing this a lot throughout your code.

I had a method made that had dynamic sleeping(waited for the items in the inventory), but i lost it.I'm in the processes of remaking it XD.

 

PS:Thanks for reminding me about it.I forgot about it Xb.It will be implemented in tomorrows update.

Edited by Red_Spark

Share this post


Link to post
Share on other sites

V2 Released!

Source code has been updated(its a different repository)

Script ran for over 7h :)

Edited by Red_Spark

Share this post


Link to post
Share on other sites

News:

Updated 2,2 is out.

Fixed validation on tasks.

When i removed the priority system from my framework i forgot to put in my validation.So non of the task validated and would always be executed.executed. I'm so surprised that i got 10h run times on the script XD. Well now that it is fixed my fail safes are actually working.So if something happens and the script gets confused.It should reset its tasks and basically start over, without the user needing to re-start the script.Fingers crossed :)

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   0 members

    No registered users viewing this page.