I created this since I had to make many small paths that I couldn't well use with a map; hope someone finds some use in it
Download: http://up.ht/1gqZhyG
Notes: -It will automatically copy the code to your clipboard -It will also print it out in log Yea just put in the tile distance (I usually use 5 it seems to work well for walking long distances).
Source if you want it
package com.zscripz;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.util.ArrayList;
import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.map.Position;
@ScriptManifest(name = "zWalker", author = "zScripz", version = 1.0, info="Creates a path based on tile distance")
public class Walker extends Script {
ArrayList<Position> posList = new ArrayList<>();
Gui gui;
Position control;
public void onStart(){
gui = new Gui();
gui.frame.setVisible(true);
control = client.getMyPlayer().getPosition();
}
public int onLoop() throws InterruptedException{
if (!gui.textField.getText().equals("")) {
if (distance(control) >= gui.getTileDistance()) {
control = client.getMyPlayer().getPosition();
posList.add(client.getMyPlayer().getPosition());
log("Position added!");
}
}
return 0;
}
public String convertPos(Position p) {
return "(" + p.getX() + "," + p.getY() + "," + p.getZ() + ")" + ", ";
}
public void onExit() {
StringBuilder sB = new StringBuilder();
sB.append("Position[] path = new Position[] { ");
for(int i = 0; i < posList.size(); i++) {
sB.append("new Position" + convertPos(posList.get(i)));
}
sB.append(" };");
String myString = sB.toString();
StringSelection stringSelection = new StringSelection (myString);
Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
clpbrd.setContents (stringSelection, null);
log("Text copied to clipboard!");
log(sB.toString());
gui.frame.dispose();
}
}