January 16, 201610 yr Lets u quickly grab position data for making paths. (Useful for dungeons, zeah, unmapped locations, etc.) EDIT: Added auto position grabbing every 7 tiles. (No more clicking the button) import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.datatransfer.StringSelection; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.border.EmptyBorder; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.script.Script; public class PathTool { private Script script; private String newline = "\n"; private String text; private Thread t; private Position currentPosition; public PathTool(Script script) { this.script = script; } public void open() { JFrame frame = new JFrame("Path Maker - " + script.getClient().getUsername()); JButton button = new JButton("Listen"); JButton button2 = new JButton("Copy Data"); JTextArea output = new JTextArea(10, 1); JScrollPane scrollPane = new JScrollPane(output); output.setEditable(false); frame.setLocationRelativeTo(null); frame.setSize(300, 350); frame.setResizable(false); button.addActionListener(event -> { text = String.format("new Position(%d, %d, %d), ", script.myPlayer().getX(), script.myPlayer().getY(), script.myPlayer().getZ()) + newline; output.append(text + newline); currentPosition = script.myPlayer().getPosition(); Thread t1 = new Thread(new Runnable() { public void run() { while (true) { if (script.myPlayer().getPosition().distance(currentPosition) >= 7) { text = String.format("new Position(%d, %d, %d), ", script.myPlayer().getX(), script.myPlayer().getY(), script.myPlayer().getZ()) + newline; output.append(text + newline); currentPosition = script.myPlayer().getPosition(); } try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } } }); t1.start(); }); button2.addActionListener(event -> { String data = output.getText().replace("\n", ""); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(data), null); JOptionPane.showMessageDialog(frame, "Data copied to clipboard!"); }); JPanel textPanel = new JPanel(); JPanel buttonPanel = new JPanel(); JPanel masterPanel = new JPanel(); textPanel.setLayout(new GridLayout(1, 1, 5, 5)); textPanel.setBorder(BorderFactory.createTitledBorder("Data")); textPanel.add(scrollPane); buttonPanel.setLayout(new GridLayout(1, 2, 5, 5)); buttonPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); buttonPanel.add(button); buttonPanel.add(button2); masterPanel.setLayout(new BoxLayout(masterPanel, BoxLayout.Y_AXIS)); masterPanel.add(textPanel); masterPanel.add(buttonPanel); frame.getContentPane().add(masterPanel); frame.setVisible(true); frame.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { t.interrupt(); frame.dispose(); } }); } } Edited January 19, 201610 yr by LoudPacks
January 16, 201610 yr Author Lol y u do this? Web walking thou? I needed to walk in an unmapped dungeon today lol. Im a pleb so I don't have my own and lemons doesn't have zeah, and OSBot doesn't have much besides regular maps. Edited January 16, 201610 yr by LoudPacks
January 16, 201610 yr I needed to walk in an unmapped dungeon today lol. Im a pleb so I don't have my own and lemons doesn't have zeah, and OSBot doesn't have much besides regular maps. Osbot Web included zeah thou
January 16, 201610 yr You don't have automatic position grabbing???? you have to stop, press the button and carry on to the next spot... how painful!
January 16, 201610 yr Author You don't have automatic position grabbing???? you have to stop, press the button and carry on to the next spot... how painful! I could have done that but I just needed a quick path through the cave. How would do that? On a timer? Comparing positions? I figured clicking the button is pretty simple. Osbot Web included zeah thou I didn't know that. I was in ape atol dungeon.
January 16, 201610 yr I could have done that but I just needed a quick path through the cave. How would do that? On a timer? Comparing positions? I figured clicking the button is pretty simple. I didn't know that. I was in ape atol dungeon. Just use distance from the last position added. So if the player is 5 tiles away from the last position added, then add another. Something like that.
January 24, 201610 yr Brothers, I copied your code, the results shown, how much of "x" and red wavy my scholarship did not get started, thank you guide my question
Create an account or sign in to comment