Everything posted by loopback
-
Good examples of anti-pattern?
Title pretty much says it all. What are some good examples of anti-pattern in code or otherwise. And does it do anything more than anti-ban for example?
-
Problem with my mining script
This is it! Thank you I knew it was something obvious. This is what I get for cleaning my hard drive at 2am then trying to recreate something from memory. Thanks
-
Problem with my mining script
So I accidentally deleted my broken mining script and am trying to re-create it from memory, and so far so good. However I am trying to check the color of the rock before I mine it and I am missing something. public enum Rock { CLAY(6705), COPPER(4645), TIN(53), IRON(2576), SILVER(74), COAL(10508), GOLD(8885), MITHRIL(-22239), ADAMANTITE(21662), RUNITE(-31437); private final short COLOUR; Rock(final int COLOUR) { this.COLOUR = (short) COLOUR; } public boolean hasOre(final RS2Object object) { if (object == null || object.getDefinition().getModifiedModelColors() == null || !"Rocks".equals(object.getName())) { return false; } for (final short colour : object.getDefinition().getModifiedModelColors()) { if (colour == this.COLOUR) { return true; } } return false; } } public void Minesomething() throws InterruptedException { goldRock = getObjects().closest( obj -> Rock.GOLD.hasOre(obj)); if (goldRock != null && goldRock.interact("Mine")) { new Sleep(() -> isAnimating() || !Rock.GOLD.hasOre(goldRock), 10000).sleep(); } } That is the code I am having trouble with, It says can not resolve symbol goldRock. And I cant remember how I had it in my original working script. Any pointers?
-
How to make ore detection more accurate?
So this is my new isMining() and It works but has uncovered 2 other problems now, One is when the rocks deplete while I was mining them then my script waits for the animation to complete. And my script can not notice when the rock gets depleted. So I need a way to check if the rock I am currently mining has been depleted and if it has then just try to find a non depleted rock ( which I have a way of doing ) I just can't check while I am mining. private boolean isMining() { if ( myPlayer().isAnimating()) { long lastAnimation = System.currentTimeMillis(); return true; } if (System.currentTimeMillis() - lastAnimation > 500) { return false; } return false; }
-
How to make ore detection more accurate?
Ok I get it now, but how would I go about implementing the 3 or so second anim check?
-
How to make ore detection more accurate?
I have that in my script already, and it checks if my player has been animating or moving. However my character still clicks 1-3 times per rock and randomly switches rocks for no reason, The ConditionalSleep has helped a bit (I am using the one from your tut) but they don't seem to solve the problem just work around it by delaying how much it happens. if (Iron != null && !isMining()) { log("chk_iron_mining"); new Sleep(() -> !Rock.IRON.hasOre(Iron) || !isMining(), 10000).sleep(); Iron.interact("Mine"); } private boolean isMining() { if (myPlayer().isAnimating() && myPlayer().getInteracting() != null && myPlayer().isMoving()) { return true; } return false; } case MINEIron: sleep(900); MineIron(); sleep(random(1250, 1600)); break; private State getState() { if (getInventory().isFull()) return State.BANK; if (!getInventory().isFull() && !isMining() && ore == 0) return State.MINECopper; if (!getInventory().isFull() && !isMining() && ore == 1) return State.MINETin; if (!isMining() && !getInventory().isFull() && ore == 2) return State.MINEIron; return State.WAIT; } Relevant code snippets. EDIT: I think one of the problems is that the animation for mining does not stop always if it has been depleted by someone else
-
How to make ore detection more accurate?
Okay so I got everything working mostly, except now my script sometimes decides to switch to another rock even though neither is depleted and my script will still click the same rock like 2 or 3 times like it spam clicking. EDIT: I am currently using sleep to get around this problem I am pretty sure it has to do with my script not knowing if it is mining\animating or not. But I have methods in my script that should cover that.
-
How to make ore detection more accurate?
Just tested, And I guess I never hovered over them fast enough to see that ID change. Well that's what I get for doing everything at 4am
-
How to make ore detection more accurate?
Ok so I have been able to get the script to not click on depleted rocks. However how would I tell it to switch rocks when someone depletes the rock while mining?
-
How to make ore detection more accurate?
I haven't been able to see it, Care to share how to get the ID's?
-
How to make ore detection more accurate?
Alright I'll be sure to give these a try a bit later on when I have the time. Thanks !
-
How to make ore detection more accurate?
As far as I have been able to see it is the same id regardless of it is mined or not. Colorpicker could work but there is a range of RGB values for a non-depleted rock, So idk how I would make that range work. Or even how to really implement a good color picker.
-
How to make ore detection more accurate?
So my mining script currently works good enough if no one is around, but once more people show up my script fails to see that the rock as already been depleted and mines it anyways by the time it figures that out and switches rocks the rock it switches to is depleted as well and then a endless cycle starts. So how can I make my script be able to know what rocks are depleted and which are not. I suppose using a color picker or something could work? but could it really work and how would you implement something like that.
-
Script will not startup at all.
Thats all the code that has anything to do with enums. But I still don't understand what you mean
-
Script will not startup at all.
What do you mean? Can you elaborate? it's late and I am just glad I got it working
- Script will not startup at all.