uyfgfarOS Posted March 9, 2017 Posted March 9, 2017 Hello all, had a big break from scripting and getting back into it again. Simply, how would I check the players prayer & hp? Just working on a personal NMZ bot to pot up when prayer falls below a certain parameter, then to use overload when HP is above a certain parameter. Cheers 1
Chris Posted March 9, 2017 Posted March 9, 2017 getSkills.getStatic to get non boosted level getskills.getDynamic to get a skill that is changing (boosted or stas r weakend etc) 1
Khaleesi Posted March 9, 2017 Posted March 9, 2017 Just now, Chris said: getSkills.getStatic to get non boosted level getskills.getDynamic to get a skill that is changing (boosted or stas r weakend etc) this^
uyfgfarOS Posted March 9, 2017 Author Posted March 9, 2017 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) } }
Explv Posted March 9, 2017 Posted March 9, 2017 (edited) 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 March 9, 2017 by Explv
uyfgfarOS Posted March 9, 2017 Author Posted March 9, 2017 (edited) 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 March 9, 2017 by uyfgfarOS
Prozen Posted March 9, 2017 Posted March 9, 2017 3 minutes ago, uyfgfarOS said: 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! getInventory().getItem("Bronze pickaxe").interact("Use"); Although just doing getInventory().interact("Use", "Bronze pickaxe"); works.
DrDu Posted March 9, 2017 Posted March 9, 2017 2 minutes ago, uyfgfarOS said: 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! getInventory().interactWithNameThatContains("Drink", "potion");
uyfgfarOS Posted March 9, 2017 Author Posted March 9, 2017 Sorted now, thankyou everyone for your help.