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
  • mcleod63

    Members
    • Posts

      14
    • Joined

    • Last visited

    Recent Profile Visitors

    The recent visitors block is disabled and is not being shown to other users.

    mcleod63's Achievements

    1. Don't close bank, before running script. It must be open. If you close the bank, you have to use Bank.getBankHistoryCache()
    2. Is there a reason that my logs have many, many entries like below? Something I did or is it the new normal?
    3. It's doing the same thing again today. Instead of my bot walking to the combat area (or anywhere), it just stands there. When I check the log, it's riddled with entries similar to my last post. I can't find any similar comments from others, so I'm assuming there's something I messed up in my script. Please please please - any help to get me back up and running would be greatly appreciated.
    4. My AIO script has been running well for the last month, but not today. For some reason, I find my character doesn't walk any more, and I see the following entries being repeated in the logs. Any idea how I fix this?
    5. Wow! Excellent detective work by 420x69x420 to track this down. I recently changed from using Players.getLocal() to using hero (I placed public static Player hero = Players.getLocal() at the top of my script). Sure enough, I found the bot walking aimlessly inside Edgeville bank, and the log showed that it started immediately after returning from a short break and had been doing it for 30 minutes before I saw it. I'm keeping my fingers crossed that jagex won't see it. No more nicknames for my bot - it will always be Players.getLocal() in future.
    6. Thanks hashbang. I tried that but Players.getLocal() isn't null, so I repeatedly got NPEs by executing the Players.getLocal().getLevel() line inside the loop. I imagine jagex will pick up on this quickly and ban me, if I can't solve my problem soon. I also tried a loop with Client.isLoggedIn but found that I was always logged in, so passed by the while loop, and still got the NPEs when I tried to set the combat level. int count = 0; while (!Client.isLoggedIn()) { sleep(10000); count++; if (count >= 12) stop(); } Does anyone have any other ideas I can try? I've exhausted my small bit of DB3 knowledge, and tried to find answers in both the forum and Javadocs but failed.
    7. Can someone explain why I can't get Players.getLocal().getLevel(); to work in onStart(). It immediately throws an NPE error. I wrote a simple script, with lots of logs, to confirm it's not my node system: import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.container.impl.bank.Bank; import org.dreambot.api.methods.interactive.Players; import org.dreambot.api.methods.tabs.Tab; import org.dreambot.api.methods.tabs.Tabs; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManager; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.utilities.Sleep; @ScriptManifest(description = "Testing why combat level causing errors.", name = "TestDB", version = 1.0, author = "NAD", category = Category.MISC) public class Main extends AbstractScript { public static int combatLevel = 0; @Override public void onStart() { log("--- Script has started ---"); //combatLevel = Players.getLocal().getLevel(); // <--- throws errors log("#1 combat level: " + combatLevel); // was set to 0 when declared if (Players.getLocal() != null) { combatLevel = Players.getLocal().getLevel(); log("#2 combat level is now " + combatLevel); } else { log("#2 getLocal() is null, combat level is " + combatLevel); } if (combatLevel == 0) { // it shouldn't be but just checking combatLevel = 1; // must assign a value else crashes later in Fighter program log("#3 should never get here,combat level is " + combatLevel); } else { log("#3 combat level should have the correct value: " + combatLevel); } } @Override public int onLoop() { // A simple code to walk to the bank. if (Bank.open()) { log("Arrived at the bank."); if (!Tabs.isOpen(Tab.INVENTORY)) { if (Tabs.openWithMouse(Tab.INVENTORY)) { Sleep.sleepUntil(() -> Tabs.isOpen(Tab.INVENTORY), 3000); } } if (!Inventory.isEmpty()) { Bank.depositAllItems(); Sleep.sleepUntil(Inventory::isEmpty, 3000); } Sleep.sleep(250, 350); ScriptManager.getScriptManager().stop(); sleep(3000); // need a few seconds for stop() to kick in } else { log("Walking to the bank."); sleep(2500, 3500); } return Calculations.random(350, 500); } } And here's the error: The NPE occurs at line 31 in onStart, where I do a null check and then try to set the combatLevel variable ?? I'm confused. Players.getLocal() is not null, and getLevel() is an int, so where is the null pointer exception coming from? More importantly, how do I fix it? Can it be that onStart runs before the client is fully up to speed? I did try insertiing a 2 minute sleep before setting the combat level, but that didn't fix it. Any assistance would be greatly appreciated.
    8. I'm slowly working on a method to handle random events and this is a great help. Thank you for the contribution.
    9. Just a quick update. This one solved my issue. Thanks again for the helpful responses! Player player = Players.getLocal(); if (player != null) { g.drawString("Combat Level: " + player.getLevel(), 10, 90); }
    10. Oh no, I fell for the 'failed to do a null check"' thing. Thank you both for the responses. Must remember null checks. Must remember null checks. Must remember null checks.
    11. Hi, can anyone help me understand why my Paint is throwing errors? The error appears to be caused by Players.getLocal().getLevel() throwing errors until the login handler has finished. I say this because the logs show login handler starting, and then repetitive errors pointing to my codeline 143, and the errors stop as soon as the log shows that the login handler finished. I can show the log entries if that will help. This is line 143 in my code: g.drawString("Combat skill level: " + Players.getLocal().getLevel(), 10, 135); I recently returned to botting after taking a 1-2 year break, so I had to update my scripts for the deprecated items since I last played. That included changing getLocalPlayer().getLevel() to Players.getLocal().getLevel() but I don't see how that is the problem. Any help would be appreciated.
    ×
    ×
    • 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.