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.

Better eating method?

Featured Replies

Currently using this as my eating method: but conscious that always eating when health < 50% is very botlike. What is a better way to go about this? Are there any snippet examples that could would be useful?

if(myPlayer().getHealthPercent() < 50){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}

Everytime you eat set a new random percentage to eat at (like eat at 40-60%)

  • Author
if(myPlayer().getHealthPercent() < 65 && (Math.random() < 0.1)){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}
if(myPlayer().getHealthPercent() < 50 && (Math.random() < 0.2)){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}
if(myPlayer().getHealthPercent() < 40 && (Math.random() < 0.25)){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}
if(myPlayer().getHealthPercent() < 25){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}

 

something like this?

  • Author

or like this: 

if(myPlayer().getHealthPercent() < (75*(Math.random())) || myPlayer().getHealthPercent() < 20){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}

Do something simple like:

 

int eatPercentage = 50;    //Initial value

if(myPlayer().getHealthPercent() < eatPercentage){

//Eat food

eatPercentage = random(40,60);   //Set new value

}

Edited by Elysiano

I'm not sure if there is ever a 'best' way to do it, but if it is efficient, and it works, then it should do the job ;) 

Edited by Elysiano

  • Author

ok, thanks will it not always be over-written to 50 though: as the only place it seemed to work instanciating it was inside the onloop function?

never mind was being a retard was one curly brace out when i tried instanciating it above

18 minutes ago, scriptersteve said:

ok, thanks will it not always be over-written to 50 though: as the only place it seemed to work instanciating it was inside the onloop function?

never mind was being a retard was one curly brace out when i tried instanciating it above

int eatAt would be global, it'd then be set again after eating. 

The way I handle this is to eat when food will be 100% effective or if the character is under or at a certain threshold (I set this to monsters max hit). So say you eating trout, it heals 7 hp. If we have 25 hp, we heal at 18 hp or less. This keeps us near full HP which is generally what is wanted with food but won't waste food with %s. But say we were fighting something with a max hit of 5, we'd have a minimum threshold of 5 HP, so in case the monster hits us for max damage we can still live.

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.