Bug Restart bot during runtime

Discussion in 'Developer Support' started by torque0, Nov 4, 2015.

  1. So theres a bug that occurs with my bot, i've tried everything to debug it but to no avail. It will just freeze, in the Area "landing". It won't print the message when it's stuck, and it will walk through this location multiple times before freezing. more info: it turns out, it happens ONLY after moving to a new region. only my timer continues to count everything else is frozen.
    The one way i can fix this bug, is to restart the bot entirely. So the question is, how can I restart the bot automatically during run time?

    If not, maybe someone can highlight something in the code below (i know it looks hacky as fuck but thats not the question! :) )

    EDIT: Realized something NEW

    turns out , every time this "stall" occurs and i stop and start the script bot, i get this printed in the console:

    Code (Text):
    1. Nov 05, 2015 7:58:27 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
    2. INFO: Could not find stylesheet: file:/C:/Users/Mohsin/RuneMate/temp/SetupDialog.css
    i feel like somehow this will be linked.

    This is the problem code:

    Code (Text):
    2. if (landing.contains(Players.getLocal())) {
    3. if (ChatDialog.getContinue() != null)
    4. ChatDialog.getContinue().select();
    5. System.out.println("I GET STUCK HERE");
    6. // Camera.turnTo(245, 0.485);
    7. if (walkToR(dest1)) {
    8. Execution.delay(200,500);
    9. }
    10. }
    Then I use this to walk:

    Code (Text):
    2. public boolean walkToR(Area a) {
    3. final Coordinate walk2 = a.getRandomCoordinate();
    4. final RegionPath walking2 = RegionPath.buildTo(walk2);
    5. if (!Players.getLocal().isMoving()) {
    6. if (walking2 != null)
    7. walking2.step(true);
    8. }
    9. return true;
    10. }
    #1 torque0, Nov 4, 2015
    Last edited: Nov 5, 2015
  2. Best Answer:
    Post #2 by Arbiter, Nov 4, 2015
  3. No it is not possible to do what you are asking. Undesired bot behavior. Start and stop are exclusively end-user controls.
    --- Double Post Merged, Nov 4, 2015, Original Post Date: Nov 4, 2015 ---
    Region paths should only be used if you're in the region. If you step out of the loaded region it will no longer work. Region paths use the currently loaded region to generate an optimal path. If the destination is not in the region it cannot do so.

    Solution: When RegionPath returns null use a different pathfinding algorithm.
    WYD likes this.
  4. I forgot to mention i've tried a webpath, and the Bresenham Path. Remember, the regionpath works most of the time, but the bot itself will stall randomly and won't even detect itself INSIDE of the area i've specified. And the regionpath is only used to walk across the currently loaded region. E.G:

    Bot performs the walking task from this area multiple times, maybe even for an hour. Then suddenly, it will just stop, even if i manually walk to the next area etc, it will NOT do anything else without restarting.
  5. I'll contribute to this by also saying,
    Clearly within a region a region path can work 49 times then suddenly just be "Nope"
    Not finding that same path I just found 49 times.
    and the whole script bot just stops.
    No errors, just the path finder refusing to detect the path anymore
  6. the problem is ,i get this with any kind of path.
  7. All I can Suggest is make a custom web.
    In most cases you're likely in an area the default web doesn't actually support so it falls back on the other path finding methods.
    I've been using custom webs and have stopped having this Issue.
    torque0 likes this.
  8. This is something I know I inevitably should learn so I guess its time, thanks for the suggestion.
  9. Unmarking thread as resolved and tagging @Cloud.
  10. Thanks, i also have some new information. It is printing
    Code (Text):
    2. Nov 05, 2015 7:58:27 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
    3. INFO: Could not find stylesheet: file:/C:/Users/Mohsin/RuneMate/temp/SetupDialog.css
    whenever i stop/start the script bot after this problem occurs. It doesnt seem relevant if its just a style sheet.. but maybe it has something to do with file permissions?
    #9 torque0, Nov 5, 2015
    Last edited: Nov 5, 2015
  11. There is no way that it can just stop being detected in an area unless some condition changes.
  12. The only condition is if the player is in an area and to walk to the next. If the regionpath is null, i make a web path, if the web path is null i make a bresenham path. But when this problem happens, no matter what area I am in the bot won't continue running. And it's only in one area (after changing regions, more specifically getting off the boat at entrana.) but this doesn't happen anywhere else.

    So the only explaination i can think of, is that a condition is changing but its out of my control : its that the bot isn't detecting the change of region.
  13. Alternatively something in your code could be blocking. Make sure it's still looping properly. Could be done with a simple println at the top of the loop.
  14. I'm agreeing with what Arbiter said, it's likely something in your code is causing a loop.
  15. This is exactly what just came to mind, i'm going to run the bot until the problem happens again and see if messages continue printing ill assume if they do its 100% a problem on my side.
  16. Rather if it doesn't keep printing that means you have blocking code and is likely your fault.
  17. Ok well the problem occured again, the message (with no conditions at the top of loop) stopped printing
  18. Sounds like the method is blocked, most likely with an infinite loop inside the main loop (your end).
  19. If you care to elaborate on which basic things might be causing a loop.
    Since my script bot is literally:

    Code (Text):
    1.  >Inventory Full
    2.       >If In Bank
    3.           >Bank
    4.       >else
    5.           >Walk To Bank
    6. >else
    7.       >If In Field
    8.           >Pick
    9.       >else
    10.           >Walk To Field
    and just a random chance in hell that it'll hit path generation and never move again
  20. Looping through and not being able to do anything has the same symptoms as getting stuck inside a loop. The symptom would be the appearance of doing nothing or "getting stuck". Check your walking logic to figure out what it does when the path is null. Perhaps add a println when it fails to walk to make sure it's at least getting there. From that point you can figure out how to deal with the problem by adding a web walking backup or a needing to make a custom path.
  21. But the path being null is the problem.
    It just found the same path numerous times before, then suddenly it doesn't exist.

Share This Page