Hey guys,
I've had quite a few scripters attempt to use the resources folder to load stuff without having to download them manually, so I figured I'd write a quick tutorial.
(I've put this in the scripter section because I'd rather not have new scripters throwing random shit into that folder. Please limit it to image/text only).
RESOURCES Folder location:
For a script, put the resources folder in the root of the script module (I think root of the git repo works too if you want to use global resources).
IE:
dreamscripts
--> DreamChopper
--> resources
--> ValkyrIsANoob.jpg
Accessing resource from your script:
Here's a quick test script that I created and submitted to SDN to check that it works: (You can pull out the code...)
package test;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.io.*;
/**
* Created by ericthecmh on 8/26/15.
*/
@ScriptManifest(version = 1.0, author = "Ericthecmh", logo = "", info = "Amaze", name = "Llama")
public class Llama extends Script {
private BufferedReader br;
@Override
public void onStart() {
br = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("/resources/LLAMAS.DAT")));
}
@Override
public int onLoop() throws InterruptedException {
try {
String s = br.readLine();
if (s != null)
log(s);
} catch (IOException e) {
e.printStackTrace();
}
return 1000;
}z
}
I TESTED LOCALLY AND IT DOESN'T WORK???
Make sure that when you build the local jar, it contains the resources folder in the root of the jar:
DreamChopper.jar
--> resources/
--> LLAMAS.DAT
--> org
--> dreamscripts
--> chopper