January 21, 201610 yr 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"; } }
January 22, 201610 yr Author 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
January 22, 201610 yr 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
January 22, 201610 yr 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, 201610 yr by Rudie
February 25, 20169 yr 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.
March 4, 20169 yr how do i get this compiled? same, i have eclipse i just have no idea what to do with this code =[
March 4, 20169 yr can someone do a massive solid for me and compile this? It'll save me the hour or two figuring it out
Create an account or sign in to comment