Jump to content
c#2Bot

[Video/Text Tutorials] From java basics to writing simple scripts [Eclipse]

Recommended Posts

Why am i making this tutorial?

 

  • The main aim of this tutorial is to introduce you to the basics of java and get you around understanding Tribot's API.
  • Additionally, through this tutorial i hope to aid people who are trying to learn scripting, and by that increase the number of free scripts.

___________________________________________________________________________________________________________________________________________

"Basic" Introduction To Java

Lesson 1: Classes

Quote

1.1 What is a class?

A class can be referred to as the template where objects can be created such as variables, methods, constructors or block.

df1b84480d.png

An empty class.

1.2 What are constructors?

Constructors are instance methods that allows you to create an instance of a certain class and setting objects values of that class to the values specified in its parameters.

451eb1e7b5.png

The constructor will set the private variable age value to the value of its parameter when a new Variable class instance is created.

6707a3620b.png

The constructor on the right side assignment is passing the value 20 to the new instance of the Variables class.

Lesson 2: Variables

Quote

2.1 What are variables?

A variable can be described as a name given to specific defined portion allocated within the memory. To elaborate:

385bb920ca.png

The image above illustrates data stored within the memory, all 6 objects are variables of the type Integer, to make those variables accessible it is necessary for us to name them, as all variables in the image are of the same type, naming them will make them unique and hence accessible.

8a0515f47f.png

2.2 What are the types of variables?

There are 3 types of variables: local, instance and static.

- Local Variables:

Local variables are the variables declared inside a method, constructor or blocks. Access modifiers cannot be used on local variables, and once they are declared, they cannot be accessed from another region other than where it has been declared. 

f098e18024.png

Error displayed when applying a modified to a local variable.

a5238f2fc3.png

Method copy shows the variable one is not used, and method print shows that variable one does not exist.

 

- Instance Variables:

Instance variables are the opposite of local variables, they are created inside a class but outside a method, constructor and block. Access modifiers can be applied to instance variables  however it cannot be declared as static.

beff0c1751.png

Methods copy and print can access the variable ten and twenty.

 

- Static Variables:

Similar to instance variables in terms of being declared inside a class but outside a method,constructor and block. Static variables can be access from outside class without creating an instance of its parent class.

7102f66e2e.png

A static variable has been declared in the Variables class.

b8a1ed7058.png

The static variable seventy is accessed by the method check in the class Methods without creating an instance of Variables class

Lesson 3: Access Modifiers

Quote

1.1 What are access modifiers?

Access modifiers define the level of accessibility of a variable,method,constructor and a class.

1.2 What are the types access modifiers?

There are four types of access modifiers: default,public,private and protected.

- Default Access Modifier

When you do not specify whether your object is public,private or protected, it is set to the default access modifier by default. For instance, if a variable is given a default access modifier, it will only be available for access only in classes in the same package as the parent class.

9a323d7f99.png7d64d40adf.png

variable test accessed from Variables class in the same package as Methods class.

645533fa35.png

variable test cannot be accessed from another package due to it having a default access modifier.

- Public Access Modifier

Allows your object to be accessible from anywhere.

 afd56b2d03.png5960a0dc68.png

variable test accessed from another package due to it having public access modifier.

- Private Access Modifier

Allows your object to be accessible only in its parent class.

46aa0df163.png5f94d228be.png

variable test cannot be accessed anywhere but in the parent class.

- Protected Access Modifier

Allows your object to be accessible in and out of parent class package only through inheritance.

2566179e30.png5161634562.png

method msg() can only be accessed through inheritance and by calling super. 

Lesson 4: Arrays

Quote

4.1 What are arrays?

An array can be considered as a collection of objects that are of the same type. Consider:

7286734814.png

For the sake of demonstration, lets consider this box of cows above to be an RSNPC array of cows, in this array of cows, we have 4 cow RSNPC objects, naturally each object within this array of cows hold an index which identifies its position in the array, the indexing starts from 0.

	private RSNPC cow1;
	private RSNPC cow2;
	private RSNPC cow3;
	private RSNPC cow4;

	private RSNPC[] cows = new RSNPC[] { cow1, cow2, cow3, cow4 };

This is how the box of cows in the previous image is represented in java

Lesson 5: Enums

Quote

5.1 What are enums?

Enums are data types that can store constant information as it is by nature static and final. We talked previously about arrays, in an enum when enum.values()  method is called, it returns an array that contains all the elements in the enum, while each element in the enum can store multiple types of data and provides easy way to access them. Have a look:

bbd5f82695.png591c4f6096.png

  In the above enum Cows, we have two objects, COWS and COW_CALVES, and they hold three attributes id, name and alive, on the right is how they can be accessed from the different class.

Lesson 6: Interfaces

Quote

6.1 What are interfaces?

Interfaces are reference objects similar to a class, where methods can be collected at, however methods in an interface are all abstract, while abstract is a non access modifier that allows a method to be declared without any implementation. When a class implements an interface, all the methods in the interface will be inherited and defined into the class itself, lets have  look below:

9c4e6fdad7.pnge9e628b650.png

  In the interface Variables we have methods collect() and drop() declared, while in Methods class which implements the interface Variables has inherited those methods and defined them.

 

___________________________________________________________________________________________________________________________________________

"Basic" Introduction To Tribot API

Lesson 1: Skeleton Script

Quote

1.1 How does a tribot script structure look?

First of all to make your java program an executable tribot script you will need to extend the class Script which will allow your program to inherit the run() method and implement it, this method will contain a collection of instructions that will be converted by the client to actions.

2107699c00.png

Extending the class Script into your program.

1.2 What is a script manifest?

Applying a script manifest into your script will allow tribot's script loader to properly categorize your script, give it a name and an author.

9185eb1f79.png

Adding a script manifest to your script.

137b93f480.png

How will your script be categorized in the script manager.

1.3 What is an infinite loop?

An infinite loop is a loop that will constantly, endlessly execute a set of instructions defined inside it due to the fact that its condition is always met,  can never be met, or having no stopping condition in the first place.

0819cb3a61.png

Under the method run(), we are asking the client to print a welcoming message for us when we run the script.

ad012c9c60.png

When the script started, the welcome message was printed and the script terminated because all instructions in run() were executed.

8397d47816.png

An infinite loop was introduced, and the client is asked to print a welcome message and sleep for a random amount of ms.

2b32834e93.png

When the script started, the client continuously printed the welcome message and slept for few ms due to it being stuck in the loop.

c0c540e702.png

Now a condition has been set in the loop, so the instructions under it will continue executing only while the condition is true.

b288870321.png

When the script was started, the client printed 5 welcoming messages and stopped the script as the condition in the loop became false.

Lesson 2: Entities

Quote

2.1 Debugging Entities

To debug entities and display information about this simply do as shown below:

70436432ab.gif

2.2 RSObjects

Through your scripting, you will frequently find yourself in a position to interact with certain objects, and in this section we will discuss how can we define our target object and how can we interact with it. We have discussed before in section 4 what are arrays, to recap arrays are collections that will store objects of the same type.

83e878f552.png

We have created a array of the type RSObject were we will be storing objects that happened to be doors, the array is now empty.

So we have decided that we want to interact with doors as our RSObjects, so how do we go on and store doors in our RSObject array, well tribot api provides us with a method that returns an RSObject[] when provided with certain parameters, lets have a look:

d5dbb71149.png

Now the method Objects.findNearest needs an int value parameter called distance which will be the distance it will search for the objects needed that has the same name that is given in the String value parameter called ids.

dab4adeb9b.png

Now that we have specified the required parameters, the request sent to the client is please find all objects that has the name "Door" and are within a 10 tiles radius from my character, and then kindly store them in my RSObject[] doors.

ba4472832f.png

Now lets ask our client to attempt to find us some doors based on the conditions we have specified in the above image.

11eef74d4c.png

Since my character did not have doors in 10 tiles radious, the client printed a notification that there are no doors available.

c6dba70370.jpg

Now that my character has two doors within 10 tiles radius, the client notified me that the length of my RSObject[] doors is 2, which means that i have two door objects stored in that array.

d24eac4838.png

Now that we have our doors stored in our RSObject[], before we start interacting, to avoid out of bounds exceptions and null pointer exceptions we check the RSObject[] doors length to be greater than 0, which basically means that check if out array is not empty or null, then if the length of the array is greater then 0 we cache the first object in the array that has an index of 0 in an RSObject named door, the task we want to perform is rotate the camera, however we cant rotate to the object if it is null, and we should only rotate when it is not on the screen.

ec105cf4d0.gif

This is what will the client do for the set of instructions in the previous image.

Now we know how to turn our camera to our desired door object, lets make things a little bit more complex, now let say we want the client to check if the door is on screen, then if it is on screen can we click it? if not wen walk closer to it, and all these tasks should be performed if the door is closed. Just to let you know in here i am going to introduce filters, but i will talk about those in depth in later sections.

	private RSObject[] grabAllDoors() {
		return Objects.findNearest(10, new Filter<RSObject>() {
			@Override
			public boolean accept(RSObject a) {
				RSObjectDefinition def =a.getDefinition(); // first we catch the object definition 
				if (def == null)//check if the object definitions exists
					return false;
				String[] actions = def.getActions();// cache the actions of the object
				if (actions.length == 0)//check if the actions exist
					return false;
				if (!Arrays.asList(actions).contains("Open"))// check if the object actions contains the action needed
					return false;
				return def.getName().equals("Door"); // return the objects with name Door after satisfying conditions above
			}

		});
	}

	private RSObject grabDoor() {
		RSObject[] objects = grabAllDoors();
		if (objects.length > 0) {
			return objects[0];// grab the first object from the array
		}
		return null;
	}

The method RSObject door() will grab our door object from the RSObject[] doors() method.

	@Override
	public void run() {
		while (true) {
			RSObject door = this.grabDoor();
			if (door == null)
				return;
			if (door.isOnScreen() && door.isClickable()) {
				door.click("Open");
			} else {
				Walking.walkTo(door);
			}
		}
	}

Now in our run() we will attempt to find any door that is closed and open it.

f376889986.gif

The client will execute the code in the run() method and this will be the result.

2.3 RSNPCs

Almost the same procedure is done with npcs compared to objects, lets say we want to kill a man, first we check if we are in combat, if not we find a man, then check if that man is in combat, if he is not, then we check if he is on screen, if not we walk to him, if he is then we kill him.

	private RSNPC[] grabNearMen() {
		return NPCs.findNearest(new Filter<RSNPC>() {
			@Override
			public boolean accept(RSNPC a) {
				RSNPCDefinition def = a.getDefinition();
				if (def == null)
					return false;
				return def.getName().equals("Man") && !a.isInCombat();
			}
		});
	}

	private RSNPC grabMan() {
		RSNPC[] objects = grabNearMen();
		if (objects.length > 0) {
			return objects[0];
		}
		return null;
	}

We grab out RSNPC man() from the RSNPC[] men() method.

	@Override
	public void run() {
		while (true) {
			RSNPC man = this.grabMan();
			if (!Combat.isUnderAttack()) {
				if (man == null)
					return;
				if (man.isOnScreen() && man.isClickable()) {
					man.click("Attack");
				} else {
					Walking.walkTo(man);
				}
			}
		}
	}

  We will attempt to kill the man based on the condition specified in the run() method.

a159731a5e.gif

The client will execute the code in the run() method and this will be the result.

2.3 Inventory items

I believe by now you understood the concept, if we wanted to interact with an item in the inventory, we will check if the item exists, and perform the necessary action like so:

	private RSItem[] grabAllInvItems(String item) {
		return Inventory.find(new Filter<RSItem>() {
			@Override
			public boolean accept(RSItem a) {
				RSItemDefinition def = a.getDefinition();
				if (def == null)
					return false;
				return def.getName().equals(item);
			}
		});
	}

	private RSItem grabInvItem(String item) {
		RSItem[] items = grabAllInvItems(item);
		if (items.length > 0) {
			return items[0];
		}
		return null;
	}

We are grabbing the bronzeSword() RSItem from the RSItem[] bronzeSwords() method.

	@Override
	public void run() {
			RSItem bronzeSword = this.grabInvItem("Bronze sword");
			if (bronzeSword != null)
				bronzeSword.click("Wield");
		}
	}

We null check the bronzeSword() item if it exists then we wield it.

48bc9498dc.gif

When we run the script, the client will perform the wield command and ends the script.

2.4 Ground items

Now all items will have the same procedure, its just that they of different types, lets consider some bones on the ground, how do we go on about looting them, what would be the steps? first we need to know if there are some bones around, if yes then are they on the screen? if not we walk to them, if they are then we loot them, so how do we do that in code? by now it should be very easy, lets have a look:

	private RSGroundItem[] grabNearGroundItems(String item) {
		return GroundItems.findNearest(new Filter<RSGroundItem>() {
			@Override
			public boolean accept(RSGroundItem a) {
				RSItemDefinition def = a.getDefinition();
				if (def == null)
					return false;
				return def.getName().equals(item);
			}
		});
	}

	private RSGroundItem grabGroundItem(String item) {
		RSGroundItem[] items = this.grabNearGroundItems(item);
		if (items.length == 0)
			return null;
		return items[0];
	}

We are grabbing the bone() RSGroundItem from the RSGroundItem[] bones() method.

	@Override
	public void run() {
		while (true) {
			RSGroundItem bones = this.grabGroundItem("Bones");
			if (bones == null)
				return;
			if (bones.isOnScreen() && bones.isClickable())
				bones.click("Take");
			else
				Walking.walkTo(bones);
		}
	}

We null check the bone()  grounditem if it exists then we take it.

fe6fc3b6c9.gif

When we run the script, the client will perform the take command and ends the script.

2.5 Bank items

The only difference with bank items is that we gotta be extra careful with those, we will have a bit more checks to perform, for instance lets say we want to grab some coins from the bank, so what should we do? yes first we check if the banking screen is open, if not we open the bank, if it is open we check if the bank items loaded because they take time to load, once they have loaded, we check if the coins actually exists in the bank, and if they do do we have the required amount, if we do we withdraw it, it not we stop the script. Now how do we put all these check into code, lets see how:

	private boolean withdraw(String item,int checkAmount,int withdrawAmount) {
		if (!this.itemAvailable(item,checkAmount))
			return false;
		return Banking.withdraw(withdrawAmount, item);
	}

	private boolean itemAvailable(String item,int amount) {
		RSItem[] coins = Banking.find(item);
		if (coins.length == 0)
			return false;
		return coins[0].getStack() >= amount;
	}

	private boolean bankItemLoaded() {
		RSItem[] items = Banking.getAll();
		if (items.length < 1)
			return false;
		return items.length >= 1;
	}

  With these methods we will check if the bank items has loaded, coins are available, and withdraw the coins

	@Override
	public void run() {
		while (true) {
		int withdrawAmount = 10;
		int checkAmount = 15;
		String coins = "Coins";

		if (Inventory.getCount(coins) < withdrawAmount) {
			if (Banking.isBankScreenOpen()) {
				if (this.bankItemLoaded())
					withdraw(coins, checkAmount, withdrawAmount);
				else
					sleep(50, 80);
			} else {
				Banking.openBank(); // this is a boolean method should be
									// checked if successful dw bout it for
									// nowfor now
			}
		}
		}
	}

In the run method, we will check whether or not we have 10 coins in our inventory, if not we check if the bank sreen is open, is not we open it, if yes we check if the bank items loaded, if they did then we withdraw.

f6ac6faba1.gif

When we run the script, the client will perform the withdraw() command .

Lesson 3: Filters

Quote

3.1 What are filters?

By now it should be understood that the client iterates through objects and returns them back as an array which you cache based on certain parameters that you specify, for instance lets take RSObject[] as an example, lets say we want to get a door object that is closed and we want to open it, normally this is how we would do it:

			RSObject[] doors = Objects.findNearest(10, "Door");

Basically based on the parameters specified, the client will look for all objects with the name door within a 10 tiles radius and store them for us in the RSObject[] doors, through which we will be able to command the client to do tasks with regards to these objects stored in the array. There is nothing wrong with this approach, however by implementing this, we will cache all door objects within the 10 tiles radius regardless of them being opened, or closed or whether they are in a certain area or not. However, through using filters, we can actually command the client to grab only the closed doors, and disregard the open ones into our array, lets have a look on how to use the filter:

 

	/*
	 * so what we are asking the client here, please grab all objects
	 * within a 10 tiles radius, that satisfy the conditions stated in the
	 * boolean method accept(), and store them in the RSObject[] doors
	 * please notice that it is important to specify the object type in <> 
	 * just like in an arraylist you have to specify the type String/Integer etc..
	 * 
	 */
	RSObject[] doors = Objects.findNearest(10, new Filter<RSObject>(){
		@Override
		public boolean accept(RSObject door) {
			/*
			 * first we cache the object definition
			 */
			RSObjectDefinition def = door.getDefinition();
			/*
			 * now we need to check if the door's definition is null, so that when we check its name
			 * it doesnt throw a null pointer exception as well
			 */
			if (def == null)
				return false;
			/*
			 * now what we need to do is determine whether the door is open or closed, how do we do
			 * that? simply check its actions, if it is closed it wont have the open action
			 */
			String[] actions = def.getActions();
			/*
			 * if the actions array doesnt have any objects "actions" we return false
			 */
			if (actions.length ==0)
				return false;
			/*
			 * if the actions array doesnt contain the action open that means the door is closed
			 * which means we shouldnt store it in the array, because we only want closed doors,
			 * hence we return false
			 */
			if (Arrays.asList(actions).contains("Open"))
				return false;
			/*
			 * now that we finally cleared out all our conditions, we specify the objects 
			 * characteristics that we want to be stored in our array, we want all doors,
			 * so we return that the object name should be equal to door
			 */
			return def.getName().equals("Door");
		}		
	});

 

Lesson 4: Abc2 + Open Source scripts

Quote

To my understanding i implemented ABC2 in my pest control script, you can have a look at it and my open sourced scripts here

Lesson 5: Developing a simple fishing script

Quote

 

 

 

Edited by c#2Bot
  • Like 4

Share this post


Link to post
Share on other sites
10 hours ago, c#2Bot said:

Potentially increase the amount of free scripts to be used by everyone in the tribot community.

appreciate it, nice idea. i'm looking forward to see your guide

Edit: Thanks, awesome video guide, will help so much to beginners

Edited by rvqx
  • Like 1

Share this post


Link to post
Share on other sites
Just now, Final Calibur said:

Love the new text guide, great job. Definitely a nice resource for beginners.

Keep up the good work.

@Final Calibur thanks mate for the support, i intend to start with the basic fundamentals of java, then start making short progressive videos on scripting, will try to make each video 20 mins max, hope this helps out.

  • Like 1

Share this post


Link to post
Share on other sites
On 7/31/2016 at 10:54 AM, c#2Bot said:

@Final Calibur thanks mate for the support, i intend to start with the basic fundamentals of java, then start making short progressive videos on scripting, will try to make each video 20 mins max, hope this helps out.

 

 

I would recommend staying away from making videos w/o commentary in general, they're just extremely hard to follow.

Share this post


Link to post
Share on other sites
6 hours ago, Sphiinx said:

 

I would recommend staying away from making videos w/o commentary in general, they're just extremely hard to follow.

They are just there to elaborate on the text tutorial and made as short as possible

Edited by c#2Bot

Share this post


Link to post
Share on other sites
On 7/31/2016 at 0:50 PM, Final Calibur said:

Love the new text guide, great job. Definitely a nice resource for beginners.

Keep up the good work.

I think it's a good resource. I've studied Java, but I have had to learn about scripting for Tribot and these tutorials really help!

  • Like 1

Share this post


Link to post
Share on other sites
	private RSObject[] doors() {
		return Objects.findNearest(10, new Filter<RSObject>() {
			@Override
			public boolean accept(RSObject a) {
				if (a == null)// we check if the object exists
					return false;
				if (a.getDefinition() == null)//check if the object definitions exists
					return false;
				String[] actions = a.getDefinition().getActions();// cache the actions of the object
				if (actions.length == 0)//check if the actions exist
					return false;
				if (!Arrays.asList(actions).contains("Open"))// check if the object actions contains the action needed
					return false;
				return a.getDefinition().getName().equals("Door"); // return the objects with name Door after satisfying conditions above
			}

		});
	}

	private RSObject door() {
		RSObject[] objects = doors();
		if (objects.length > 0) {
			return objects[0];// grab the first object from the array
		}
		return null;
	}

 

	@Override
	public void run() {
		while (true) {
			if (door() == null)
				return;
			if (door().isOnScreen() && door().isClickable()) {
				door().click("Open");
			} else {
				Walking.walkTo(door());
			}
		}
	}

 

These snippets, along with every other example you provided that uses the same format are absolutely terrible examples of scripting.

 

Your "door" function should only be called once and cached and act opon that rsobject, not every single time you are doing something with it you call it. Just like in your scripter application, which people said MULTIPLE times that you should be caching variables before calling them, this is another simple example of why people should be voting no.

@Override
	public void run() {
		while (true) {
			RSObject door = door(); //still terrible imo
			if (door != null) { //returning stops the script what if we want it to continue to run while we walk around
				if (door.isOnScreen() && door.isClickable()) {
					door.click("Open");
				} else {
					Walking.walkTo(door);
				}
			}
		}
	}

 

Naming is also fairly bad and not descriptive of what the functions do.

door() or doors() might be better to name getDoor() or getDoors() as a scripter can expect that they are retrieving something from that function.

 

  • Like 1

Share this post


Link to post
Share on other sites

@Deluxes i appreciate your concerns, your points are valid and they are true, and i agree there are points where i need to improve, i never said i am the number 1 tribot scripter, i am a candidate here i improve based on practice, its okay if you feel my code is terrible, thats your right, but i dont agree with your comments, in the snippets your quoting you can clearly see that i am explaining how test and debug, whether your want to continue the script or do something else thats up to you and actually included in the video where i am actually "constructing" a script , not in single area of my tutorial did i claim in my tutorial that these snippets are the best practices to implement, however i mentioned where possible that we are only testing and debuging and problem solving to find out how to overcome things.

i respect your opinion, and people are free to vote no or yes both are welcomed by me, i am not here to make a war space with you, all in all i do have some areas that i should improve, but my code works. feel free to find me wherever i post to criticize me, however dont make me feel like this is personal, and your trying to get me denied on something because we are both grown ups here right :) the tile speaks for itself, i do not need to justify any further, thank you anyways for your input, i appreciate the fact that you are an individual that care enough to follow up my work and progress thanks for boosting myself esteem. :D

Edited by c#2Bot
  • Like 1

Share this post


Link to post
Share on other sites
13 minutes ago, HaydenTaylor said:

You seem a little out to get this guy because he offended you on dischord... As your Bio suggests you're only making an ass out of yourself.

I'm not out to get anyone. Just about everything in this tutorial is wrong and should not be followed. I'm not sure what assumptions you feel I am making here.

Share this post


Link to post
Share on other sites
14 minutes ago, Assume said:

I'm not out to get anyone. Just about everything in this tutorial is wrong and should not be followed. I'm not sure what assumptions you feel I am making here.

Lol everything here about java from a java book , apparantly oracle should start contracting with you. 

Share this post


Link to post
Share on other sites

Lesson 1:

1.1 Wrong. An object is a class.

1.2 Wrong. A Constructor is not an instance method. A constructor simply allows the constructing of an object. 

Lesson 2:

2.2 Wrong. There are many more than 3 types of variables. You wrote as if you were writing about scope. You are correct the 3 scopes are local, instances, and static. But those are not types of variables.

Lesson 4:

4.1 Wrong. You do not have 4 Cow objects. You have four string objects.

Lesson 5:

5.1 Wrong. Enums are not constant and final by default. The data stored in an enum is only constant and final if you so define the variables as constant and final. Also, constant an final are synonyms. There is no const or constant keyword in Java. Only final.

Lesson 6:

6.1 Not totally wrong but a terrible example to use.

Introduction to the API

2.2 You say a name is an ID. It is not. An ID is an ID. A name is a name. You don't even realize the API provides both find by ID and a find by name method.

An array returned by the Tribot API in relation to finding objects will NEVER contain a null object. Do not null check here.

 

When using a filter to find objects, you do not need to null check the passed object. It will never be null.

You grab the definition to check if it is null. You then grab the definition again if it is not null. There is no guarantee the second call will return a non-null object. Wrong.

You then repeat this once more. Wrong.

The same is all same for 2.2-2.4. All wrong.

 

For bankItemLoaded why would you write it like that. All you need is return Banking.getAll().length > 0. That's it. Done.

itemAvailable is terrible written. It does not convey what item it is looking for. Even if you knew what it is, available means >= 1 but you define it as >= 10. Why. Terrible. Wrong.

 

3.1 I already talked about how you did everything with filters wrong. 

 

 

 

So yeah. Most of it is wrong and no one should follow this.

Edited by Assume

Share this post


Link to post
Share on other sites
26 minutes ago, Assume said:

Lesson 1:

1.1 Wrong. An object is a class.

1.2 Wrong. A Constructor is not an instance method. A constructor simply allows the constructing of an object. 

Lesson 2:

2.2 Wrong. There are many more than 3 types of variables. You wrote as if you were writing about scope. You are correct the 3 scopes are local, instances, and static. But those are not types of variables.

Lesson 4:

4.1 Wrong. You do not have 4 Cow objects. You have four string objects.

Lesson 5:

5.1 Wrong. Enums are not constant and final by default. The data stored in an enum is only constant and final if you so define the variables as constant and final. Also, constant an final are synonyms. There is no const or constant keyword in Java. Only final.

Lesson 6:

6.1 Not totally wrong but a terrible example to use.

Introduction to the API

2.2 You say a name is an ID. It is not. An ID is an ID. A name is a name. You don't even realize the API provides both find by ID and a find by name method.

An array returned by the Tribot API in relation to finding objects will NEVER contain a null object. Do not null check here.

 

When using a filter to find objects, you do not need to null check the passed object. It will never be null.

You grab the definition to check if it is null. You then grab the definition again if it is not null. There is no guarantee the second call will return a non-null object. Wrong.

You then repeat this once more. Wrong.

The same is all same for 2.2-2.4. All wrong.

 

For bankItemLoaded why would you write it like that. All you need is return Banking.getAll().length > 0. That's it. Done.

itemAvailable is terrible written. It does not convey what item it is looking for. Even if you knew what it is, available means >= 1 but you define it as >= 10. Why. Terrible. Wrong.

 

3.1 I already talked about how you did everything with filters wrong. 

 

 

 

So yeah. Most of it is wrong and no one should follow this.

can you not read? for major parts of your qoutes it says FOR THE SAKE OF DEMONSTRATION LETS CONSIDER, seriously you have issues reading, i never said a class is an object, i said a class is a template where objects can be stored, please, either read the commentary or just stop "ASSUMING".

Share this post


Link to post
Share on other sites
1 minute ago, c#2Bot said:

can you not read? for major parts of your qoutes it says FOR THE SAKE OF DEMONSTRATION LETS CONSIDER, seriously you have issues reading, i never said a class is an object, i said a class is a template where objects can be stored, please, either read the commentary or just stop "ASSUMING".

WHY WOULD YOU MAKE A TUTORIAL FOR DEMONSTRATION PURPOSES THAT IS WRONG. DON'T MAKE A TUTORIAL IF YOU'RE NOT GOING TO DO THINGS CORRECTLY.

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, Assume said:

WHY WOULD YOU MAKE A TUTORIAL FOR DEMONSTRATION PURPOSES THAT IS WRONG. DON'T MAKE A TUTORIAL IF YOU'RE NOT GOING TO DO THINGS CORRECTLY.

its not wrong, your just self centered and lack the imagination to see the point of the tutorial, you dont know everything, dont think you have achieved mastery, you are experienced thats all. go research and then come chat shit, as i said i did not bring this tutorial from my ass, i was using a JAVA BOOK as my reference.

Share this post


Link to post
Share on other sites
1 minute ago, c#2Bot said:

its not wrong, your just self centered and lack the imagination to see the point of the tutorial, you dont know everything, dont think you have achieved mastery, you are experienced thats all. go research and then come chat shit, as i said i did not bring this tutorial from my ass, i was using a JAVA BOOK as my reference.

And somehow, you managed to do almost everything wrong. I do see the point of the tutorial, it just so happens you missed the point by teaching nothing correctly. 

Share this post


Link to post
Share on other sites
3 minutes ago, Assume said:

And somehow, you managed to do almost everything wrong. I do see the point of the tutorial, it just so happens you missed the point by teaching nothing correctly. 

your barely humble opinion remains an opinion, that i could or could not accept, it just shows your intentions and feelings by stating that EVERYTHING in this tutorial is wrong, i know whats this all about, and so do you, as i said, this tutorial is basic, if you enjoy the drama your causing and its amusing be my guest and continue, as of myself, i would rather invest this 30 seconds im using to reply to u in something useful, rather than let it go waste for you immature playground.

Share this post


Link to post
Share on other sites
5 minutes ago, c#2Bot said:

your barely humble opinion remains an opinion, that i could or could not accept, it just shows your intentions and feelings by stating that EVERYTHING in this tutorial is wrong, i know whats this all about, and so do you, as i said, this tutorial is basic, if you enjoy the drama your causing and its amusing be my guest and continue, as of myself, i would rather invest this 30 seconds im using to reply to u in something useful, rather than let it go waste for you immature playground.

There's definitely some useful information that can help beginners, but you make some misstakes like stated earlier. If you want to improve you'll have to accept constructive feedback and improve on that, especially if your goal is to learn people how to code.

Edited by swagg
  • Like 1

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

  • Similar Content

    • By NeuroGenix
      Post rewritten after rewritting and updating the code multiple times.
      So I decided to give writing my own GE API a go and this is what I've come up with so far, using Exchange#offer(name, price, quantity, buy) will do the following:
      If the GE is closed, it will open it and continue making the offer. If the price is set to -1 then it will use the buttons to increase or decrease the price, depending on whether it is a buy or sell offer, until it is at a price that will buy/sell instantly. Otherwise it will use the custom input button to set the price. It will set the quantity using the 1/10/100/1000 buttons. I plan on updating this to randomise between using them and the custom input method shortly. Edit* I hadn't even remembered implementing this until I saw it do it whilst testing the method, and it was beautiful, but if it goes over the buy quantity accidently, in the example I saw it was clicking +100 and clicked it again too fast so instead of stopping before its target of 875 it got to 900, it will then use the custom amount interface to input 875, beautiful. It will prioritise buy offers over sell offers so that if there isn't an empty slot available, or any items to collect, then it will cancel a sell offer, collect it and continue now it has a free slot. If there isn't a free slot available and we are trying to sell something it will return true, this is so that in my scripts it will remove the item from a toSell HashMap and put it back into the bank to sell later because it has bought the items it needs to continue botting. If it is instead trying to buy something and there are no empty slots or sell offers to cancel then it will wait for something to buy and continue once it can collect something and therefore has an empty slot. Update* It will now search for the item 1-3 words at a time checking the first 9 results each time and will choose the item as soon as it is visible as a human would. I might update this so that it randomises more, sometimes entering the whole first word of an items name straight away, because I sometimes do that, most of the time though I enter as few characters as I need to, I think, thoughts? Let me know what you think, the code is probably disgusting to look at for some of you but for others just starting out like me it could be a valuable learning tool, for how not to code All feedback and constructive criticism appreciated.
      Exchange Class
      GEInterfaces Class
      GEConditions Class
      InfoHelper Class
      Thank you to everyone that has read this far, it is appreciated
      Rewritten, if you have read again, even more appreciation!
    • By Fluffee
      Fluffee's Server Setup 2.0 [BETA]
      As some of you may know, I released an automated server setup script a little over a year ago. Albeit that script worked well, I was never fully satisfied with it, as I found it to be kind of messy to use. As a result, I rewrote the script, and restructured it, to add more, and stronger support for the different versions of Debian, the different versions of CentOS and the different versions of Ubuntu. However, with so many different Operating Systems being supported, and many different server providers having different setups, it's hard for me to test every possible scenario on my own. Which is why I've been privately handing this script out, and am now publicly looking for help.

      What does the script do?
      Similar to my previous setup script, this script changes the SSH port and creates a new user for connecting and using the server and disables root SSH connections; it installs the latest version of TightVNC Server (1.3.10) and sets that up with the desired port and password. It installs JDK 102 (32 or 64 bit depending on the OS), and installs TRiBot and OSBuddy and sets up the appropriate .jar file associations.
      What operating systems does it support?
      - CentOS (6.x and 7.x) (32 and 64 bit)
      - Debian (7.x and 8.x) (32 and 64 bit)
      - Ubuntu (12.x, 14.x and 16.x) (32 and 64 bit)
      Does it work?
      As far as I know, yes it does in fact work, and it works well if I might add. However, given that I can't test every possible setup, there is the potential for differences and issues, which is why I need help.
      I want to beta test, how can I help?
      The next time you setup a server, or if you just want to reinstall your old one, use this new script and let me know if you encounter any issues or things that you think are missing. Ideally, after you answer the questions the script prompts you for, you shouldn't have to touch the keyboard again. Therefore, if during installation the script prompts you for any kind of input that isn't the first few questions, please let me know as this is probably not supposed to happen. Also, if things don't work, like TRiBot doesn't open, there's no internet browser, LG won't hook, etc. make me aware of those issues as well, so I can try and fix them!
      I've found a bug, what do you need from me?
      A few things, I'll need the operating system and bit type and a description of the bug. I may ask you for SSH access to the server, as well as ask you to reinstall the server a few times, while I attempt to troubleshoot the issue. The issues may only arise on your server, so I might not be able to recreate the issue on my end, as my hosting provider may have a different server setup than your's. I've added in a bug report format below which would be the best way to report a bug, but simply shooting me a PM or messaging me on Skype also work, assuming you're willing to allow me to troubleshoot.
       
       
      How do I run the script?
      Login as root to a fresh VPS/dedi running one of the supported operating systems. From there run the commands listed below and follow the onscreen instructions. For those who would like to see the script's code, it can be found on my github here. The commands to run are as follows:
      wget --no-check-cert https://bitbucket.org/Fluffee/fluffees-server-setup/raw/master/fluffees-server-setup.sh && chmod +x fluffees-server-setup.sh && ./fluffees-server-setup.sh -v Version History
       
    • By RedClifford
      Hey guys first time posting on TriBot but I am really struggling to get it to run on my Mac. It wants to run but it always encounters the same error which is it says Exception in thread "AWT-EventQue-1"java.lang.unsatisfiedlinkerror:Cant load library: / Usersxxxxxxx/Library/application support/tribot/dependancies/libtogl.so . I know that anyone with minor knowledge of computers could fix this problem in seconds, but I don't have the slightest clue as to how to fix this. All i am trying to do is run TriBot with a private proxy for RS3. If anyone can help me resolve this issue comment on here or leave another way I can contact you I'd really appreciate it. Willing to pay $10 to anyone that can help me. Thank you. 

    • By Jooq
      Over the past couple of weeks I've been having clients "randomly" freezing after running out of Memory..
      Current set-up:
      Running 10 - 15 clients @ 356 MB. Only 1 account per client (no tabs). Not using Looking Glass. Running the same script on all accounts (Auto Fisher Pro) Operating system is Windows Server 2012 Using < 50% of CPU & RAM The freeze is seemingly random and usually only happens on 1 or 2 of the clients. Doesn't seem to be task based as it's happened in multiple scenarios. 

      Any ideas / suggestions on how to fix?
    • By jibpann
      Hello,
      So I found the Mac guide that works through most common errors and issues with the Mac install, but I'm still having issues. 
      Here are screenies of everything that was commonly asked for in the previous thread I read to work through this. 
      The 'you need Java...' message is what launches whenever I try to load Tribot
      Any help would be greatly appreciated!




    • By byouin
      Hi everyone,
      I am very new to TriBot, although fairly experienced in the botting world, and tried installing it for the first time today. However, on launching Tribot_Loader a white box with a red X in one corner opens, and on mouseover changes the pointer to a loading icon. Clicking the red X doesn't actually close the window and after a while an error pops up saying "Java Platform SE binary is not responding".
       
      I combed through the forums looking for solutions, and I tried uninstalling a reinstalling the correct Java version (JDK 8u131), re-downloaded the loader multiple times, and even used the "jarfix" recommended by the mods on some threads. Unsure of what to do now. 
    • By mollywhopped
      Hello I need help with something that is probably a simple solution. When I try to run Tribot loader the only java version that appears in the dropbox is version 6. I have downloaded version number 8, please help?
    • By MySmallBox
      I read the interface api and went through previous posts but still retarded lol. Anyway how do i right click on the interface and than click "make all pairs". I got my parent and child which are 154 and 93. Im trying to make leather gloves
      http://imgur.com/a/dyhKk
       
    • By magnificoman
      So I've been browsing around and haven't really been able to find a current solution. I'm trying to run LG on my MacBook pro.
      The Tribot client runs on 64 bit by default, and I'm not sure how to change it to 32 bit. I've been told that I should just be able to download the OSBuddy .jar file and play, because it's also 64 bit, but it still says:
      "client not found" and that I should try "running Tribot on 32 bit."
      Does anyone know how to run Tribot on 32 bit short of going into my CMD prompt and changing the default mode that my machine runs?
      Thanks
  • Our picks

    • This release will:

      Add LG support for Runelite


      Fix NPCChat issues


      Fix a bug where the camera angle setter would just hold down a key for 5 seconds (the timeout)


      Slightly adjust the rotation via keys to be more accurate


      Add the ability for asynchronous camera movement via keys


      Make Camera rotation via mouse more fluid, with more antiban, and work much better in resizable mode


      Add a "Camera#setCamera" method, allowing the rotation and angle to be set in parallel


      Increase the likelihood of using the mouse for camera movements


      Add support for adjusting the camera to positionable entities (Positionable#adjustCameraTo)



      Upcoming updates:

      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
      • 36 replies
    • This update will:

      Allow for clicking through the chat box when possible (Thanks @Todd)


      Fix Combat#selectIndex (Thanks @Encoded)


      Ensure worlds stay sorted and added a check to avoid misclicks in the in-game world hopper (Thanks @erickho123)


      Fix out-dated Options API interface indices (Thanks @Todd)



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
      • 12 replies
    • This release will:

      Fix login bot after today's game update (Thanks @JoeDezzy1)


      Fix latest in-game world hopping issues (Thanks @erickho123)


      Compact Settings UI and set location relative to TRiBot (Thanks @JoeDezzy1)


      Fix an older implementation of GrandExchange#getWindowState (Thanks @JoeDezzy1)


      Improve the preformance of NPCChat by only searching in certain interface parents (Thanks @JoeDezzy1)



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      LG support for RuneLite


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
      • 16 replies
    • This release will:

      Fix bytecode manipulation in order to prevent the modification of parameters within the Filter and Condition classes themselves (thanks @wastedbro)


      Fix NPE caused by non-null value in GE API (thanks @erickho123)


      Add and fix equals methods for api2007.types (thanks @JoeDezzy1)


      Modify Mouse#leaveGame to make the mouse leave the game from top, left, right, or bottom (thanks @erickho123)


      Add Entrana area to Ships API (thanks @erickho123)


      Fix raid prayers index/settings in Prayer API (thanks @erickho123)



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Like
      • 29 replies
    • This update will:

      Implement better canvas locking/synchronization mechanism


      Fix small Login API bug


      Remove the requirement for xbooting Java classes


      Use ExecutorService to perform canvas work in parallel


      Add "Account Management" game tab to GameTab API (thanks @Encoded)


      Fix NPCChat#getMessage (thanks @Encoded )


      Fix NPCChat#selectOption (thanks @Encoded )


      Fix Banking API after today's update (thanks @Encoded )


      Fix in-game world hopper after today's update (thanks @Encoded )



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
      • 38 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×