Mike5674 1 Share Posted September 24, 2018 Hey all, I'm new here, and brand new to scripting. I already made a simple script to smith me steel bars in edgeville with a coal bag, and now I am working on a motherlode miner. I only want to mine in my favorite area in the mine. There's 2 sets of 3 "Ore vein", and I only want to mine these 6 veins. When my character finishes mining the first 3, he doesn't move to the next 3. If i move my character manually close to the other set of Ore vein, it continues as normal until they run out, or my inventory is full. I though about a miner that would trigger once !getLocalPlayer().isAnimating() then tell the bot to move to the middle near both sets once it reaches 0.... However I couldn't find anything anywhere telling me how to do this in plain english. Any help would be much appreciated! GameObject ore = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Ore vein")); if (mine.contains(ore) && !getInventory().isFull()) { ore.interact("Mine"); int countOre = getInventory().count("Pay-dirt"); sleepUntil(() -> getInventory().count("Pay-dirt") > countOre, 10000); return (600); } Link to comment Share on other sites More sharing options...
Mike5674 1 Author Share Posted September 24, 2018 I found a small fix. Very inefficient, but it's sort of working for now. Help would still be welcomed! case MINE: GameObject ore = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Ore vein")); if (mine.contains(ore) && !getInventory().isFull()) { ore.interact("Mine"); int countOre = getInventory().count("Pay-dirt"); sleepUntil(() -> getInventory().count("Pay-dirt") > countOre, 10000); return(600); } if (!center.contains(getLocalPlayer())) { sleep(20000); getWalking().walkExact(center.getCenter()); return(2000); } break; I added that second bit. I defined a center then told it to move there after 20 seconds.. sort of.. It puts it to sleep so it misses a few veins sometimes. Link to comment Share on other sites More sharing options...
Stormscythe 263 Share Posted September 24, 2018 Does the Debug Console provide any errors when the script is "freezing" and not moving on? Link to comment Share on other sites More sharing options...
Mike5674 1 Author Share Posted September 27, 2018 On 9/24/2018 at 7:17 AM, Stormscythe said: Does the Debug Console provide any errors when the script is "freezing" and not moving on? No it does not. The script seems to be running fine, I am unsure what the issue is. But after watching it work when it returns to the center position it looks like it can only see the half of the ore on the side the character is on, or both if standing in the center. I am sure it's just something to do with my method of interacting with the ore. I finally "finished" it though! So im pretty happy about it, being my first real script and all. Learned A LOT. Link to comment Share on other sites More sharing options...
Stormscythe 263 Share Posted September 27, 2018 A good thing is to check if the object is on screen, and if not, rotate the camera to it. Link to comment Share on other sites More sharing options...
Mike5674 1 Author Share Posted October 5, 2018 On 9/27/2018 at 2:18 AM, Stormscythe said: A good thing is to check if the object is on screen, and if not, rotate the camera to it. I'm garbage at responding lol. Yea that is going to be one of the next things I implement is a semi fixed camera position. I find I have to manually adjust to prevent the bot from mining on the other side of the wall. Been making great strides in this bot though. Even took some time from it and will be back at it soon fixing some minor bugs and adding Paint and maybe a GUI too once I learn how. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.