Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • drinking prayer potion bugs for some unknown reason?


    crezzy

    Recommended Posts

    Hey guys, I'm just making a simple script to drink prayer potions and use special attack so I can afk NMZ whilst I play the ps4. Thought it should be really simple and it is really (done it with other bot clients in the past years) but however, for some unknown reason to me it starts off working fine, drinking prayer pots (drank 3 before i died last run) and use special attack but then after 3 prayer potions in the last run it didn't drink anymore and my player just died?

    Any idea why this is happening?

    code:

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.skills.Skill;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    
    @ScriptManifest(author = "Crezzy", name = "drink p pots", version = 1.0, description = "drinks prayer potions", category = Category.COMBAT)
    public class Main extends AbstractScript {
    
    	@Override
    	public int onLoop() {
    		int sleep = Calculations.random(1000, 3000);
    		int prayerPotsID[] = { 139, 140, 141, 142, 143, 144 };
    		if (getSkills().getBoostedLevels(Skill.PRAYER) <= (10 + Calculations.random(8))) {
    			for (int i = 0; i < 6; i++) {
    				getInventory().interact(prayerPotsID[i], "Drink");
    				log("Drinking p pot");
    			}
    		}
    
    		if (getCombat().getSpecialPercentage() >= 50)
    			getCombat().toggleSpecialAttack(true);
    
    		return sleep;
    	}
    
    }
     

    Thanks in-advanced!

     

    Edit: 

    fixed by using a while loop instead of an if statement. Resulting in:

    public int onLoop() {
    		int sleep = Calculations.random(1000, 3000);
    		while (getSkills().getBoostedLevels(Skill.PRAYER) <= Calculations.random(10, 22)) {
    			getInventory().interact(item -> item != null && item.getName().contains("Prayer potion"), "Drink");
    			log("Drinking prayer potion.");
    			sleep(sleep);
    		}
    		if (getCombat().getSpecialPercentage() >= 50)
    			getCombat().toggleSpecialAttack(true);
    
    		return sleep;
    	}
    
    Link to comment
    Share on other sites

    just interact witth a potion that contains Prayer it its name 


    m.getInventory().interact(p -> p != null && p.getName().contains("Prayer potion"), "Drink");
    
    Link to comment
    Share on other sites

     

    just interact witth a potion that contains Prayer it its name 

    m.getInventory().interact(p -> p != null && p.getName().contains("Prayer potion"), "Drink");
    

    I tried that way on my 1st attempt but however it didn't do anything /= I'll try again now though.

     

    Edit: Just behaves the same as previous /=

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.