Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Prayer flicking (NPC Animations)

Featured Replies

Here's the current code I have for prayer flicking:

private void handlePrayerFlicking() {
		if (getSkills().getStatic(Skill.PRAYER) >= 37 && !canFlickMage)
			canFlickMage = true;
		if (getSkills().getStatic(Skill.PRAYER) >= 40 && !canFlickRange)
			canFlickRange = true;
		if (getSkills().getStatic(Skill.PRAYER) >= 43 && !canFlickMelee)
			canFlickMelee = true;
		if (myPlayer().getInteracting() != null && myPlayer().getInteracting() instanceof NPC) {
			NPC npc = ((NPC) myPlayer().getInteracting());
			if (npc.getHealthPercent() > 0 && npc.exists()) {
				if (!npc.isAnimating() && !getPrayer()
						.isActivated(currentNPCAttackStyle.equalsIgnoreCase("mage") ? PrayerButton.PROTECT_FROM_MAGIC
								: currentNPCAttackStyle.equalsIgnoreCase("range") ? PrayerButton.PROTECT_FROM_MISSILES
										: PrayerButton.PROTECT_FROM_MELEE)) {
					if ((canFlickMage && currentNPCAttackStyle.equalsIgnoreCase("mage"))
							|| (canFlickRange && currentNPCAttackStyle.equalsIgnoreCase("range"))
							|| (canFlickMelee && currentNPCAttackStyle.equalsIgnoreCase("melee"))) {
						if (getPrayer()
								.set(currentNPCAttackStyle.equalsIgnoreCase("mage") ? PrayerButton.PROTECT_FROM_MAGIC
										: currentNPCAttackStyle.equalsIgnoreCase("range")
												? PrayerButton.PROTECT_FROM_MISSILES
												: PrayerButton.PROTECT_FROM_MELEE,
										true)) {
						} else {
						}
					}
				} else {
					if (getPrayer().isActivated(
							currentNPCAttackStyle.equalsIgnoreCase("mage") ? PrayerButton.PROTECT_FROM_MAGIC
									: currentNPCAttackStyle.equalsIgnoreCase("range")
											? PrayerButton.PROTECT_FROM_MISSILES
											: PrayerButton.PROTECT_FROM_MELEE)) {
						Sleep.waitCondition(() -> npc.isAnimating() || npc.getHealthPercent() == 0, 300, 1500);
						if (getPrayer()
								.set(currentNPCAttackStyle.equalsIgnoreCase("mage") ? PrayerButton.PROTECT_FROM_MAGIC
										: currentNPCAttackStyle.equalsIgnoreCase("range")
												? PrayerButton.PROTECT_FROM_MISSILES
												: PrayerButton.PROTECT_FROM_MELEE,
										false)) {
						} else {
						}
					}
				}
			}
		}
	}

This works fine with most npcs, other than those that have longer attack delays, like hill giants. Whenever the npc performs their defense animation, prayer will still flick as they're 'animating'. I only want the prayer to flick off if it's their attack animation.

Is it possible to determine if the current animation an npc is performing is their defense animation or is there a better way to add prayer flicking?

Edited by Ateria

If you timestamp any one attack animation from the NPC, you can predict the timestamps of their next attacks based on their attackspeed

  • Author
2 minutes ago, FrostBug said:

If you timestamp any one attack animation from the NPC, you can predict the timestamps of their next attacks based on their attackspeed

I was going to do that, but it's for a slayer script and with the amount of tasks there are, i'd have to go through enum and add attack animations one by one after getting them in-game which'd take a long time. Is it not possible to do it another way?

3 minutes ago, Ateria said:

I was going to do that, but it's for a slayer script and with the amount of tasks there are, i'd have to go through enum and add attack animations one by one after getting them in-game which'd take a long time. Is it not possible to do it another way?

There's probably a fixed relation between the animations if I had to guess.. like the defence animation always being a higher or lower ID than the attack animation

  • Author
15 minutes ago, FrostBug said:

There's probably a fixed relation between the animations if I had to guess.. like the defence animation always being a higher or lower ID than the attack animation

That seems to work for the tasks so far, thanks :)

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.