Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • How to create custom listeners


    Neffarion

    Recommended Posts

    On 24/01/2021 at 5:49 PM, jex124 said:
    3 hours ago, Neffarion said:

    Yes

    You should try to do it as I did in the example in the main post, that way you can do only scan -> compare -> sleep (the first time it runs it won't trigger anything but that isn't really relevant as it is runs often, and you are probably not needing it at that point so early)

    For your problem I wouldn't personally use a listener as you can just save the npc when you attack and check for movement while you wait for it to kill it

     

    Thank you @Neffarion, following your recommentations I got it working, use of wrapper meant my thread sleep is at the correct place, I get a clean set of data to use in my main script.

    Although in your example I am not sure why you @override equal method, I guess it is to add a few more boolean equality checks?

     

    I learned a lot from your tutorial, gracias! 

     

    Link to comment
    Share on other sites

    6 minutes ago, jex124 said:

    Thank you @Neffarion, following your recommentations I got it working, use of wrapper meant my thread sleep is at the correct place, I get a clean set of data to use in my main script.

    Although in your example I am not sure why you @override equal method, I guess it is to add a few more boolean equality checks?

     

    I learned a lot from your tutorial, gracias! 

     

    Your welcome
    Yes, its cleaner and simply moves some of that "irrelevant" code from the event listener logic to the wrapper

    Link to comment
    Share on other sites

    • 4 months later...

    I copied this entire script without changes except for 

    private boolean canVerify() {
            return Client.isLoggedIn() && new RandomManager(new Thread(), new Script()).isSolving()

    Which I don't think changes anything anyway, but I'm not getting the message when buying an item from the GE.

    I tried checking if it's reaching the code that is supposed to check for changes

    while (!shouldStop() && canRun()) {
                MethodProvider.log("Here");
                if (canVerify()) {
                    MethodProvider.log("Reached");
                    current = fetchItems();

    And it's not reaching it

     

    My code other than the first snippet which I had to change because of the API changes is the exact same as yours, any ideas?

    Link to comment
    Share on other sites

    1 hour ago, Kristoffer said:

    I copied this entire script without changes except for 

    
    private boolean canVerify() {
            return Client.isLoggedIn() && new RandomManager(new Thread(), new Script()).isSolving()

    Which I don't think changes anything anyway, but I'm not getting the message when buying an item from the GE.

    I tried checking if it's reaching the code that is supposed to check for changes

    
    while (!shouldStop() && canRun()) {
                MethodProvider.log("Here");
                if (canVerify()) {
                    MethodProvider.log("Reached");
                    current = fetchItems();

    And it's not reaching it

     

    My code other than the first snippet which I had to change because of the API changes is the exact same as yours, any ideas?


    What's with this? Whats it for

    new RandomManager(new Thread(), new Script()).isSolving()

     

    Link to comment
    Share on other sites

    It's from the canVerify method

    private boolean canVerify() {
            return script.getClient().isLoggedIn() && !script.getRandomManager().isSolving()
                    && script.getLocalPlayer() != null && script.getLocalPlayer().exists();
    }

    I changed it because it's still using non-static methods. I'm not sure if it's relevant, I mainly mentioned it because that's the only thing I changed from your code.

    Link to comment
    Share on other sites

    I'm probably doing something wrong there but again it doesn't matter because 

    while (!shouldStop() && canRun()) {
            MethodProvider.log("Here");

    also doesn't run which is the same as your code.

    Link to comment
    Share on other sites

    50 minutes ago, Kristoffer said:

    It's from the canVerify method

    
    private boolean canVerify() {
            return script.getClient().isLoggedIn() && !script.getRandomManager().isSolving()
                    && script.getLocalPlayer() != null && script.getLocalPlayer().exists();
    }

    I changed it because it's still using non-static methods. I'm not sure if it's relevant, I mainly mentioned it because that's the only thing I changed from your code.

     

    47 minutes ago, Kristoffer said:

    I'm probably doing something wrong there but again it doesn't matter because 

    
    while (!shouldStop() && canRun()) {
            MethodProvider.log("Here");

    also doesn't run which is the same as your code.

    Ah yes, this was made before DB3. I have updated the code (and git), also made few slight changes. It works fine now

    Link to comment
    Share on other sites

    You're right, I copy pasted your code and it works. I then used a diff tool to check for differences with mine and found no significant differences, yet mine still doesn't work. I guess it will remain a mystery for now. 

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.