Jump to content

Low CPU Mode


The Undefeated

Recommended Posts

1 hour ago, The Undefeated said:

That's actually Task-based, not States right?

I made my own ghetto buy Method for temp use, is not that hard to do.

 

:gnome:

 

 Script is working so gonna take my time to clean up all. Maybe I'll switch to Task-based instead of States. 

 

task/state you can call it whatever you want I guess. A simple way to do it is have an enum of states and switch between them, although this results in two potentially large blocks of code which is not ideal. You can split these states into classes if you really wish, and have condition/execute methods but that's really just another way to achieve the same thing. How you structure a script really depends on the function you require, whether it's AIO etc..., there's no one way of doing it really. Getting the structure right is the hardest part to get a good balance of code readability and flexibility. It's definately worth trying to get right at the start! :)

apa

Link to comment
Share on other sites

4 minutes ago, Final said:

That's because that API method is more of a 'helper method', it's a method containing specific logic for a specific task, that method more than likely has overlooked logic. In addition, it's not going to be repeatedly checked by looping through the same conditions because you only call it once and that'd just add more complexity to the method itself. Chances are it relies upon each action actually occurring such as successfully opening the Grand Exchange or not.

You should design your logic in such a way that if something was to fail, it wouldn't matter since it'd just attempt this task again without it conflicting with future tasks which rely on it's success.

Obviously low-cpu means clicking methods are likely to fail, because destinations are dynamically changing in real-time, let's say you are running and your target NPC is moving, you are going to have a hard time interacting with it because the screen location of that NPC is constantly changing. Some methods such as this rely on Runescape visually, as opposed to a stored value within Runescape.

I understand what you mean but you can't prevent the bot getting stuck in a method of the API can you?

 

Link to comment
Share on other sites

1 hour ago, The Undefeated said:

I understand what you mean but you can't prevent the bot getting stuck in a method of the API can you?

If it was getting into an infinite loop in the method, then the API method is incorrectly written, the issue you are facing is improperly using the API method and therefore the script becomes 'stuck' in it's own logic.

You can't expect all methods to be wrote with consideration that an event that should take 2 seconds to happen max has somehow taken 5 because of your ping/hardware limitations.

Edited by Final
Link to comment
Share on other sites

13 minutes ago, Apaec said:

task/state you can call it whatever you want I guess. A simple way to do it is have an enum of states and switch between them, although this results in two potentially large blocks of code which is not ideal. You can split these states into classes if you really wish, and have condition/execute methods but that's really just another way to achieve the same thing. How you structure a script really depends on the function you require, whether it's AIO etc..., there's no one way of doing it really. Getting the structure right is the hardest part to get a good balance of code readability and flexibility. It's definately worth trying to get right at the start! :)

apa

I already use enum states in multiple classes, but my Main class is still 350 lines long which I could improve.

8 minutes ago, Final said:

If it was getting into an infinite loop in the method, then the API method is incorrectly written, the issue you are facing is improperly using the API method and therefore the script becomes 'stuck' in it's own logic.

You can't expect all methods to be wrote with consideration that an event that should take 2 seconds to happen max has somehow taken 5 because of your ping/hardware limitations.

It gets stuck in a loop typing the name of the item it wants to buy. It thinks it didn't type because no items appear in the box (It should actually wait a bit longer) and starts typing again.

 

Link to comment
Share on other sites

32 minutes ago, Final said:

That's because that API method is more of a 'helper method', it's a method containing specific logic for a specific task, that method more than likely has overlooked logic. In addition, it's not going to be repeatedly checked by looping through the same conditions because you only call it once and that'd just add more complexity to the method itself. Chances are it relies upon each action actually occurring such as successfully opening the Grand Exchange or not.

You should design your logic in such a way that if something was to fail, it wouldn't matter since it'd just attempt this task again without it conflicting with future tasks which rely on it's success.

Obviously low-cpu means clicking methods are likely to fail, because destinations are dynamically changing in real-time, let's say you are running and your target NPC is moving, you are going to have a hard time interacting with it because the screen location of that NPC is constantly changing. Some methods such as this rely on Runescape visually, as opposed to a stored value within Runescape.

Yeah alright, that's true and I do try to design my logic in such ways .. but I was hoping I could still use some api methods :'D I mean it doesn't do too much and if it fails it's still quite easy to manage that. But I suppose that there's indeed something overlooked...will just wait until that thread gets updated for now :p

Edited by Reveance
Link to comment
Share on other sites

1 hour ago, Reveance said:

Yeah alright, that's true and I do try to design my logic in such ways .. but I was hoping I could still use some api methods :'D I mean it doesn't do too much and if it fails it's still quite easy to manage that. But I suppose that there's indeed something overlooked...will just wait until that thread gets updated for now :p

Yea sometimes a lot of the API is made for lazy people, if you want things to work the way you want them to (e.g work lmao) then you may have to do somethings on your own. After all, one man can only do so much.

  • Like 1
Link to comment
Share on other sites

9 hours ago, The Undefeated said:

This is my open bank method.


    public void openBank() throws InterruptedException {
        NPC banker = getNpcs().closest("Banker");
        if(!bank.isOpen()) {
            if (banker != null && banker.isVisible()) {
                banker.interact("Bank");
            } else {
                getBank().open();
            }
            Timing.waitCondition(() -> bank.isOpen(),6000);
            sleep(random(300,600));
        }
    }

 

 

How do we know your custom methods aren't working? Timing.waitCondition? That doesn't look like an OSBot API class. 

Link to comment
Share on other sites

If its closing the bank while it's open, most likely you are calling bank booth.interact while the bank is open. Bad scripting. Nothing to do with low cpu mode. You need to check if the bank is open before you click, not before you move the mouse to click. 

Edited by dmmslaver
Link to comment
Share on other sites

7 hours ago, Alek said:

 

How do we know your custom methods aren't working? Timing.waitCondition? That doesn't look like an OSBot API class. 

 

Makes it much easier and it does the same thing. I will improve mine to open the bank again if it isn't open in the next loop. I thought it had something to do with the buyItem bug on low CPU mode. 

6 hours ago, Juggles said:

Use conditional sleeps to fix your problem. 

I do. 

6 hours ago, dmmslaver said:

If its closing the bank while it's open, most likely you are calling bank booth.interact while the bank is open. Bad scripting. Nothing to do with low cpu mode. You need to check if the bank is open before you click, not before you move the mouse to click. 

It happened only when using low CPU mode actually. Maybe because it takes longer to check certain methods, I have no idea. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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