Jump to content

OSBot 2.5.4 - Resource Loading


Alek

Recommended Posts

Download Link: https://osbot.org/devbuilds/osbot 2.5.4.jar

 

I've been getting a lot of questions about this lately and it seems that there's confusion over how loading resources works. Java is a little tricky when it comes to this as loading resources from a jar is different than loading resources that are not in a jar. I've went ahead and wrote some methods to make everyone's lives a bit easier, so you can write the same code no matter if its an SDN script, a Jar script, Zip script, or just the class files.

Script getScriptResourceAsStream - This loads resources relative to the entry of the script
Script getDataResourceAsStream - This loads resources relative to the entry of the OSBot data directory

Here are two examples so you get an idea:

 

ztfC9pq.png

 

x5gt9d6.png

 

Of course please ensure you are still following the existing SDN resources folder rules. 

This is an experimental build, please let me know if this helps.

  • Like 10
  • Boge 1
  • Mald 1
Link to comment
  • Alek locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...