Cory Posted September 12, 2013 Share Posted September 12, 2013 Wrote a small API and any methods i used or needed i added to it, built up a collection, I start university on monday so figured i would release it it for you lot to use/learn from etc. Javadocs: http://novumscripts.com/api/ Src: https://github.com/NovumScripts/CoryAPI Jar: https://www.dropbox.com/s/6z7nbjjnd19yu5i/API.jar Src Download: https://www.dropbox.com/s/4c6wyxa6vcg72fp/osbot.zip Thanks are appreciated, any suggestions or changes, or additions you feel should be added, let me know. P.S: I'm not saying its immaculately programmed, or that I've used the best techniques etc, just a collection of handy methods for you to use. 5 Link to comment Share on other sites More sharing options...
5uck Posted September 12, 2013 Share Posted September 12, 2013 thanks, will take a look at this if I hit a wall good luck at school! *Back to school....Back to school...to prove to dad, that i'm not a fool...* 1 Link to comment Share on other sites More sharing options...
03storic Posted September 12, 2013 Share Posted September 12, 2013 Man you are a legend for releasing this, i'm sure if other people contribute their method it will become the ultimate scripting aid. Link to comment Share on other sites More sharing options...
Mr Asshole Posted September 12, 2013 Share Posted September 12, 2013 I love you. No homo Link to comment Share on other sites More sharing options...
Bake me a cake Posted September 12, 2013 Share Posted September 12, 2013 LinkedList<NPC> valid = new LinkedList<NPC>(); just a few tips you should use an ArrayList for this, LinkedLists use up too much memory, and it should be used if you were going to add and remove (LinkedLists are faster than ArrayLists for removing), in this case you were only adding. Link to comment Share on other sites More sharing options...
Th3 Posted September 12, 2013 Share Posted September 12, 2013 Cool api Link to comment Share on other sites More sharing options...
Superman Posted September 12, 2013 Share Posted September 12, 2013 Thanks! Link to comment Share on other sites More sharing options...
BotRS123 Posted September 13, 2013 Share Posted September 13, 2013 I'll check it out over the weekend. Always nice to see how a good programmer programs Link to comment Share on other sites More sharing options...
Sam Posted September 13, 2013 Share Posted September 13, 2013 LinkedList<NPC> valid = new LinkedList<NPC>(); just a few tips you should use an ArrayList for this, LinkedLists use up too much memory, and it should be used if you were going to add and remove (LinkedLists are faster than ArrayLists for removing), in this case you were only adding. But ArrayList#add is O(n) worst case (when it has to resize) and LinkedList is constant time for adding. However if you're going to critique his List implementation of choice I think a far better suggestion would be for him to program to the interface not the implementation. @Cory, MethodContext should extend MethodProvider not Script (a MethodContext is not a script) By making the fields public in your MethodContext you have made your API brittle. What if you decide to make MethodContext thread-safe or perform additional checks before returning a field? You can't without breaking people's code. This is why encapsulation is important. I'm not sure why you named your package impl - what is it an implementation of? I would suggest documenting all your classes - I'm not sure what the ObstacleListener's purpose is. Those are my suggestions from a brief look. Hope it helps. Link to comment Share on other sites More sharing options...
Cory Posted September 13, 2013 Author Share Posted September 13, 2013 LinkedList<NPC> valid = new LinkedList<NPC>(); just a few tips you should use an ArrayList for this, LinkedLists use up too much memory, and it should be used if you were going to add and remove (LinkedLists are faster than ArrayLists for removing), in this case you were only adding. But ArrayList#add is O(n) worst case (when it has to resize) and LinkedList is constant time for adding. However if you're going to critique his List implementation of choice I think a far better suggestion would be for him to program to the interface not the implementation. @Cory, MethodContext should extend MethodProvider not Script ( I would suggest documenting all your classes - I'm not sure what the ObstacleListener's purpose is. Those are my suggestions from a brief look. Hope it helps. Thanks, a lot of this I already knew and was aware off. A lot of the code released was simply quick fixes or methods i wrote and never really adapted. My intentions were to get them working, regardless of whether i was using best practices as i do most of my programming on scripts late at night, when im tired at like 6am before i go to sleep. I do plan to go over everything and fix all the issues that im aware off with the way i have done certain things, but atm im getting ready for 2nd year of university etc so working on a scripting api isn't high on my priority list Link to comment Share on other sites More sharing options...
liverare Posted September 14, 2013 Share Posted September 14, 2013 This is helpful! I didn't realize client#getCurrentRegion()#getObjects() existed. Now I have my own ObjectX class that has convenient functions–like yours, except mine's tailored more towards my needs! So, thanks for that! Link to comment Share on other sites More sharing options...