zScripz Posted January 11, 2014 Posted January 11, 2014 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(); } } 2
lolmanden Posted January 11, 2014 Posted January 11, 2014 (edited) Thanks for the contribution Scripz. Edited January 11, 2014 by lolmanden
z0rbius Posted January 22, 2014 Posted January 22, 2014 I am sorry i feel stupid for asking but i have no experience with scripting and i would really like to learn, how would i go about making a script walk with this? How would i add it in would i need anything before/after the source you have given?
zScripz Posted January 22, 2014 Author Posted January 22, 2014 I am sorry i feel stupid for asking but i have no experience with scripting and i would really like to learn, how would i go about making a script walk with this? How would i add it in would i need anything before/after the source you have given? This won't walk anywhere, this will just generate an array of positions based on where you walk your character