jex124 0 Share Posted January 25, 2021 On 24/01/2021 at 5:49 PM, jex124 said: 3 hours ago, Neffarion said: Yes You should try to do it as I did in the example in the main post, that way you can do only scan -> compare -> sleep (the first time it runs it won't trigger anything but that isn't really relevant as it is runs often, and you are probably not needing it at that point so early) For your problem I wouldn't personally use a listener as you can just save the npc when you attack and check for movement while you wait for it to kill it Thank you @Neffarion, following your recommentations I got it working, use of wrapper meant my thread sleep is at the correct place, I get a clean set of data to use in my main script. Although in your example I am not sure why you @override equal method, I guess it is to add a few more boolean equality checks? I learned a lot from your tutorial, gracias! Link to comment Share on other sites More sharing options...
Neffarion 486 Author Share Posted January 25, 2021 6 minutes ago, jex124 said: Thank you @Neffarion, following your recommentations I got it working, use of wrapper meant my thread sleep is at the correct place, I get a clean set of data to use in my main script. Although in your example I am not sure why you @override equal method, I guess it is to add a few more boolean equality checks? I learned a lot from your tutorial, gracias! Your welcome Yes, its cleaner and simply moves some of that "irrelevant" code from the event listener logic to the wrapper Link to comment Share on other sites More sharing options...
Kristoffer 24 Share Posted June 23, 2021 I copied this entire script without changes except for private boolean canVerify() { return Client.isLoggedIn() && new RandomManager(new Thread(), new Script()).isSolving() Which I don't think changes anything anyway, but I'm not getting the message when buying an item from the GE. I tried checking if it's reaching the code that is supposed to check for changes while (!shouldStop() && canRun()) { MethodProvider.log("Here"); if (canVerify()) { MethodProvider.log("Reached"); current = fetchItems(); And it's not reaching it My code other than the first snippet which I had to change because of the API changes is the exact same as yours, any ideas? Link to comment Share on other sites More sharing options...
Neffarion 486 Author Share Posted June 23, 2021 1 hour ago, Kristoffer said: I copied this entire script without changes except for private boolean canVerify() { return Client.isLoggedIn() && new RandomManager(new Thread(), new Script()).isSolving() Which I don't think changes anything anyway, but I'm not getting the message when buying an item from the GE. I tried checking if it's reaching the code that is supposed to check for changes while (!shouldStop() && canRun()) { MethodProvider.log("Here"); if (canVerify()) { MethodProvider.log("Reached"); current = fetchItems(); And it's not reaching it My code other than the first snippet which I had to change because of the API changes is the exact same as yours, any ideas? What's with this? Whats it for new RandomManager(new Thread(), new Script()).isSolving() Link to comment Share on other sites More sharing options...
Kristoffer 24 Share Posted June 23, 2021 It's from the canVerify method private boolean canVerify() { return script.getClient().isLoggedIn() && !script.getRandomManager().isSolving() && script.getLocalPlayer() != null && script.getLocalPlayer().exists(); } I changed it because it's still using non-static methods. I'm not sure if it's relevant, I mainly mentioned it because that's the only thing I changed from your code. Link to comment Share on other sites More sharing options...
Kristoffer 24 Share Posted June 23, 2021 I'm probably doing something wrong there but again it doesn't matter because while (!shouldStop() && canRun()) { MethodProvider.log("Here"); also doesn't run which is the same as your code. Link to comment Share on other sites More sharing options...
Neffarion 486 Author Share Posted June 23, 2021 50 minutes ago, Kristoffer said: It's from the canVerify method private boolean canVerify() { return script.getClient().isLoggedIn() && !script.getRandomManager().isSolving() && script.getLocalPlayer() != null && script.getLocalPlayer().exists(); } I changed it because it's still using non-static methods. I'm not sure if it's relevant, I mainly mentioned it because that's the only thing I changed from your code. 47 minutes ago, Kristoffer said: I'm probably doing something wrong there but again it doesn't matter because while (!shouldStop() && canRun()) { MethodProvider.log("Here"); also doesn't run which is the same as your code. Ah yes, this was made before DB3. I have updated the code (and git), also made few slight changes. It works fine now Link to comment Share on other sites More sharing options...
Kristoffer 24 Share Posted June 23, 2021 Have you tested it and confirmed it's working? Link to comment Share on other sites More sharing options...
Neffarion 486 Author Share Posted June 23, 2021 Just now, Kristoffer said: Have you tested it and confirmed it's working? Yes. Its working Link to comment Share on other sites More sharing options...
Kristoffer 24 Share Posted June 23, 2021 You're right, I copy pasted your code and it works. I then used a diff tool to check for differences with mine and found no significant differences, yet mine still doesn't work. I guess it will remain a mystery for now. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.