Jump to content

Code not listening to meh.


Isolate

Recommended Posts

ok so 

i

  if (x != null && !myPlayer().isMoving()) {
                            log("Walking to x!");
                            map.walk(x);
                            sleep(random(250, 350));
                    }

clicks once whilst idol then the moment i start moving spams the hell out of the mini map biggrin.png

and also 

if (!myPlayer().isAnimating()) {
    //Do something that causes it to animate
    //sleep
}

keeps spamming on doing the 

//Do something that causes it to animate

//no sleep

during animation.

 

this is all in main loop.

 

 

Edited by Isolate
Link to comment
Share on other sites

That weird biggrin.png

 

Are you using latest version of osbot to start with?

Mind putting the whole class in here?

 

Khaleesi

Found the problem anyways.

Its just in the walking method itself, it appears to not return or move on until it reaches its destination.

so once started it does go back to the top check it just loops the step method inside that method :/.

Fixed it by alter a custom walking method to what i needed :D

 

and naa I'd prefer people not to rip apart my code only based on the fact i might not follow conventions :P

 

  • Like 1
Link to comment
Share on other sites

Found the problem anyways.

Its just in the walking method itself, it appears to not return or move on until it reaches its destination.

so once started it does go back to the top check it just loops the step method inside that method :/.

Fixed it by alter a custom walking method to what i needed biggrin.png

 

and naa I'd prefer people not to rip apart my code only based on the fact i might not follow conventions tongue.png

 

 

Its always good to follow conventions and let people give you tips and feedback on how your code is structured. Use scripting as a learning curve (trust me it can be a huge one if you let it) not only as something to just do your work for you in RS.

  • Like 1
Link to comment
Share on other sites

Of course the first one spam clicks. You are telling your script to walk to x no matter what. If you added a check in there saying to only walk to x if your not already at x, then it would work. As for the second one, I'm guessing it's something with the code in the statement. Since you never post your code we can't help. ^_^

Link to comment
Share on other sites

Its always good to follow conventions and let people give you tips and feedback on how your code is structured. Use scripting as a learning curve (trust me it can be a huge one if you let it) not only as something to just do your work for you in RS.

I use conventions in class and sometimes i brush over a script and put them all in place i need to post but if everything runs well

i wont bother, its just another thing to take up time.

 

Of course the first one spam clicks. You are telling your script to walk to x no matter what. If you added a check in there saying to only walk to x if your not already at x, then it would work. As for the second one, I'm guessing it's something with the code in the statement. Since you never post your code we can't help. happy.png

as stated the problem has been found.

yes in my code there are other checks around the bit i posted 

but the whole time the walk method starts walking to the point

it spams the spot, when it gets there the script continues as should

its just that the osbot api has no check for if moving in its walking function that seems to be in play causing any check i do for walking to be nulled

Link to comment
Share on other sites

I use conventions in class and sometimes i brush over a script and put them all in place i need to post but if everything runs well

i wont bother, its just another thing to take up time.

as stated the problem has been found.

yes in my code there are other checks around the bit i posted

but the whole time the walk method starts walking to the point

it spams the spot, when it gets there the script continues as should

its just that the osbot api has no check for if moving in its walking function that seems to be in play causing any check i do for walking to be nulled

You can add a check. There is a method to get your current minimap destination. For example, only click the next tile of you are < 4 tiles from the current destination. I made my own walker and used something like this in it.

Link to comment
Share on other sites

You can add a check. There is a method to get your current minimap destination. For example, only click the next tile of you are < 4 tiles from the current destination. I made my own walker and used something like this in it.

 

 

Found the problem anyways.

Its just in the walking method itself, it appears to not return or move on until it reaches its destination.

so once started it does go back to the top check it just loops the step method inside that method :/.

Fixed it by alter a custom walking method to what i needed biggrin.png

 

 

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...