Axolotl 31 Posted August 18, 2021 Hey everyone, Part of the functionality I am implementing in my quest system is a quest log reader. I couldn't seem to find a function on the javadocs for me to get quest progress aside from started, finished and invalid. Therefore I created a function to read the log and interpret its current progress. (I am also using items / locations to determine, but that isn't always accurate and leads to odd behaviour when resuming a quest mid completion). The main issue I'm having is getting the bot to scroll through the quest book until it reaches the desired quest I want to interact with. I am using WidgetChild to find the quest location, ex: FreeQuest.ROMEO_AND_JULIET.getWidgetChild(); If the quest is already scrolled to my function works, but I can't seem to get it to scroll to it as checking for: FreeQuest.ROMEO_AND_JULIET.getWidgetChild().isVisible(); Will always return true, even when its not visible. Likewise, calling: if(FreeQuest.ROMEO_AND_JULIET.getWidgetChild().interact()) Will result in the bot moving mouse to the bottom of quest's and not scrolling as it thinks its on screen and intractable (it wont pass in the if, but it tries...) I created a function for testing purposes to see what is going on: public static void PositionCheck(FreeQuest quest) { if(Tabs.isOpen(Tab.QUEST)) { WidgetChild questData = quest.getWidgetChild(); if(questData != null) { log("Mouse position: " + Mouse.getPosition()); log("Quest data position: " + questData.getRectangle()); log("Quest data contains mouse: " + questData.getRectangle().contains(Mouse.getPosition())); } } } When my mouse is overtop of the quest, it will print true, which is amazing. The only issue is when I attempt to scroll to it, it scrolls way too fast and the condition is never met: Mouse.scrollUntil(false, 3000, () -> questData.getRectangle().contains(Mouse.getPosition())); Any advice you can give me to figure this out would be amazing. Thank you EDIT: I have found a solution. Maybe add a function to client for other people and have it be like: Class: Quests Function: public static boolean isVisible(FreeQuest quest) { WidgetChild questData = quest.getWidgetChild(); return questData.getRectangle().y >= 278 && questData.getRectangle().y <= 413; } Probably gotta make 3 versions for free/paid/mini Using the scrollUntil works if the condition is: Mouse.scrollUntil(false, 6000, () -> questData.getRectangle().y >= 278 && questData.getRectangle().y <= 413);
SubCZ 284 Posted August 18, 2021 There's no need to open the quest log, pretty much every quest log change corresponds to a Varbit and PlayerSetting change. Check the game explorer (CTRL + G), PlayerSettings#getBitValue, and this post That aside, the issue with your scrolling function is that isVisible just checks that property of the widget and it might still be hidden in other ways (such as being outside of the scolling container). You should be checking the bounds of the widget you are trying to scroll to against the bounds of the container widget for this.
Axolotl 31 Author Posted August 18, 2021 @SubCZ Thank you for the suggestions and feedback! Thats very helpful, I didn't even know about the Game Explorer lol. I have many years of coding experience, but still learning the optimal ways around dreambot. Those Varbits and Player Settings look quite confusing though, I'm assuming I'd need to do the quest manually and watch the changes and record the values? I already got the algorithm working for opening and using quest logs for progress so not sure if it worth switching or not lol. I'm not opposed to switching, but I don't mind the quest log opening as it does look quite humanlike anyways xD Ahh that makes a lot of sense, I had a feeling it was doing something like that as when you scroll on the quest tab the widget moves up and the rect values of each quest widget changes. Just used simple math to isolate it once I noticed that. Not sure if this is the right spot to post it or if I should make a new thread but I found a bug in the function: .isFinished() If your mouse is hovering over top of the quest within the quest tab when you call the isFinished function it will ALWAYS return true, even if the quest isn't started.
abuseedom3 4 Posted August 19, 2021 Point p = new Point(Widgets.getChildWidget(399, 4).getChild(0).getX() + 5 + (new Random().nextInt(5)), Widgets.getChildWidget(399, 4).getChild(0).getY() + 12 + (new Random().nextInt(6))); if (Widgets.getChildWidget(399, 4).getChild(1).getY() < 232) { getMouse().click(p); sleep(2000, 3000); } Put that before clicking your quest, you're welcome
Recommended Posts
Archived
This topic is now archived and is closed to further replies.