August 26, 201510 yr 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
August 26, 201510 yr You should probably test it with dreamscripts --> resources --> SuckMyDick.jpg --> ShitChopper --> buggysource
August 26, 201510 yr Nice tutorial maybe you could elaborate where the data is saved on the HDD and maybe add a part about storing data.
March 7, 20187 yr 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.
March 7, 20187 yr 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.
March 7, 20187 yr 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, 20187 yr by battleguard
March 8, 20187 yr 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.
Create an account or sign in to comment