kyukyu Posted September 19, 2017 Posted September 19, 2017 (edited) import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.*; import java.awt.*; @ScriptManifest(name = "Cannon Clicker", author = "Kyu", version = 1.0, info = "", logo = "") public class Main extends Script { private long startTime; @Override public void onStart() { //Code here will execute before the loop is started startTime = System.currentTimeMillis(); } @Override public void onExit() { //Code here will execute after the script ends } @Override public int onLoop() { RS2Object cannon = getObjects().closest("Dwarf multicannon"); if(cannon.hasAction("Repair")) cannon.interact("Repair"); if(cannon.hasAction("Fire")) cannon.interact("Fire"); return random(30000,40000); //The amount of time in milliseconds before the loop starts over } @Override public void onPaint(Graphics2D g) { final long runTime = System.currentTimeMillis() - startTime; g.drawString(formatTime(runTime), 30, 30); //This is where you will put your code for paint(s) } public final String formatTime(final long ms){ long s = ms / 1000, m = s / 60, h = m / 60; s %= 60; m %= 60; h %= 24; return String.format("%02d:%02d:%02d", h, m, s); } } first script be gentle Edited September 19, 2017 by kyukyu
Muffins Posted September 19, 2017 Posted September 19, 2017 (edited) might be better to add a conditional to check the chatbox when it says "your cannon is out of ammo" instead of having just a sleep. Edited September 19, 2017 by Muffins
HeyImJamie Posted September 19, 2017 Posted September 19, 2017 Might want to look into position checking as I assume if there's another cannon nearby your script will bug out. Cool idea for a first script though
Runnwith Posted September 19, 2017 Posted September 19, 2017 2 hours ago, Inf Zita said: y no jar to test Compile it yourself??
no face Posted September 19, 2017 Posted September 19, 2017 14 minutes ago, Runnwith said: Compile it yourself?? lol just kidding, nice job man, if people want to use it they should know how to compile a .j 1
Chris Posted September 19, 2017 Posted September 19, 2017 ? what if there are two cannons next to you ?
gearing Posted September 25, 2017 Posted September 25, 2017 On 2017. 09. 19. at 11:01 PM, Runnwith said: Compile it yourself?? On 2017. 09. 19. at 11:19 PM, no face said: lol just kidding, nice job man, if people want to use it they should know how to compile a .j
gearing Posted September 25, 2017 Posted September 25, 2017 (edited) On 2017. 09. 19. at 8:56 PM, Inf Zita said: y no jar to test On 2017. 09. 22. at 6:46 PM, ukasz said: .jar ? http://www.filedropper.com/showdownload.php/cannon i compiled it with the help of @FrostBug it reloads very slow, if there are way too many monsters it runs out of cannonballs & it doesnt click the level up button but at least it works! Edited September 25, 2017 by gearing
Prolax Posted October 5, 2017 Posted October 5, 2017 On 19/09/2017 at 11:25 PM, Chris said: ? what if there are two cannons next to you ? Then you can shoot double.
kyukyu Posted October 9, 2017 Author Posted October 9, 2017 stand under your cannon and youll shoot yours On 9/25/2017 at 5:19 AM, gearing said: http://www.filedropper.com/showdownload.php/cannon i compiled it with the help of @FrostBug it reloads very slow, if there are way too many monsters it runs out of cannonballs & it doesnt click the level up button but at least it works! yeah those are problems that kind of come with what i was trying to do. I just wanted to replicate afk cannon behavior so the time inbetween clicks on the cannon is quite a bit long. Basically i wanted to make a script that afks for me