drchrismas 0 Share Posted March 11, 2021 Hello! I'm not the best at java nor dreambot scripting but i think it's fun to do on my own time so i just create bots for fun little projects. One thing i've ran into i can't come up with how to do is how do i return the amount of items collected? Here's my main class: package itemPickUpper; //import org.dreambot.api.methods.skills.Skill; //import org.dreambot.api.methods.skills.SkillTracker; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.impl.TaskScript; import java.awt.*; // Every script needs a ScriptManifest so it can be seen in the script manager @ScriptManifest( category = Category.MONEYMAKING, name = "something", description = "Shits out something", author = "name", version = 0.1) public class itemPickUpper extends TaskScript { public int itemsPickedUp = 0; @Override public void onStart() { // Add our tasks so the bot knows what to do addNodes(new Picker(), new Walker(), new WalkToBank(), new Banking()); log(itemsPickedUp); } /*@Override public void onPaint(Graphics g) { //heres where my paint would go IF I HAD ANY }*/ } Here's the class that picks up the items: package itemPickUpper; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.interactive.GameObjects; import org.dreambot.api.methods.map.Area; import org.dreambot.api.script.TaskNode; import org.dreambot.api.wrappers.interactive.GameObject; public class Picker extends TaskNode { private int itemsPickedUp = 0; private final Area itemArea = new Area(cordslmao1); @Override public boolean accept() { //This is used by DreamBot to decide if it should run this task's execute method. // If our inventory isn't full and we're somewhere log("Picker accepterande metod: " + (!Inventory.isFull() && itemArea.contains(getLocalPlayer()))); return !Inventory.isFull() && itemArea.contains(getLocalPlayer())); } @Override public int execute() { GameObject closestItem = GameObjects.closest("item"); // If there aren't any available items near us, we should just wait until one's available if (closestItem == null) return Calculations.random(500, 1000); if (closestItem.interact("Something")) { // If we successfully click on the rock sleepUntil(() -> getLocalPlayer().isAnimating(), 5000); sleep(Calculations.random(500,800)); itemsPickedUp += 1; } return itemsPickedUp; //return Calculations.random(500, 1000); } } The log() command isn't displaying anything at all in the console besides the first time it's running. How would i return a value that i can use in a paint? Thanks for all and any help! Link to comment Share on other sites More sharing options...
GuNCuSSioN 4 Share Posted March 12, 2021 Not sure about how to do it for paint, but I know to output to the log you could convert itemPickedUp to string and use MethodProvider.log(stringHere); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.