Jump to content

Getting very strange results from interfaces


aikewoody

Recommended Posts

I have this very simple code:

 

client.getInterface(307).getChild(2).interact("Cook All");

sleep(random(200,500));

 

It works when I have Interface enabled in my Settings->Advanced, see picture:

 

But does NOT work when it is not enabled, which I find very strange.

Can anyone help me with this?

 

The interface for interacting with the cooking option is actually the following:

Parent: 307
Child: 6

Update your ID's and it should work smoothly ^_^

Edited by Divinity
Link to comment
Share on other sites

I think I found the problem, made this while loop for testing stuff about interfaces:

boolean t = true;

 

while (t) {

    sleep(1000);

    ~stuff~

    if (client.getInterface(307) != null) {

        client.getInterface(307).getChild(3).interact("Cook All");

    }

    ~stuff~

}

 

I guess that when the onLoop() method isn't completed, information about the client won't get updated.

Still doesn't explain why it did work when I had Interfaces enabled at debugging.

Edited by aikewoody
Link to comment
Share on other sites

I think I found the problem, made this while loop for testing stuff about interfaces:

boolean t = true;

 

while (t) {

    sleep(1000);

    ~stuff~

    if (client.getInterface(307) != null) {

        client.getInterface(307).getChild(3).interact("Cook All");

    }

    ~stuff~

}

 

I guess that when the onLoop() method isn't completed, information about the client won't get updated.

Still doesn't explain why it did work when I had Interfaces enabled at debugging.

 

Use the hover debug in future, much more accurate for the simple things you're trying to do!

 

Edited by Divinity
Link to comment
Share on other sites

The interface for interacting with the cooking option is actually the following:

Parent: 307
Child: 6

Update your ID's and it should work smoothly happy.png

 

 

Thanks for your reply, looking at this debugger I thought it would be 3:

 

28a7o9k.png

 

 

 

I still can't get my head around the fact that my test while loop only worked when I selected Interfaces in the debug settings...

Link to comment
Share on other sites

Thanks for your reply, looking at this debugger I thought it would be 3:

 

 

I still can't get my head around the fact that my test while loop only worked when I selected Interfaces in the debug settings...

 

 

Edit: Another thing you will notice, 307 is the interface ID for the chatbox, you're checking if its not null which is always, you never check however if the interface your trying to interact with is visible.

if(client.getInterface(307).getChild(6).isVisible()){
//interact with it
}

Do the above and you will find it works.

 

Edited by Divinity
Link to comment
Share on other sites

Just like to point out that your observation about not updating client information while onLoop is executing is correct. The reason it works when you turn of Interfaces debugging is because turning that on spawns a new thread which will update the client information even while onLoop is running. Once you turn that debug off, however, the updates stop until onLoop finishes.

Link to comment
Share on other sites

Just like to point out that your observation about not updating client information while onLoop is executing is correct. The reason it works when you turn of Interfaces debugging is because turning that on spawns a new thread which will update the client information even while onLoop is running. Once you turn that debug off, however, the updates stop until onLoop finishes.

 

WOW that's just what i needed to hear, thanks!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...