k0ni Posted January 25, 2023 Share Posted January 25, 2023 So im writing a script that trains couple skills randomly, but its not functioning properly at all. Here are some things that arent working properly: -When mining, my sleepUntil never escapes on condition (checking both mined rocks ids on that position or player animation) -Detects that it doesnt have pickaxe, runs to bank (printing on logger), logger says that it arrived to the destination (osbots print), and 70% of the time it does a 360 and starts running to the mining area, while still printing "Going to bank" -Not sure about this, gonna have to recheck it later, but the getWalking().webwalk(bank1, bank2) might made me walk to the 2nd closest bank -Config 43 returns 4, while on config debugger its 100 (either air strike or a magic spell selected on attack tab) -Config 108 returns 3, while on debugger its 11 (same as above) if dangerArea contains player // run to tile x else if... else if trainingArea contains player // attack npc else // walk to trainingArea it does its thing, then attacks the npc, ignores the sleepUntil, and runs to tile x. On the same loop above the npc.interact(), the distance between player and danger returns around 90, and if he was infact in the dangerArea it shouldnt even skip the first if. I need help, ive been working for like 3 days on that, and im just trashing my code and filling it with random comments. Ive got no idea whats wrong or what to do Quote Link to comment Share on other sites More sharing options...
ExtraBotz Posted January 25, 2023 Share Posted January 25, 2023 (edited) It sounds like you're having trouble with your onLoop() cycling before you've finished your task. Some events such as web walking have built-in break handlers and other methods require you to implement your own sleeps. I would recommend logging more output to see exactly what's going on. If you see code triggering before you're done processing a method that's a good indicator that you need to add a sleep there. Your logic is also extremely important. If a method returns a boolean, but you're not using that value anywhere that is something you should consider. Ask yourself exactly what a method is doing and what the output is. I think you may be using some methods with good intentions, but they might not work exactly how you think they do. For example: getWalking().webwalk(bank1, bank2) according to the api "Walks to closest reachable destination area". Edited January 25, 2023 by ExtraBotz 1 Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted January 25, 2023 Share Posted January 25, 2023 (edited) 9 hours ago, k0rd said: So im writing a script that trains couple skills randomly, but its not functioning properly at all. Here are some things that arent working properly: -When mining, my sleepUntil never escapes on condition (checking both mined rocks ids on that position or player animation) -Detects that it doesnt have pickaxe, runs to bank (printing on logger), logger says that it arrived to the destination (osbots print), and 70% of the time it does a 360 and starts running to the mining area, while still printing "Going to bank" -Not sure about this, gonna have to recheck it later, but the getWalking().webwalk(bank1, bank2) might made me walk to the 2nd closest bank -Config 43 returns 4, while on config debugger its 100 (either air strike or a magic spell selected on attack tab) -Config 108 returns 3, while on debugger its 11 (same as above) if dangerArea contains player // run to tile x else if... else if trainingArea contains player // attack npc else // walk to trainingArea it does its thing, then attacks the npc, ignores the sleepUntil, and runs to tile x. On the same loop above the npc.interact(), the distance between player and danger returns around 90, and if he was infact in the dangerArea it shouldnt even skip the first if. I need help, ive been working for like 3 days on that, and im just trashing my code and filling it with random comments. Ive got no idea whats wrong or what to do Pretty sure most of these issues are just flawed script logic, if you provide some of you code I can take a look at it. The webwalker doesn't always generate the shortest path, so if one bank is a little bit further it might be the closest at some points Edited January 25, 2023 by Khaleesi 1 Quote Link to comment Share on other sites More sharing options...
k0ni Posted January 25, 2023 Author Share Posted January 25, 2023 Forgot to mention that im scripting for couple of years now, just not on osbot. So i knew for a fact that it wanst a logical error, and thats why i was so confused. After cleaning my code from all the mess i had created, i noticed that my dumbass had forgot to put a break on a couple of swiches. From what i recall, my ide was giving errors in such a case, but it didnt (guess i could remember wrong). Script is finally working, thanks for the quick replyies Quote Link to comment Share on other sites More sharing options...