Purple Posted January 21, 2016 Share Posted January 21, 2016 Changes your OSBot frame title to show your current IP address of your bot. Source import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import javax.swing.*; import java.awt.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; @ScriptManifest(author = "Purple", name = "IP Display Changer", version = 1.01, info = "Changes the title of your osbot to display your bots IP address.", logo = "") public class Display extends Script { @Override public int onLoop() throws InterruptedException { changeFrameTitle("OSBot (" + getCurrentIPAddress() + ")"); stop(false); return 0; } public void changeFrameTitle(final String title) { for(Frame frame : Frame.getFrames()) { if(frame.isVisible() && frame.getTitle().startsWith("OSBot")) { SwingUtilities.invokeLater(() -> frame.setTitle(title)); break; } } } public String getCurrentIPAddress() { try { URL url = new URL("http://myip.dnsomatic.com/"); BufferedReader b = new BufferedReader(new InputStreamReader(url.openStream())); String ip = b.readLine(); b.close(); return ip; } catch (Exception e) { e.printStackTrace(); } return "null"; } } 9 Quote Link to comment Share on other sites More sharing options...
Hysterically Posted January 21, 2016 Share Posted January 21, 2016 I need this. Quote Link to comment Share on other sites More sharing options...
Lil Ugly Mane Posted January 21, 2016 Share Posted January 21, 2016 I need this. Ditto. Quote Link to comment Share on other sites More sharing options...
ferit12 Posted January 21, 2016 Share Posted January 21, 2016 where do i have to safe this ? Quote Link to comment Share on other sites More sharing options...
Purple Posted January 22, 2016 Author Share Posted January 22, 2016 where do i have to safe this ? You have to compile it and save it to your scripts folder located in C:\Users\YOUR_NAME_HERE\OSBot\Scripts Quote Link to comment Share on other sites More sharing options...
Zappster Posted January 22, 2016 Share Posted January 22, 2016 Wouldn't this be less intensive if this was in the onStart() instead on onLoop() since you only need to set the IP once? Nice job anyways 1 Quote Link to comment Share on other sites More sharing options...
Rudie Posted January 22, 2016 Share Posted January 22, 2016 (edited) Wouldn't this be less intensive if this was in the onStart() instead on onLoop() since you only need to set the IP once? Nice job anyways @Override public int onLoop() throws InterruptedException { changeFrameTitle("OSBot (" + getCurrentIPAddress() + ")"); stop(false); return 0; } changeFrameTitle("OSBot (" + getCurrentIPAddress() + ")"); stop(false); stop(false); since you only need to set the IP once Edited January 22, 2016 by Rudie 2 Quote Link to comment Share on other sites More sharing options...
JK_rs Posted January 22, 2016 Share Posted January 22, 2016 nice job! Quote Link to comment Share on other sites More sharing options...
dimitridegroot Posted January 25, 2016 Share Posted January 25, 2016 will use thanks Quote Link to comment Share on other sites More sharing options...
Birdaking Posted February 21, 2016 Share Posted February 21, 2016 When you say compile it you mean? =[ Quote Link to comment Share on other sites More sharing options...
Okabe Posted February 25, 2016 Share Posted February 25, 2016 Wouldn't this be less intensive if this was in the onStart() instead on onLoop() since you only need to set the IP once? Nice job anyways @Override public int onLoop() throws InterruptedException { changeFrameTitle("OSBot (" + getCurrentIPAddress() + ")"); stop(false); return 0; } changeFrameTitle("OSBot (" + getCurrentIPAddress() + ")"); stop(false); stop(false); XD onstart is still the proper use tho. Quote Link to comment Share on other sites More sharing options...
toke up069 Posted March 4, 2016 Share Posted March 4, 2016 how do i get this compiled? Quote Link to comment Share on other sites More sharing options...
Birdaking Posted March 4, 2016 Share Posted March 4, 2016 how do i get this compiled? same, i have eclipse i just have no idea what to do with this code =[ Quote Link to comment Share on other sites More sharing options...
Caesar Posted March 4, 2016 Share Posted March 4, 2016 can someone do a massive solid for me and compile this? It'll save me the hour or two figuring it out Quote Link to comment Share on other sites More sharing options...
Mr Pro Pop Posted September 20, 2016 Share Posted September 20, 2016 really useful Quote Link to comment Share on other sites More sharing options...