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.

How do I make my script eat .

Featured Replies

So I took the skeleton from the topic in tutorials and I wanted to know what I have to do to make my bot eat under a certain hp

This is the snippet of code.



    	NPC kurask = npcs.closest("Kurask");
        if(kurask != null){
            kurask.interact("Attack");
            getGroundItems().closest(loot).interact("Take");
           if (getSkills().getDynamic(Skill.HITPOINTS) > random(20,getSkills().getStatic(Skill.HITPOINTS)-22)){
    	
        	

Also if you know a formula that works well for calculating what hp to eat at I would love to know.

Edited by BotScaper

WTF :???:

First of all, why is your code in the onStart LOL.

Go learn java before trying to write a script

Edited by Juggles

  • Author

I am taking a java course thats halfway done the semester I just wanted to try my hand at something different

  • Author
7 minutes ago, Keven said:

getInventory().interact("Eat", "Foodname");

thank you!

I can turn foodname into a list to provide multiple options right?

Edited by BotScaper

10 minutes ago, BotScaper said:

thank you!

I can turn foodname into a list to provide multiple options right?

yes

  • Author

I think I fixed my code up if anyone would like to check, I have everything up to Banking done (which is just eat, loot, and attack)

This is not enough: if(kurask != null){

Should check if your player is not interacting, not in combat, etc.
 

  • Author
7 minutes ago, Prolax said:

This is not enough: if(kurask != null){

Should check if your player is not interacting, not in combat, etc.
 

would this work? 

if(kurask != null && !players.myPlayer().isUnderAttack()){

- Check if npc is visible

- Check if npc not is null

- Check if myplayer not in combat

- Check if myplayer not interacting

That should be it, just look in the API for the methods.

  • Author
36 minutes ago, Prolax said:

- Check if npc is visible

- Check if npc not is null

- Check if myplayer not in combat

- Check if myplayer not interacting

That should be it, just look in the API for the methods.

if(kurask != null && !players.myPlayer().isUnderAttack()||!players.myPlayer().isAnimating()||kurask.isVisible()){

if(kurask != null && !players.myPlayer().isUnderAttack() && !players.myPlayer().isAnimating() && kurask.isVisible()){

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.