Realistic 20 Posted August 29, 2020 Hi all, I am a relatively experienced Python developer learning Java and building my first DreamBot script! I have been looking at a bunch of example scripts and have notices that when building vs the DB3.0.0 JAR a lot of the DB API used in the scripts is considered deprecated. For example: getNpcs() getWidgets() For widgets I am using Widgets.getWidget(123) instead. Is this the correct way to do it? I am still struggling to find the best way to interact with NPCs not using the getNpcs() method. Can anyone point me to the new best practices? Is there any documentation about the 3.0.0 API deprecations? Thanks all, Realistic
Pandemic 2853 Posted August 29, 2020 That's correct, we plan on adding a more detailed post later with future deprecation info and dates of removal. Our API is now static, so instead of using getNpcs() you can access the methods through the NPCs class directly: // DB2: getNpcs().closest("Man").interact("Attack"); // DB3: NPCs.closest("Man").interact("Attack"); This allows you to more easily use the API in other classes without needing to pass around our MethodContext. Hope that helps!
Realistic 20 Author Posted August 29, 2020 Perfect! Thank you Pandemic. While work my way through building a bot I am writing some "Docs for Noobs like me" that answer some questions I have had. I am using DB3 (TaskScript), and I am planning on releasing the source code. I chose a tutorial island bot (There is already 1 open source tut bot, but it is 2.x based and not a TaskScript) as it uses most major features. Walking (no web), NPC interaction, combat, cooking, item interaction, dialog traversing, widget interaction, etc... What would the best way to release the source code be? I have it in a private Github repo right now. Is it considered ok to release the source code of an entire script like this? Would anyone be willing to do a small Code Review on it before I make a post that could include some not so best practices? Thank you, Realistic P.S. Is it possible to edit posts? I can't find a way to do it...
RipperX 2 Posted August 30, 2020 I'm also dabbling in Java right now. I'm not experiences enough to clean-up code or give advice. Speaking of API deprecations, does anyone know why it telling me that getWalking is deprecated? Does anyone have an example on how to get around that, I searched the forums a bit but couldn't find a post other than this one. I can post on a separate topic if need be.
Realistic 20 Author Posted August 30, 2020 2 hours ago, RipperX said: I'm also dabbling in Java right now. I'm not experiences enough to clean-up code or give advice. Speaking of API deprecations, does anyone know why it telling me that getWalking is deprecated? Does anyone have an example on how to get around that, I searched the forums a bit but couldn't find a post other than this one. I can post on a separate topic if need be. From what Pandemic said all the getX methods that used to be inherited from MethodContext are now classes. So for walking it would be: import org.dreambot.api.methods.map.Tile; Walking.walkOnScreen(new Tile(3092,3103,0)); to walk to a tile on your screen.
Realistic 20 Author Posted August 30, 2020 Here is the walking javadoc https://dreambot.org/javadocs/org/dreambot/api/methods/walking/impl/Walking.html
Pixel_Life 24 Posted August 31, 2020 4 hours ago, Realistic said: Here is the walking javadoc https://dreambot.org/javadocs/org/dreambot/api/methods/walking/impl/Walking.html Just so you know, the DB3 Javadoc's are here https://dreambot.org/javadocs/3/org/dreambot/api/methods/walking/impl/Walking.htmlhttps://dreambot.org/javadocs/3/
LordJashin32 54 Posted September 14, 2020 This is the link that saved my butt when trying to figure out what changed. https://dreambot.org/javadocs/3/deprecated-list.html
RSMasterGuard 20 Posted May 9, 2022 On 8/29/2020 at 12:41 PM, Pandemic said: That's correct, we plan on adding a more detailed post later with future deprecation info and dates of removal. Our API is now static, so instead of using getNpcs() you can access the methods through the NPCs class directly: // DB2: getNpcs().closest("Man").interact("Attack"); // DB3: NPCs.closest("Man").interact("Attack"); This allows you to more easily use the API in other classes without needing to pass around our MethodContext. Hope that helps! Did this post ever happen, I am guess tabs is one of these and I just sent a few hours screaming at my computer using gettabs vs tabs...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.