Jump to content

StyxAfker [Free]

Recommended Posts


This is a simple afker script. The script clicks between inventory and skill tabs at random intervals to prevent logout. The intervals are 3-4,5 minutes.

Put the jar file to C:\Users\USERNAME\OSBot\Scripts and the script should appear on your script list in the client.

Download: StyxAfker.jar v1.01




import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.Color;
import java.awt.Graphics2D;
import org.osbot.rs07.api.ui.Tab;

        author = "styxa", name = "StyxAfker", version = 1.01, info = "Afks; clicks inventory and skill tabs to prevent logout.", logo = "https://i.imgur.com/d69IFDq.png"

public class StyxAfker extends Script {
        private String scriptName;
        private String scriptAuthor;
        private double scriptVersion;
        private long startTime;
        private long afkTimer;
        private int afkLimit;
        public void onStart() {    
            scriptName =  getName();        
            scriptAuthor = getAuthor();
            scriptVersion = getVersion();                    
            log("Welcome to " + scriptName + " v"+scriptVersion+"! Script author: "+scriptAuthor);    
            log("This script clicks between inventory and skill tabs in random intervals to prevent logout.");    
            startTime = System.currentTimeMillis();        
            afkTimer = System.currentTimeMillis();
            afkLimit = random(180000, 270000); //180000ms = 3min, 270000ms = 4,5min         
        public enum State {
            WAIT, OPEN_TAB
        private State getState() {                    
            if (System.currentTimeMillis() - afkTimer >= afkLimit){    
                afkTimer = System.currentTimeMillis();//reset afkTimer
                afkLimit = random(180000, 270000);//generate new afkLimit
                return State.OPEN_TAB;
            return State.WAIT;    
        public int onLoop() throws InterruptedException {        
            switch (getState()) {    
                case WAIT:
                    sleep(random(1000, 2000));
                case OPEN_TAB:
            return random(300, 600);        
        public void onPaint(Graphics2D  g) {
            g.setColor(new Color(0, 0, 0, 95));
            g.fillRect(4, 240, 140, 50);            
            //script name and version
            g.drawString(scriptName+" v"+scriptVersion, 11, 261);
            g.drawString(scriptName+" v"+scriptVersion, 10, 260);
            //time ran
            final long runTime = System.currentTimeMillis() - startTime;
            g.drawString("Time ran: "+formatTime(runTime), 11, 281);
            g.drawString("Time ran: "+formatTime(runTime), 10, 280);
            //script author
            g.drawString("script by "+scriptAuthor, 690, 10);    
        public final String formatTime(final long ms){
            long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24;
            s %= 60; m %= 60; h %= 24;

            return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) :
                   h > 0 ? String.format("%02d:%02d:%02d", h, m, s) :
                   String.format("%02d:%02d:%02d",h, m, s);
        void openTab() {
            if (getTabs().getOpen().equals(Tab.INVENTORY)) {//if inventory is open, open skills 
            } else if (getTabs().getOpen().equals(Tab.SKILLS)){//if  skills is open, open inventory
            } else {//if some other tab is open, open inventory


Thanks to Apaec for the beginners guide on OSBot scripting: A Beginners Guide to Writing OSBot Scripts (where to get started!) by Apaec

Thanks to Explv for the paint tutorial: Explv's Dank Paint Tutorial




v1.01 (2018-02-15):
-runtime paint now includes days if ran for over 24 hours

v1.0 (2018-02-11):
-released v1.0


edit history:
edit2: uploaded v1.01, new screenshot with 23h runtime, updated source , added changelog
edit1: fixed typo, uploaded a new screenshot with longer runtime


Edited by styxa
  • Like 2
Link to comment
Share on other sites

Source code behind this is a bit messy, missing a few key stuff like

  • Player movement
  • Entity interactions
  • Chat input
  • Emote performing

Stuff like that make it more realistic, although Jagex won't look to ban someone to afk botting for whatever reason that may even be.

Good job on your efforts, hope your code gets cleaner as you go along.

Edited by Kid Lethal
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...