maferosrs 2 Posted June 24, 2017 Hi Guys !I have a problem :'( I'm trying to make a mining script Cooper Ore from a tutorial I'm watching on youtube, Could you please help me Thank you How do I make the character click on the rock? With what method can i do this? package Miner; import org.dreambot.api.methods.Calculations; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.wrappers.interactive.GameObject; @ScriptManifest( category = Category.FISHING, name = "PowerMine2r", author = "Mafer", version = 2.0 ) public class Miner extends AbstractScript{ private int state; private String ore; private GameObject rock; private int count; @Override public void onStart() { ore = "Copper Ore"; count = 0; state = 0; } @Override public int onLoop() { if (state == 0) { mine(); } else { if (state == 1) { drop(); } else { } } return Calculations.random(500, 1000); } private void mine(){ if(!getInventory().isFull()){ rock = getGameObjects().closest(f -> f.getName().contains("Rock")); if (rock != null){ if (rock.interact("Mine")){ sleepUntil(() -> getInventory().count(ore) > count, Calculations.random(22000,33000)); if(getInventory().count(ore) > count){ count++; } } } } else{ state = 1; } } private void drop(){ if(getInventory().contains(ore)){ getInventory().dropAllExcept(i -> i.getName().contains("pickaxe")); } else{ state =0; } } }
maferosrs 2 Author Posted June 24, 2017 if (rock.interact("Miner")){ should be "Mine" ? Thank you How can I check if the rock is empty? Just click when the rock has mineral? if(rock != null){ } package Miner; import org.dreambot.api.methods.Calculations; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.wrappers.interactive.GameObject; @ScriptManifest( category = Category.FISHING, name = "PowerMiner_6", author = "Mafer", version = 6.0 ) public class Miner extends AbstractScript{ private int state; private String ore; private GameObject rock; private int count; @Override public void onStart() { } @Override public int onLoop() { if(rock != null){ rock = getGameObjects().closest(f -> f.getName().contains("Rock")); } return Calculations.random(1, 10); } }
maferosrs 2 Author Posted June 24, 2017 You can check its color Thank you this ? rock.getModelColors()
maferosrs 2 Author Posted June 24, 2017 Dont rocks have different IDs than when they are mine-able? Sorry, I did not understand.
Soldtodie 76 Posted June 24, 2017 Sorry, I did not understand. Just use model colors and check if it returns null and if they are the rock is mined.
maferosrs 2 Author Posted June 24, 2017 Just use model colors and check if it returns null and if they are the rock is mined. I can not find Color Model in the documentation :'(
Soldtodie 76 Posted June 24, 2017 Thank you this ? rock.getModelColors() I can not find Color Model in the documentation :'( You already have it
Recommended Posts
Archived
This topic is now archived and is closed to further replies.