BeepBoopBop 9 Share Posted May 7, 2022 Hey folks, I was looking into how to better organize my projects for local script development, and Pandemic pointed me in the direction of Libraries (thank you!). Since there's very little documentation about how to go about doing this, I figured I'd walk through what I did to get it working. First, why use libraries? We all probably have some utility classes that we'd like to be available for all of our local scripts. For example, I have "Banker", "Walker", and "Talker" classes. Wouldn't it be great if these were available in all of my projects without having to copy/paste changes to all of my local scripts whenever I make a change? That's what libraries accomplish. Here's a list of steps I went through. This is going by memory, so apologies if I miss something crucial. Create a new DreamBot project. Its title should be the library title (E.g. mine is "BeepLibrary"). It doesn't need a main class, since we're not executing anything! Move all of your classes to the "Src" folder of this new project. If there are build errors, ensure you've imported the DreamBot library, and included all required classes. Go into Project Structure for your library project. Set the output directory to the "<Users>\...\DreamBot\Libs" folder. Build your project. You should see the jar file in the Libs directory. Open Project Settings for your local script projects. Add a new library - the .jar file you've exported to the Libs folder. Build your local script. If there are compile errors, you've done something wrong. You're almost there! In your local script's "src/" folder, create a file named "libs". In that file, the only line of text should be the name of the library you've created in step 1. As an example, my libs file contains "BeepLibrary.jar". Build your local script. Ensure no compile errors. Open the script manager. If the local script appears, you're good! Otherwise, open the Console and see if you can figure out where you've gone wrong. Happy scripting! Pandemic and pharaoh 2 Link to comment Share on other sites More sharing options...
pharaoh 130 Share Posted January 15, 2023 so to confirm, this only works for local script development? for example, owning a private script shop then using that project together with the library to reuse that code locally? Link to comment Share on other sites More sharing options...
BeepBoopBop 9 Author Share Posted January 21, 2023 Haven't done much dev over the last two months, but I believe so. SDN doesn't support libraries in separate projects. You'll need to copy/paste the *.java files from your local libraries and include them with your SDN commit. Link to comment Share on other sites More sharing options...
pharaoh 130 Share Posted February 13, 2023 On 1/21/2023 at 9:03 AM, BeepBoopBop said: Haven't done much dev over the last two months, but I believe so. SDN doesn't support libraries in separate projects. You'll need to copy/paste the *.java files from your local libraries and include them with your SDN commit. No worries, this is the conclusion I ended up at as well. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now