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.

Sign in to follow this  
Followers 0
thedark115

Attempting to work with an Interface

3 posts in this topic

Hi, so to begin with I am still new to scripting but I do have a bit of knowledge in Java. Right now i'm currently stuck on a small part where I am trying to identify an item within an interface, The interface ID is 300,2. The item i'm trying to interact with inside of this interface is labelled as 300,2,8 and the Item id  is 970.

This is within a shop, and I am trying to right click, buy 10 but I can't seem to make it work. I don't know what to do beyond this point, and i've spent hours watching tutorials but none cover the interaction with interface i'm trying to do. Also I have tried reading through source files of scripts interacting with shops, but cannot seem to grasp how an array is created and how to navigate through the array and interact within the set bounds of the array created.

My current lack of knowledge: Create an array inside of an interface, interact with an item inside the bounds I set inside of the array created. 

I don't know if TriBot handles interfaces like these in a simpler manner in the API, but I have definitely sought out other ways for this and have always come up empty handed.

 

I understand that at this point most people pay money for private teaching, but i've currently spent all of my money on my car to be fixed so I am going to you guys. Anyone willing to lend a hand? A clean explanation of how this works is all I ask, I'm not looking for anyone to do my code for me. If you can explain how the array is set up and works, and how to create bounds inside of the array that would be great. I can currently see the bounds of the item in the shop myself when I select the item in an interface explorer, but have no clue how to manually create the bounds within the script. Also should I change the shop to a banking interface in case the item runs out of stock? 

 

Current state of code after dumping and restarting from nothing:

	private boolean buyPapyrus() {
		RSInterfaceChild papyrus = Interfaces.get(300,2);
		if(papyrus != null && !papyrus.isHidden() && !Inventory.isFull() && hasPapyrus()){
			
		}
		return false;
	}
	
	private boolean hasPapyrus() {
		RSItem[] items = Interfaces.get(300, 2).getItems();
		for (int i = 0; i < items.length; i++)
			if (items[i].getID() == 970) {
				return true;
			}
		return false;
	}

I will implement a loop for buying the items that will be non-repetetive and include ABCL2. This script is in development and is planned to be released publicly.

Share this post


Link to post
Share on other sites

Shop items are stored as RSInterfaceComponent objects. You should call .getChildren() on the interface (300,2) to get the components of the shop as an array, and each component stores information such as item ID, name, stack, etc.

1 person likes this

Share this post


Link to post
Share on other sites
On 7/10/2016 at 6:38 PM, FALSkills said:

Shop items are stored as RSInterfaceComponent objects. You should call .getChildren() on the interface (300,2) to get the components of the shop as an array, and each component stores information such as item ID, name, stack, etc.

You're awesome, thank you!

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.