Jump to content

Perfect 1 Tick Prayer Flicker [Open Source]


Recommended Posts

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