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.

TheHippy

Cook All Food Option?

6 posts in this topic

Hello I've just signed up today and I've been doing very well creating my own custom script to fish and cook at the same time. However now that i'm at a point where i need to select the "cook all" chatbox option i'm stumped on how to do this. I've looked at the 'Interface' and 'ChooseOption' sections of the API to no avail (i'm pretty sure i have to use Interface tho).

My current feeble attempt is as follows-> RSInterface child = Interfaces.get(137,1);  child.click(); .Okay so a couple of things, in the client nowhere in the debugging menu do i see anything to do with interfaces and their indexes, the only thing i found was at 'org.tribot.api2007.Constants.IDs.Interfaces' with chatbox having a value of 137 (are these the indexes?). i'm also unsure about the whole Master->Child->component stuff (ex: are components the select options themselves? then the master would be the chatbox interface and child would be the option container holder?).

If anyone could help and show me a short example of how to select a chatbox interface then select "cook all" , i'm sure i would finally get a hold on this and be able to further apply this knowledge :) Thanks in advance!

Share this post


Link to post
Share on other sites

Thanks Crimson, i got jj's version up and running and its quite nice.

1 last thing, can someone post a short snippet of how to properly access a child component? i feel like i got it half right in my first post. (is it RSInterface child = Interfaces.get(master,child).getChild(component);? its too late for me to test it right now heh)

Share this post


Link to post
Share on other sites
1 hour ago, TheHippy said:

(is it RSInterface child = Interfaces.get(master,child).getChild(component);?

Interfaces.get can return null. You don't want to call getChild on a null object because that will throw a null pointer exception (NPE) and immediately stop your script.
Use a variable to get the object returned by Interfaces.get(master,child) and null check it before attempting to get its component.
     

1 person likes this

Share this post


Link to post
Share on other sites

1. Grab the interface child like you're currently doing
2. Check if child != null
3. Call child.click() to interact with the interface

It's that simple. If it isnt clicking the interface, then you probably have the wrong ids.

Edited by Flamo353
1 person likes this

Share this post


Link to post
Share on other sites

Thanks Beg n Flamo, i was able to finally get it to work. It seemed that i also had to put a filter in child.click(); to get it to work (i put "Cook All")

1 person likes this

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.