Jump to content

Path generator


zScripz

Recommended Posts

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 tongue.png

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();
		}
	}
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...