Jump to content

Override default interact timer


clanket
 Share

Recommended Posts

I'm currently working on some scripts that require faster reaction times from the bot. The animation timer for thieving is ~4 ticks per action. The method f.iteract("Pickpocket") will match the default animation timer. My goal is to get it somewhere around 2-2.5 tick reaction time rather than 4. Is there anyway to modify the speed of method or will I have to write my own work around?

Edited by clanket
Link to comment
Share on other sites

Here's a quick class that you can use to override the default interaction timers. 

import org.osbot.rs07.utility.*;
import java.util.function.*;

public final class Sleep extends ConditionalSleep {
	private final BooleanSupplier condition;

	public Sleep(final BooleanSupplier condition, final int timeout) {
		super(timeout);
		this.condition = condition;
	}

	public Sleep(final BooleanSupplier condition, final int timeout, final int interval) {
		super(timeout, interval);
		this.condition = condition;
	}

	public boolean condition() throws InterruptedException {
		return this.condition.getAsBoolean();
	}

	public static boolean sleepUntil(final BooleanSupplier condition, final int timeout) {
		return new Sleep(condition, timeout).sleep();
	}

	public static boolean sleepUntil(final BooleanSupplier condition, final int timeout, final int interval) {
		return new Sleep(condition, timeout, interval).sleep();
	}

}

Now to override the interaction speed for something like pickpocketing all you have to do is.

	if(targetWithAHugeDong.interact("Pickpocket")){
					Sleep.sleepUntil(() -> myPlayer().exists(), random(950, 1500));
					break;
				};

You can now modify the speed at which you click/interact with the target. It no longer requires the animation to finish. I'll post all my 2-3 tick scripts publicly when I'm done skilling to 99. ?

  • Like 1
  • Sad 1
Link to comment
Share on other sites

27 minutes ago, clanket said:

Here's a quick class that you can use to override the default interaction timers. 

Now to override the interaction speed for something like pickpocketing all you have to do is.

You can now modify the speed at which you click/interact with the target. It no longer requires the animation to finish. I'll post all my 2-3 tick scripts publicly when I'm done skilling to 99. ?


That doesn't change the actual time .interact() takes to complete. OP wants to know if there is a way to make the interact() method faster, which there is not. OP would have to write his own interact() method.

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.

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.

 Share

  • Recently Browsing   0 members

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