Jump to content

Checking prayer and hp?


uyfgfarOS

Recommended Posts

27 minutes ago, Chris said:

getSkills.getStatic to get non boosted level

getskills.getDynamic to get a skill that is changing (boosted or stas r weakend etc)

Cheers mate. Just thrown this quick script together but it doesn't interact with anything. Maybe I'm missing something?

 

import org.osbot.rs07.api.GrandExchange;
import org.osbot.rs07.api.Prayer;
import org.osbot.rs07.api.Bank.BankMode;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;


import java.awt.*;

@ScriptManifest(name = "Skeleton", author = "Alek", version = 1.0, info = "", logo = "") 

public class main extends Script {
	
    @Override
  
    public void onStart() {

        //Code here will execute before the loop is started

    }
    
    private enum State {
		PRAYERPOT, OVERLOAD, WAIT
	};

   
	private State getState() {
		
		if (getSkills().getDynamic(Skill.PRAYER) < 20)
		{
			return State.PRAYERPOT;
		}
		if (getSkills().getDynamic(Skill.HITPOINTS) > 51)
		{
			return State.OVERLOAD;
		}	
		return State.WAIT;
	}
    
	public int onLoop() throws InterruptedException {
		switch (getState()) {
		
		case PRAYERPOT:
			if (getInventory().contains("Prayer potion(4)"))
			{
				inventory.getItem("Prayer potion(4)");
				mouse.click(false);
			}
			else if (getInventory().contains("Prayer potion(3)"))
			{
				inventory.getItem("Prayer potion(3)");
				mouse.click(false);
			}
			else if (getInventory().contains("Prayer potion(2)"))
			{
				inventory.getItem("Prayer potion(2)");
				mouse.click(false);
			}
			else if (getInventory().contains("Prayer potion(1)"))
			{
				inventory.getItem("Prayer potion(1)");
				mouse.click(false);
			}
			
			break;
			
		case OVERLOAD:
			if (getInventory().contains("Overload (4)"))
			{
				inventory.getItem("Overload (4)");
				mouse.click(false);
			}
			else if (getInventory().contains("Overload (3)"))
			{
				inventory.getItem("Overload (3)");
				mouse.click(false);
			}
			else if (getInventory().contains("Overload (2)"))
			{
				inventory.getItem("Overload (2)");
				mouse.click(false);
			}
			else if (getInventory().contains("Overload (1)"))
			{
				inventory.getItem("Overload (1)");
				mouse.click(false);
			}
			break;
			
		case WAIT:
			sleep(3000);
			break;
		}
		return random(200, 300);
	}
			

    @Override

    public void onExit() {

        //Code here will execute after the script ends

    }

 

    public void onPaint(Graphics2D g) {

        //This is where you will put your code for paint(s)

    }

}

 

Link to comment
Share on other sites

4 minutes ago, uyfgfarOS said:

Cheers mate. Just thrown this quick script together but it doesn't interact with anything. Maybe I'm missing something?

 


import org.osbot.rs07.api.GrandExchange;
import org.osbot.rs07.api.Prayer;
import org.osbot.rs07.api.Bank.BankMode;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;


import java.awt.*;

@ScriptManifest(name = "Skeleton", author = "Alek", version = 1.0, info = "", logo = "") 

public class main extends Script {
	
    @Override
  
    public void onStart() {

        //Code here will execute before the loop is started

    }
    
    private enum State {
		PRAYERPOT, OVERLOAD, WAIT
	};

   
	private State getState() {
		
		if (getSkills().getDynamic(Skill.PRAYER) < 20)
		{
			return State.PRAYERPOT;
		}
		if (getSkills().getDynamic(Skill.HITPOINTS) > 51)
		{
			return State.OVERLOAD;
		}	
		return State.WAIT;
	}
    
	public int onLoop() throws InterruptedException {
		switch (getState()) {
		
		case PRAYERPOT:
			if (getInventory().contains("Prayer potion(4)"))
			{
				inventory.getItem("Prayer potion(4)");
				mouse.click(false);
			}
			else if (getInventory().contains("Prayer potion(3)"))
			{
				inventory.getItem("Prayer potion(3)");
				mouse.click(false);
			}
			else if (getInventory().contains("Prayer potion(2)"))
			{
				inventory.getItem("Prayer potion(2)");
				mouse.click(false);
			}
			else if (getInventory().contains("Prayer potion(1)"))
			{
				inventory.getItem("Prayer potion(1)");
				mouse.click(false);
			}
			
			break;
			
		case OVERLOAD:
			if (getInventory().contains("Overload (4)"))
			{
				inventory.getItem("Overload (4)");
				mouse.click(false);
			}
			else if (getInventory().contains("Overload (3)"))
			{
				inventory.getItem("Overload (3)");
				mouse.click(false);
			}
			else if (getInventory().contains("Overload (2)"))
			{
				inventory.getItem("Overload (2)");
				mouse.click(false);
			}
			else if (getInventory().contains("Overload (1)"))
			{
				inventory.getItem("Overload (1)");
				mouse.click(false);
			}
			break;
			
		case WAIT:
			sleep(3000);
			break;
		}
		return random(200, 300);
	}
			

    @Override

    public void onExit() {

        //Code here will execute after the script ends

    }

 

    public void onPaint(Graphics2D g) {

        //This is where you will put your code for paint(s)

    }

}

 

You have to call interact(interaction name) on the item returned by getItem

Edited by Explv
Link to comment
Share on other sites

7 minutes ago, Explv said:

You have to call interact(interaction name) on the item returned by getItem

Thanks Explv, could you perhaps show me how it's used? I used my above method in a previous herb cleaning script and it worked fine!

 

maybe this?

	
				int slot = getInventory().getSlot("Prayer potion(4)");
		        getMouse().click(new InventorySlotDestination(getBot(), slot));

 

Edited by uyfgfarOS
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...