Jump to content

Kyu's simple cannon clicker


kyukyu

Recommended Posts


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 by kyukyu
Link to comment
Share on other sites

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 :feels:

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!

8l25H_fpQGOeh4rQQrruwg.png

Edited by gearing
Link to comment
Share on other sites

  • 2 weeks later...

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 :feels:

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!

8l25H_fpQGOeh4rQQrruwg.png

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 :)

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...