Ericthecmh Posted August 26, 2015 Share Posted August 26, 2015 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 8 Quote Link to comment Share on other sites More sharing options...
Eliot Posted August 26, 2015 Share Posted August 26, 2015 Thank you Based Llama God. 1 Quote Link to comment Share on other sites More sharing options...
Valkyr Posted August 26, 2015 Share Posted August 26, 2015 You should probably test it with dreamscripts --> resources --> SuckMyDick.jpg --> ShitChopper --> buggysource 2 Quote Link to comment Share on other sites More sharing options...
Joseph Posted August 26, 2015 Share Posted August 26, 2015 Sweet tutorial Quote Link to comment Share on other sites More sharing options...
Okabe Posted August 26, 2015 Share Posted August 26, 2015 Nice tutorial maybe you could elaborate where the data is saved on the HDD and maybe add a part about storing data. 1 Quote Link to comment Share on other sites More sharing options...
battleguard Posted March 7, 2018 Share Posted March 7, 2018 I have followed every step in this tutorial and have verified the resource file is in the right spot on the jar and have tried this with a non osbot jar and everything works, but I cannot get this working in OSBOT at all. My guess is there has been security permissions that have changed this this post was made. Can anyone verify this still works because I have tried everything. Quote Link to comment Share on other sites More sharing options...
d0zza Posted March 7, 2018 Share Posted March 7, 2018 18 minutes ago, battleguard said: I have followed every step in this tutorial and have verified the resource file is in the right spot on the jar and have tried this with a non osbot jar and everything works, but I cannot get this working in OSBOT at all. My guess is there has been security permissions that have changed this this post was made. Can anyone verify this still works because I have tried everything. The new directory is OSBot\data. You can get this directory in your script by doing getDirectoryData() and then concatenate the file name onto that. 1 Quote Link to comment Share on other sites More sharing options...
battleguard Posted March 7, 2018 Share Posted March 7, 2018 (edited) 1 hour ago, d0zza said: The new directory is OSBot\data. You can get this directory in your script by doing getDirectoryData() and then concatenate the file name onto that. the problem with the Osbot\data folder is I want to be able to bake resources into my jar so I do not have to download all the files off the web and put the cached version into the osbot\data folder. For example if I had images for my paint it would be nice to just put them in my resources folder instead of having to store them online and then download them when I want to run the script. Sure once I run it once I could cache them in the users osbot\data folder but I would rather not have to do that. Also if that is the case now that OSBOT/data is supposed to be used for now on hopefully one of the mods can remove this sticky it might save some other scripter a couple hours of headache. Edited March 7, 2018 by battleguard Quote Link to comment Share on other sites More sharing options...
d0zza Posted March 8, 2018 Share Posted March 8, 2018 34 minutes ago, battleguard said: the problem with the Osbot\data folder is I want to be able to bake resources into my jar so I do not have to download all the files off the web and put the cached version into the osbot\data folder. For example if I had images for my paint it would be nice to just put them in my resources folder instead of having to store them online and then download them when I want to run the script. Sure once I run it once I could cache them in the users osbot\data folder but I would rather not have to do that. Also if that is the case now that OSBOT/data is supposed to be used for now on hopefully one of the mods can remove this sticky it might save some other scripter a couple hours of headache. Yeah just put the images into your Osbot\data folder and you'll be able to use them. Quote Link to comment Share on other sites More sharing options...