Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Question Interfaces

Joined
Oct 17, 2015
Messages
11
I'm attempting my first go at a bot(Flax Spinner), but I'm having a little trouble. I've managed to make it open the crafting interface, but I can't for the life of me find out how to make it hit "Spin" in the interface. I've found the correct interface (1371) in the developer kit. I just need to make it click "Spin." I've attached a picture below and I may also need help a little later if I failed on my movement setup. Hopefully not, lol.. Thanks in advance!

D5KISKw.png
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
Code:
final InterfaceComponent spinInterface = Interfaces.newQuery().containers(1371).texts("Spin").results().first();
if (spinInterface != null) {
  spinInterface.click(); //interact() if you know the action
}
 
Joined
Jun 7, 2015
Messages
100
If you'd want to make it a bit easier, you could try "Alpha Interface Viewer", same thing as the Interface kit that you seem to be using. But since you are need to click a component on the interface, you would need to define it.
After you've defined it as whatever you want, it is simply:

Code:
if (component != null) { 
component.click();
}
 
Primate
Joined
Oct 30, 2014
Messages
3,475
Code:
final InterfaceComponent spinInterface = Interfaces.newQuery().containers(1371).texts("Spin").results().first();
if (spinInterface != null) {
  spinInterface.click(); //interact() if you know the action
}
Won't work... The interface doesn't have a text.

Try looking for "Spin" in the search bar, it will help you find the correct interface component.
 
Joined
Oct 17, 2015
Messages
11
Thanks y'all!

Won't work... The interface doesn't have a text.

Try looking for "Spin" in the search bar, it will help you find the correct interface component.

I looked for spin, and in interface 1370, it has component 40 with 5 sub-components. I'm pretty sure the 5 sub's are each of the 5 items that can be used on the wheel. (1370, 40, 1) would be the second one in the interface which would be bowstrings. How would I implement that inside Savior's code though?

final InterfaceComponent spinInterface = Interfaces.newQuery().containers(1371).texts("Spin").results().first();
if (spinInterface != null) {
spinInterface.interact("Make 28 Bowstring");
}

EDIT: Here's the component contents:

Index: 1
Visible: true
Components: 0
Bounds: (x=975, y=562, width=240, height=42)
Text: Spin
Text Color: (r=39, g=34, b=15)
Content Type: 0
Projected Entity: null
Border Thickness: 0
Texture Id: -1
Name (on menu): null
Actions:
 
I've made it click by changing the interface to (1370, 40, 1) and using .click(). I just have to make it wait until it's finished lol. It's clicking the wheel right after it starts. xD I think I can fix that though.
 
Primate
Joined
Oct 30, 2014
Messages
3,475
final InterfaceComponent spinInterface = Interfaces.newQuery().texts("Spin").visible().results().first();

Don't try to interact with it, it has no actions, use click like you mentioned.
 
Using IDs is discouraged, because they can be changed by Jagex fairly easily without having it impact the game.
 
Joined
Oct 17, 2015
Messages
11
I don't understand why this isn't working :/. It continues to click the wheel after it's started. This is my code:

Code:
private boolean isIdle() {
return player.getAnimationId() == -1 && !player.isMoving();
}
@Override
public void onLoop() {
GameObject spinningwheel = GameObjects.getLoaded(36970).nearestTo(player);
if (Inventory.contains("Flax") && spinArea.contains(player) && isIdle()) {
spinningwheel.interact("Spin");
final InterfaceComponent spinInterface = Interfaces.newQuery().containers(1370, 40, 1).texts("Spin").results().first();
if (spinInterface != null) {
spinInterface.click();
}
 
Ahh, didn't think of that.. I'll do away with using id's then! Thanks!
 
I did away with all the ID's I was using and also added an execution delay, that part works. Sadly enough, moving between the two floors doesn't, but I'm going to try to figure this out. Thanks for your help thus far!
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
Won't work... The interface doesn't have a text.

Try looking for "Spin" in the search bar, it will help you find the correct interface component.
Just wrote that as an example to generally find interfaces
 
Joined
Oct 17, 2015
Messages
11
Okay, my baby is crying so I have to feed her and stuff. I'll be back later! I'm having movement issues still though. I know I probably have this set up wrong, but here's my code:

Code:
private final static Area spinArea = new Area.Rectangular(new Coordinate(3212, 3212, 1), new Coordinate(3208, 3216, 1));

} else if (Inventory.contains("Flax") && !spinArea.contains(player)) {
final WebPath spinPath = Traversal.getDefaultWeb().getPathBuilder().buildTo(spinArea.getRandomCoordinate());
final BresenhamPath failspinPath = BresenhamPath.buildTo(spinArea.getRandomCoordinate());
if (spinPath != null) {
spinPath.step();
} else if (failspinPath != null) {
failspinPath.step();
}

I'm attempting to go back and forth between the 3rd story of lumbridge castle and the second. What am I doing wrong? Does it not build the path over multiple stories?
 
Primate
Joined
Oct 30, 2014
Messages
3,475
Okay, my baby is crying so I have to feed her and stuff. I'll be back later! I'm having movement issues still though. I know I probably have this set up wrong, but here's my code:

Code:
private final static Area spinArea = new Area.Rectangular(new Coordinate(3212, 3212, 1), new Coordinate(3208, 3216, 1));

} else if (Inventory.contains("Flax") && !spinArea.contains(player)) {
final WebPath spinPath = Traversal.getDefaultWeb().getPathBuilder().buildTo(spinArea.getRandomCoordinate());
final BresenhamPath failspinPath = BresenhamPath.buildTo(spinArea.getRandomCoordinate());
if (spinPath != null) {
spinPath.step();
} else if (failspinPath != null) {
failspinPath.step();
}

I'm attempting to go back and forth between the 3rd story of lumbridge castle and the second. What am I doing wrong? Does it not build the path over multiple stories?
Lumbridge castle is not included in the default web.
 
Joined
Oct 24, 2015
Messages
82
If you still not got it worked then do this:

Code:
private static boolean spin() {
        if (isProductScreenOpen()) {
            Execution.delay(200, 700);
            Keyboard.typeKey(" ");
            return Execution.delayUntil(() -> !isProductScreenOpen(), 5000);
        }
        return false;
    }

Then just put something in that checks if the screen is open then add the spin() in or something!
 
Joined
Jun 7, 2015
Messages
100
Under your spinInterface.click(); ->

Code:
spinInterface.click();
Execution.delayUntil(()-> !Inventory.containsAnyOf("Flax");
 
Joined
Oct 17, 2015
Messages
11
Finally got baby settled. Since web walking doesn't work in Lumbridge castle, any recommendations on how I should get the bot to between the 2nd and 3rd floor?
 
Also, I'm just going to use: Execution.delay(50000, 50500);. It gives it an extra 2 to 2 1/2 seconds after the flax is done. Takes 48 seconds for a full inventory.
 
Primate
Joined
Oct 30, 2014
Messages
3,475
Finally got baby settled. Since web walking doesn't work in Lumbridge castle, any recommendations on how I should get the bot to between the 2nd and 3rd floor?
 
Also, I'm just going to use: Execution.delay(50000, 50500);. It gives it an extra 2 to 2 1/2 seconds after the flax is done. Takes 48 seconds for a full inventory.
I recommend using something like this:

Code:
final Player local = Players.getLocal();
Execution.delayUntil(() -> !Inventory.contains("Flax"), () -> local != null && local.getAnimationId() != -1, 3000);
 
Joined
Oct 1, 2015
Messages
39
I recommend using something like this:

Code:
final Player local = Players.getLocal();
Execution.delayUntil(() -> !Inventory.contains("Flax"), () -> local != null && local.getAnimationId() != -1, 3000);

Does the 3000 vary the delay by 3 seconds?
 
Joined
Oct 17, 2015
Messages
11
Well, it's running. I'm still cleaning up some bugs in it. It somehow managed to get to the ground level and freaked out and stood there frozen lol. Fixed that. It's on 5 runs thus far with no issues though! Thanks everyone for y'alls help! :)
 
Top