Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Tutorial Adding to the Web from a file

Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
Hey guys! Just a quick tutorial on adding to the web from a file.
First, use one of the Web extender scripts on the sdn to create a new web.
Once you've saved the file it will be stored somewhere on your harddrive. My extender stores it in the RuneMate/bots/MaxiWebExtender directory.

You will need to package this file with your script and add it in the manifest as a resource like so:
Code:
<resources>
        <resource>com/runemate/maxiscripts/looping/fisher/karamja_f2p_surface.bin</resource>
    </resources>

You then need to load the resource in your script and add it to the web. Here is my method for doing so:

Code:
    public void addToWeb(String filename) {
        FileWeb fweb = null;
        InputStream is = MaxiFisher.class.getResourceAsStream(filename);
        if (is != null) {
            try {
                byte[] bytes = IOUtils.readFully(is, -1, true);
                if (bytes != null) {
                    fweb = FileWeb.fromByteArray(bytes);
                }
            } catch (ClassNotFoundException | IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        else {
            System.out.println("Null inputstream");
        }
        if (fweb != null) {
            web.addVertices(fweb.getVertices());
        }
        else {
            System.out.println("Null fileweb");
        }
    }

And here's an example of me adding my karamja web to my script:
Code:
Web web = new Web();
web.addVertices(Traversal.getDefaultWeb().getVertices());
addToWeb("/com/runemate/maxiscripts/looping/fisher/karamja_f2p_surface.bin");
I have created a web object and then copied the default webs vertices into it because if you add to the default web directly, it stays added even if you swap scripts. I then just call the addToWeb() method specifying the absolute path of my resource.
 
Joined
Jul 18, 2015
Messages
6
Hey, any idea how to do this after shift of local default webwalking to cloud? Traversal.getDefaultWeb().getVertices() Doesn't seem to work now. Alternatively, would be super cool if someone can dump some custom web data.

Thanks!
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
Hey, any idea how to do this after shift of local default webwalking to cloud? Traversal.getDefaultWeb().getVertices() Doesn't seem to work now. Alternatively, would be super cool if someone can dump some custom web data.

Thanks!
YEah there's no way to add to the existing web now, so you need to build a web from scratch without importing the default web with my tool. And then you need to use logic to decide whether to use the local web or the default web.
 
Joined
Oct 2, 2015
Messages
31
Another other guide of what the inside of that bin looks like?, Would like to web some areas and don't know how it's stored
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
I don't understand how the web works.
I assumed the bin was a list of tile/object links that loaded in.
Clearly I Miss understand how this whole things works
As the first post says, use a web extender bot to generate the .bin, which by the way should be .nav instead, cloud wants web file as .nav now. And if you want to know how the web extender does it just take a quick look at the api for the FileWeb class and the web extension tutorials by cloud.
 
Top