MasterOfData Posted January 2, 2019 Share Posted January 2, 2019 Hi folks, I pulled down an open source AIO script and am looking to make modifications and additions as a learning process... With that said, how are folks debugging their scripts? JUnit testing or just loading them up in the client and trying to pick apart the logs? Also if I have a rather complicated script, should I be exporting it as a JAR and importing that JAR as a script, or is the a more streamlined build process? Quote Link to comment Share on other sites More sharing options...
NoxMerc Posted January 2, 2019 Share Posted January 2, 2019 I personally try and make functions as independent as possible so that I can create mini utilities in my script to test out individual methods, like this Short of that, the logger is your friend, and you should use it frequently to pick apart the brain of your script. I use the actual debugger as a last resort. You can connect it by starting the client with -debug 5005 arguments, and attaching your IDE to the remote process. I use it as a last resort because it tends to error out on me after a few reloads of the script, and I have to restart the client again. I export JARs straight to my OSBot scripts directory. My IDE complains about overwriting files, but it works anyways. 1 Quote Link to comment Share on other sites More sharing options...
MasterOfData Posted January 2, 2019 Author Share Posted January 2, 2019 Ah.. Attaching the debugger to the client would actually save me a lot of time. I'm debugging this OSS project and it's pretty brittle. There are many uncaught errors that crash the entire client (even the debugger console) so I can't read the whole stack trace after it crashes.. To be clear, how does the IDE attach to the client in such a way that my script will show up as an option? I'm not familiar with how I would inject the debugger into the execution of the JAR. Would attaching the IDE directly to the client allow the client to read and recognize the script over the stream? Quote Link to comment Share on other sites More sharing options...
NoxMerc Posted January 3, 2019 Share Posted January 3, 2019 (edited) 2 hours ago, Master Of Hash said: To be clear, how does the IDE attach to the client in such a way that my script will show up as an option? I'm not familiar with how I would inject the debugger into the execution of the JAR. Would attaching the IDE directly to the client allow the client to read and recognize the script over the stream? Correct. https://i.imgur.com/atkvEgw.png Edited January 3, 2019 by NoxMerc Quote Link to comment Share on other sites More sharing options...
MasterOfData Posted January 3, 2019 Author Share Posted January 3, 2019 Perfect.. Worked like a charm. Thanks! Quote Link to comment Share on other sites More sharing options...
NoxMerc Posted January 3, 2019 Share Posted January 3, 2019 Best of luck with your scripts. If you need help, hop on the discord. I'm there almost 24/7, and nobody asks about scriptwriting anymore :c Quote Link to comment Share on other sites More sharing options...