Jump to content

Perfect 1 Tick Prayer Flicker [Open Source]


Recommended Posts

Posted (edited)

Hi,

I've been meaning to write this for a while now and have always gotten carried away with other projects.

To set up, just select your quick prayers, and the script will do the rest. It activates your quick prayers, then identifies the game's tick, and then double clicks in a loop every time the tick changes (I've left a random wait in the middle, feel free to remove or adjust if you'd like).

Hope you enjoy! 🙂 <3

 

Spoiler
package Osbot;

import java.awt.Color;
import java.awt.Graphics2D;

import org.osbot.rs07.listener.GameTickListener;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.ui.PrayerButton;

@ScriptManifest(author = "LolMarcus", name = "Prayer Flicker", info = "Flicks the quick prayers.", version = 1.0, logo = "")
public class prayerFlick extends Script implements GameTickListener {

    private int tickCount = 0;
    private int previousTickCount = 0;

    @Override
    public void onStart() {
    	if (!isOverheadPrayerActive()){
        getPrayer().setQuickPrayer(true);
        log("Starting PrayerFlicking script...");
        getBot().addGameTickListener(this);
    	}
    }

    @Override
    public void onGameTick() {
        tickCount++;
        log("Game tick: " + tickCount);
    }

    @Override
    public int onLoop() throws InterruptedException {
    	if (!isOverheadPrayerActive()){
            getPrayer().setQuickPrayer(true);
    	}else
    		if (tickCount != previousTickCount) {
    			getMouse().click(false);
    			sleep(random(0, 5));
    			getMouse().click(false);
    			previousTickCount = tickCount;
    		}
    	return random(100, 200);
    }
    
    @Override
    public void onPaint(Graphics2D g) {
        g.setColor(Color.WHITE);
        g.drawString("Game Ticks: " + tickCount, 10, 50);
    }

    @Override
    public void onExit() {
        log("Stopping PrayerFlicking script...");
        getBot().removeGameTickListener(this);
    }
    
    private boolean isOverheadPrayerActive() {
        return getPrayer().isActivated(PrayerButton.PROTECT_FROM_MAGIC) ||
               getPrayer().isActivated(PrayerButton.PROTECT_FROM_MISSILES) ||
               getPrayer().isActivated(PrayerButton.PROTECT_FROM_MELEE) ||
               getPrayer().isActivated(PrayerButton.RETRIBUTION) ||
               getPrayer().isActivated(PrayerButton.REDEMPTION) ||
               getPrayer().isActivated(PrayerButton.SMITE);
    }
}

 

 

Edited by Lol_marcus
Refined code.
  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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