LoudPacks Posted January 16, 2016 Share Posted January 16, 2016 (edited) 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, 2016 by LoudPacks Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted January 16, 2016 Share Posted January 16, 2016 (edited) Lol y u do this? Web walking thou? Edited January 16, 2016 by Mysteryy Quote Link to comment Share on other sites More sharing options...
LoudPacks Posted January 16, 2016 Author Share Posted January 16, 2016 (edited) 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, 2016 by LoudPacks Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted January 16, 2016 Share Posted January 16, 2016 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 1 Quote Link to comment Share on other sites More sharing options...
Apaec Posted January 16, 2016 Share Posted January 16, 2016 You don't have automatic position grabbing???? you have to stop, press the button and carry on to the next spot... how painful! Quote Link to comment Share on other sites More sharing options...
LoudPacks Posted January 16, 2016 Author Share Posted January 16, 2016 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. Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted January 16, 2016 Share Posted January 16, 2016 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. 1 Quote Link to comment Share on other sites More sharing options...
Good4RsVid Posted January 24, 2016 Share Posted January 24, 2016 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 Quote Link to comment Share on other sites More sharing options...
Aeonx Posted February 14, 2016 Share Posted February 14, 2016 Exactly what I needed, ty Quote Link to comment Share on other sites More sharing options...
TheGreatests Posted December 20, 2016 Share Posted December 20, 2016 im getting abunch of errors. Quote Link to comment Share on other sites More sharing options...