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 Constant Teleporting on the default web

Joined
Nov 3, 2013
Messages
609
No matter what I do, whenever I use the default web, it always just continuously teleports via the closest loadstone. And since teleports can't be disabled in the default web, the entire thing has been rendered completely useless.

@Cloud @Arbiter
 
Joined
Jul 18, 2015
Messages
6
Data:

teleport edge: (3323, 3222)
destination: (3238, 3209)
origin: (3241, 3210) -----> teleports
origin: (3237, 3210) -----> teleports
origin: (3238, 3210) -----> walks

Black box conclusions(liable to be bullshit!):

Proposed solution: Given the cheapest teleport, find minimum cost of [walking to destination, teleporting then walking to destination]. Right now it appears more like your checking if |teleport_x - dest_x|+|teleport_y - dest_y|>25 then teleporting.

Edit: Removed edit,
 
Last edited:
Joined
Nov 3, 2013
Messages
609
Show me your code.
Building the path:
Code:
public Path buildTo(Locatable dest){
        Path path = RegionPath.buildTo(dest);
   
        if(path == null || path.getNext() == null)
            path = web.getPathBuilder().buildTo(dest);
        if(path == null || path.getNext() == null)
            path = BresenhamPath.buildTo(dest);
       
        return path;
    }
I call this function repeatedly so it takes steps:
Code:
public void walkToBank() {
        if(bankPath == null) bankPath = pathBuilder.buildTo(bank.getArea());
        else if(!bank.contains(Traversal.getDestination())){
            /*Path tempPath = bankPath;
            if(Random.nextInt(100) <= PlayerSense.getAsInteger(CustomPlayerSense.Key.VIEW_PORT_WALKING.playerSenseKey)){
                tempPath = ViewportPath.convert(tempPath);
            }*/

            System.out.println(bankPath.getNext() + ": " + bankPath.step());
           
            if(bankPath instanceof BresenhamPath){
                bankPath = pathBuilder.buildTo(bank.getArea());
            }
            Execution.delay(400,600);
        }else{
            Execution.delay(400,600);
        }
    }
 
Joined
Jul 18, 2015
Messages
6
The primary issue here is that path's are being generated with teleports that actually result in a *larger* traversal cost than those without teleports. This is demonstrated in my first post where instead of stepping 3 tiles west & 1 south, a teleport is instead performed. This will almost certainly result in closed traversal loops for certain sets of {origin, destination}.


TheBat: Although your code should work in most cases*[and is very efficient!], I can see a potential pitfall... Consider: If your at location A, build path to B, then move to a new location C that is far away, the original path will not retain information relevant to location C.

*Given path's are generated correctly.
 
Joined
Nov 3, 2013
Messages
609
The primary issue here is that path's are being generated with teleports that actually result in a *larger* traversal cost than those without teleports. This is demonstrated in my first post where instead of stepping 3 tiles west & 1 south, a teleport is instead performed. This will almost certainly result in closed traversal loops for certain sets of {origin, destination}.


TheBat: Although your code should work in most cases*[and is very efficient!], I can see a potential pitfall... Consider: If your at location A, build path to B, then move to a new location C that is far away, the original path will not retain information relevant to location C.

*Given path's are generated correctly.
If I've generated a path from location A -> B, why would it ever go to C unless C is on the path between A->B? And if C is on the path, then it is moving from C -> B anyway.

Additional note: If C is a teleported to location, then the path should have built from the teleported location to B.

The problem is that loadstones just do not cost enough in the web. if walking from A -> B is 40. and walking from C -> B is only 20, then the cost of A -> B could also be: cost of the tele + C -> B, but the tele needs to cost like 40 since it takes 30 seconds to cast.
 
Last edited:
Joined
Apr 22, 2015
Messages
21
Try from the West Varrock mine to the West Varrock bank. I know @mjmfighter was having the same problem in that location with his own script.

Yup. I was going from the Varrock West Mine to the Varrock West Bank. The path works sometimes but when it doesnt it gets sucks in an endless lodestone teleport to Varrock, which makes no sense as its no where near the shortest path or even along the way

@Cloud
 
Joined
Nov 3, 2013
Messages
609
@Cloud
It keeps happening when I generate a path from:
bank = new Area.Rectangular(new Coordinate(3267,3169), new Coordinate(3273,3165));
mine = new Area.Rectangular(new Coordinate(3290,3319), new Coordinate(3305,3285));
 
@Cloud
So, a bit more info, if you stand right next to the Falador lodestone and try to walk to the dwarven mine north-east of there, it has two problems:
1. It uses the teleport right off the bat, instead of just walking there.
2. After it teleports, it clicks the next step just north east of the lodestone before the animation has completed. That step disappears, so it teleports to the lodestone again for whatever reason.

I know that calling step on a path will return false and not take the step if the current traversal destination is far enough away or it's not on the mini map, which means #2 can be easily fixed by simply adjusting the time that it waits for the animation to finish be a bit longer.
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
@Cloud
It keeps happening when I generate a path from:
bank = new Area.Rectangular(new Coordinate(3267,3169), new Coordinate(3273,3165));
mine = new Area.Rectangular(new Coordinate(3290,3319), new Coordinate(3305,3285));
 
@Cloud
So, a bit more info, if you stand right next to the Falador lodestone and try to walk to the dwarven mine north-east of there, it has two problems:
1. It uses the teleport right off the bat, instead of just walking there.
2. After it teleports, it clicks the next step just north east of the lodestone before the animation has completed. That step disappears, so it teleports to the lodestone again for whatever reason.

I know that calling step on a path will return false and not take the step if the current traversal destination is far enough away or it's not on the mini map, which means #2 can be easily fixed by simply adjusting the time that it waits for the animation to finish be a bit longer.
I've gone ahead and revised the Lodestone#teleport method to wait until completion of the teleport (aka, until you're off the lodestone and no longer moving) before it returns.
 
Joined
Nov 3, 2013
Messages
609
I've gone ahead and revised the Lodestone#teleport method to wait until completion of the teleport (aka, until you're off the lodestone and no longer moving) before it returns.
It no longer spam click when it's waiting, which is something. I did some debugging, and I think I found something interesting. I don't know exactly what the problem is, but it is VERY easy to replicate.

To replicate:
1. Home teleport to lumbridge
2. Build a path to new Coordinate(3018, 3450)
3. Let it teleport and a loop will start.
4. Stop it after a loop or two.
5. Build a path from the current location to new Coordinate(3018, 3450)
6. It will loop again.

(Actually, I just realized the following is because my path generator switches to a region path once I get it to load the region)
7. Manually walk to destination.
8. Build a path to new Coordinate(3018, 3450)
9. Manually walk back to lodestone.
10. Paths will build normally now.

Here's some data I collected, I don't know if it will help, but let me know if you can't replicate it, or you need anything else from me.
http://pastebin.com/raw.php?i=pw2nK8iw

The code I ran looks like this:
Code:
if(path == null){
    path = web.getPathBuilder().buildTo(new Coordinate(3018, 3450));
    System.out.println("New Path created: " + Players.getLocal().getPosition() + " -> " + new Coordinate(3018, 3450));
}else{
    System.out.println("Current Location: " + Players.getLocal().getPosition() + " Vertex: " + path.getNext());
    path.step();
}
Execution.delay(Random.nextInt(600,800));
And that is simply continuously looped until the player is at the proper destination.
 
Last edited:
Engineer
Joined
Jul 28, 2013
Messages
2,776
It no longer spam click when it's waiting, which is something. I did some debugging, and I think I found something interesting. I don't know exactly what the problem is, but it is VERY easy to replicate.

To replicate:
1. Home teleport to lumbridge
2. Build a path to new Coordinate(3018, 3450)
3. Let it teleport and a loop will start.
4. Stop it after a loop or two.
5. Build a path from the current location to new Coordinate(3018, 3450)
6. It will loop again.

(Actually, I just realized the following is because my path generator switches to a region path once I get it to load the region)
7. Manually walk to destination.
8. Build a path to new Coordinate(3018, 3450)
9. Manually walk back to lodestone.
10. Paths will build normally now.

Here's some data I collected, I don't know if it will help, but let me know if you can't replicate it, or you need anything else from me.
http://pastebin.com/raw.php?i=pw2nK8iw

The code I ran looks like this:
Code:
if(bankPath == null){
    bankPath = web.getPathBuilder().buildTo(new Coordinate(3018, 3450));
    System.out.println("New Path created: " + Players.getLocal().getPosition() + " -> " + new Coordinate(3018, 3450));
}else{
    System.out.println("Current Location: " + Players.getLocal().getPosition() + " Vertex: " + bankPath.getNext());
    bankPath.step();
}
Execution.delay(Random.nextInt(600,800));
And that is simply continuously looped until the player is at the proper destination.
So what parts of that are actually valid if part of it was because of your code?
 
Joined
Nov 3, 2013
Messages
609
So what parts of that are actually valid if part of it was because of your code?
It's not just my code. I was using Alpha Divination(@SlashnHax), and started it away from the location it was meant to be run at, and it went to walk there and got stuck in a loop on the Varrock lodestone.

Here is the full testing script that I used: http://pastebin.com/JguMDNwC
Code:
import com.runemate.game.api.hybrid.location.Coordinate;
import com.runemate.game.api.hybrid.location.navigation.Path;
import com.runemate.game.api.hybrid.location.navigation.Traversal;
import com.runemate.game.api.hybrid.location.navigation.web.Web;
import com.runemate.game.api.hybrid.region.Players;
import com.runemate.game.api.hybrid.util.calculations.Random;
import com.runemate.game.api.script.Execution;
import com.runemate.game.api.script.framework.LoopingScript;

public class WebTest extends LoopingScript{
    Path path = null;
    Web web = Traversal.getDefaultWeb();
  
    @Override
    public void onLoop() {
        if(Players.getLocal().getPosition().distanceTo(new Coordinate(3018, 3450)) > 5)walk();
        else stop();
    }
  
    public void walk(){
        if(path == null){
           path = web.getPathBuilder().buildTo(new Coordinate(3018, 3450));
           System.out.println("New Path created: " + Players.getLocal().getPosition() + " -> " + new Coordinate(3018, 3450));
        }else{
           System.out.println("Current Location: " + Players.getLocal().getPosition() + " Vertex: " + path.getNext());
           path.step();
        }
        Execution.delay(Random.nextInt(600,800));
    }
}

It's a very simplified version of what my actual script is doing, but it still demonstrates the issue. I don't see anything wrong with that code, but maybe I'm doing something really stupid.

I started it running when I started writing this message and it looped the entire time:
Code:
(01:21:20) New Path created: Coordinate(2735, 3416, 0) -> Coordinate(3018, 3450, 0)
(01:21:21) Current Location: Coordinate(2735, 3416, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:21:37) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:21:38) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:21:40) Current Location: Coordinate(2967, 3403, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:21:55) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:21:56) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:21:58) Current Location: Coordinate(2967, 3403, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:22:12) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:22:14) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:22:16) Current Location: Coordinate(2966, 3404, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:22:17) Current Location: Coordinate(2967, 3406, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:22:18) Current Location: Coordinate(2970, 3409, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:22:19) Current Location: Coordinate(2973, 3410, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:22:20) Current Location: Coordinate(2975, 3413, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:22:21) Current Location: Coordinate(2977, 3414, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:22:22) Current Location: Coordinate(2981, 3417, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:22:36) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:22:38) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:22:39) Current Location: Coordinate(2967, 3403, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:22:53) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:22:55) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:22:57) Current Location: Coordinate(2967, 3403, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:23:11) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:23:13) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:23:14) Current Location: Coordinate(2967, 3403, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:23:15) Current Location: Coordinate(2967, 3403, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:23:30) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:23:31) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:23:33) Current Location: Coordinate(2967, 3403, 0) Vertex: LodestoneVertex(2967, 3404, 0)
(01:23:47) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:23:49) Current Location: Coordinate(2967, 3404, 0) Vertex: CoordinateVertex(2983, 3420, 0)
(01:23:50) Current Location: Coordinate(2967, 3403, 0) Vertex: LodestoneVertex(2967, 3404, 0)
 
Also, you can see people on this page of this thread: https://www.runemate.com/community/threads/celestial-wine-grabber.988/page-5 complaining about the exact same issue.
 
Here is a copy of my script that generated a new path on every step. At first I thought it was working, and it did once, however after multiple tests, it also shows the bug:
http://pastebin.com/Uz13MX6e
 
@Cloud
I didn't know if RM caches classes between runs or not, so I though that my path just might not be null when the script was started. With this in mind, I added an onStart to the script to be absolutely sure the path is null at start up. This is my new testing script:
Code:
public class WebTest extends LoopingScript{
    Path path = null;
    Web web = Traversal.getDefaultWeb();
   
    @Override
    public void onStart(String... args){
        path = null;
    }
   
    @Override
    public void onLoop() {
        if(Players.getLocal().getPosition().distanceTo(new Coordinate(3018, 3450)) > 5)walk();
        else stop();
    }
   
    public void walk(){       
        path = web.getPathBuilder().buildTo(new Coordinate(3018, 3450));
       System.out.println("New Path created: " + Players.getLocal().getPosition() + " -> " + new Coordinate(3018, 3450));
       path.step();

        Execution.delay(Random.nextInt(600,800));
    }
}

Despite what I said in the chat, this version still loops continuously 80% of the time. Interestingly enough, I can start it directly on the lodestone and it still exhibits this behavior. It is however more likely in this version that it preforms the the first step after the teleport (about 10 tiles away), get's there, then teleports back.

I think you're going to need to implement a step taken flag, even if it's just on lodestone vertices.
 
Joined
Apr 22, 2015
Messages
21
Confirmed working now. Lodestones no longer have a teleport loop, however they are still generated in the path when not really necessary. For example if I am at the varrock east mine and am walking to the varrock east bank, it uses the varrock lodestone to get there even though there is a shorter route in the web
 
Top