Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved Restart bot during runtime

Joined
Oct 18, 2015
Messages
25
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, i get this printed in the console:

Code:
Nov 05, 2015 7:58:27 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
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:
if (landing.contains(Players.getLocal())) {
if (ChatDialog.getContinue() != null)
ChatDialog.getContinue().select();
System.out.println("I GET STUCK HERE");
// Camera.turnTo(245, 0.485);
if (walkToR(dest1)) {
Execution.delay(200,500);
}
}

Then I use this to walk:

Code:
public boolean walkToR(Area a) {
final Coordinate walk2 = a.getRandomCoordinate();
final RegionPath walking2 = RegionPath.buildTo(walk2);
if (!Players.getLocal().isMoving()) {
if (walking2 != null)
walking2.step(true);
}
return true;
}
 
Last edited:
Mod Automation
Joined
Jul 26, 2013
Messages
3,037
No it is not possible to do what you are asking. Undesired bot behavior. Start and stop are exclusively end-user controls.
 
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.
 
Joined
Oct 18, 2015
Messages
25
No it is not possible to do what you are asking. Undesired bot behavior. Start and stop are exclusively end-user controls.
 
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.

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.
 
Joined
Oct 2, 2015
Messages
31
No it is not possible to do what you are asking. Undesired bot behavior. Start and stop are exclusively end-user controls.
 
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.
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 just stops.
No errors, just the path finder refusing to detect the path anymore
 
Joined
Oct 18, 2015
Messages
25
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 just stops.
No errors, just the path finder refusing to detect the path anymore
the problem is ,i get this with any kind of path.
 
Joined
Oct 2, 2015
Messages
31
the problem is ,i get this with any kind of path.
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.
 
Joined
Oct 18, 2015
Messages
25
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.
This is something I know I inevitably should learn so I guess its time, thanks for the suggestion.
 
Joined
Oct 18, 2015
Messages
25
Thanks, i also have some new information. It is printing
Code:
Nov 05, 2015 7:58:27 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
INFO: Could not find stylesheet: file:/C:/Users/Mohsin/RuneMate/temp/SetupDialog.css
whenever i stop/start the script after this problem occurs. It doesnt seem relevant if its just a style sheet.. but maybe it has something to do with file permissions?
 
Last edited:
Engineer
Joined
Jul 28, 2013
Messages
2,776
There is no way that it can just stop being detected in an area unless some condition changes.
 
Joined
Oct 18, 2015
Messages
25
There is no way that it can just stop being detected in an area unless some condition changes.

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.
 
Mod Automation
Joined
Jul 26, 2013
Messages
3,037
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.
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.
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
I'm agreeing with what Arbiter said, it's likely something in your code is causing a loop.
 
Joined
Oct 18, 2015
Messages
25
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.
 
Mod Automation
Joined
Jul 26, 2013
Messages
3,037
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.
Rather if it doesn't keep printing that means you have blocking code and is likely your fault.
 
Mod Automation
Joined
Jul 26, 2013
Messages
3,037
Ok well the problem occured again, the message (with no conditions at the top of loop) stopped printing
Sounds like the method is blocked, most likely with an infinite loop inside the main loop (your end).
 
Joined
Oct 2, 2015
Messages
31
I'm agreeing with what Arbiter said, it's likely something in your code is causing a loop.

If you care to elaborate on which basic things might be causing a loop.
Since my script is literally:

Code:
 >Inventory Full
      >If In Bank
          >Bank
      >else
          >Walk To Bank
>else
      >If In Field
          >Pick
      >else
          >Walk To Field
and just a random chance in hell that it'll hit path generation and never move again
 
Mod Automation
Joined
Jul 26, 2013
Messages
3,037
If you care to elaborate on which basic things might be causing a loop.
Since my script is literally:

Code:
 >Inventory Full
      >If In Bank
          >Bank
      >else
          >Walk To Bank
>else
      >If In Field
          >Pick
      >else
          >Walk To Field
and just a random chance in hell that it'll hit path generation and never move again
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.
 
Joined
Oct 2, 2015
Messages
31
But the path being null is the problem.
It just found the same path numerous times before, then suddenly it doesn't exist.
 
Top