crezzy 0 Share Posted March 20, 2018 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 More sharing options...
Nex 2542 Share Posted March 20, 2018 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 More sharing options...
crezzy 0 Author Share Posted March 20, 2018 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.