Jump to content

Local and SDN Resource Loading


Alek

Recommended Posts

OSBot has a Script method called getScriptResourceAsStream; its purpose is to write code once no matter if the script is in a jar, zip, class files, local, or on the SDN. Namely, this topic will show you how to set up your packaging for compatibility between local and SDN resource loading.

Since the SDN requires a specific package structure, your local project will need to be the same. The format is:

ModuleName/src,resources/files

For instance:

MacroSlayer/src/Main.java
MacroSlayer/resources/image.png

For instance, this is what it should look like:
image.png.022e9a60671d18b3d87d10413c4637ea.png

 

Now the InputStream returned from getScriptResourceAsStream should be of the following format:

 

getScriptResourceAsStream("resources/image.png")


For instance, this user's script has this code which works both locally and on the SDN:

image.png.95e116bc29443baf22572ea95991df52.png

 

Using this method will simplify your development process when using resources.

 

  • Like 12
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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