Jump to content

Cooking bot, double click


kingbutton

Recommended Posts

try sleep untill my player is animating. (for the fire interact part)

 

What you have, sleep untill inv does not contain raw,// always returns true

edit: the way you have it set up, it returns true always, that's why its spamming

 

I think that'll work, if not, rip

Edited by dreameo
  • Like 1
Link to comment
Share on other sites

16 minutes ago, kingbutton said:

Okay so I got it to chill after it does "Cook all", and technically my code is working smoothly, but there's one thing that is unhuman like and needs to be address.

 When it tries to interact with the fire, it tries to click several times, kind of like the thing issue I had before. It doesn't bug out or anything, but it bothers me that does it, any solutions?

I tried working with the sleep, but it's not working.


public class Main extends Script {

	long lastAnimation = 0;

	@Override
	public int onLoop() throws InterruptedException {

		if (invCheck()) {
			if (fireCheck()) {

				log("Go cook");

				if (myPlayer().isAnimating()) {
					lastAnimation = System.currentTimeMillis();
				} else if (System.currentTimeMillis() > (lastAnimation + 12000)) {
					goCook();
				}
			} else {
				log("Make fire");
				makeFire();
			}
		} else {

		}

		return 50;
	}

public void goCook() {

		RS2Object fire = objects.closest("Fire");
		RS2Widget optionMenu = getWidgets().get(307, 2);

		if (inventory.interactWithNameThatContains("Use", "Raw")) {
			

			if (optionMenu != null) {
				if (optionMenu.interact("Cook All")) {
					new ConditionalSleep(random(3000, 4500)) {

						@Override
						public boolean condition() throws InterruptedException {
							return myPlayer().isAnimating();
						}
					}.sleep();

				}
			} else {

				if (!myPlayer().isAnimating() && !myPlayer().isMoving()) {

					if (fire.interact("Use")) {
						//Sleep.sleepUntil(() -> !getInventory().contains("raw"), 12000);
                        			new ConditionalSleep(random(3000, 4500)) {
						@Override
							public boolean condition() throws InterruptedException {
								return myPlayer().isAnimating();
							}
						}.sleep();
					}
				}

			}
		}

	}

 

The sleep you were using after interacting with the fire (the one I commented out in the quote) was returning true right away since your inventory will never contain anything with the exact name "raw". The conditional sleep I replaced it with should work.

  • Like 1
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...