1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tutorial Adding to the Web from a file

Discussion in 'Tutorials & Resources' started by Aidden, Jan 27, 2015.

  1. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    Hey guys! Just a quick tutorial on adding to the web from a file.
    First, use one of the Web extender scripts bots 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 bot and add it in the manifest as a resource like so:
    Code (Text):
    1.  
    2. <resources>
    3.         <resource>com/runemate/maxiscripts/looping/fisher/karamja_f2p_surface.bin</resource>
    4.     </resources>
    5.  
    You then need to load the resource in your script bot and add it to the web. Here is my method for doing so:

    Code (Text):
    1.  
    2.     public void addToWeb(String filename) {
    3.         FileWeb fweb = null;
    4.         InputStream is = MaxiFisher.class.getResourceAsStream(filename);
    5.         if (is != null) {
    6.             try {
    7.                 byte[] bytes = IOUtils.readFully(is, -1, true);
    8.                 if (bytes != null) {
    9.                     fweb = FileWeb.fromByteArray(bytes);
    10.                 }
    11.             } catch (ClassNotFoundException | IOException e) {
    12.                 // TODO Auto-generated catch block
    13.                 e.printStackTrace();
    14.             }
    15.         }
    16.         else {
    17.             System.out.println("Null inputstream");
    18.         }
    19.         if (fweb != null) {
    20.             web.addVertices(fweb.getVertices());
    21.         }
    22.         else {
    23.             System.out.println("Null fileweb");
    24.         }
    25.     }
    26.  
    And here's an example of me adding my karamja web to my script bot:
    Code (Text):
    1.  
    2. Web web = new Web();
    3. web.addVertices(Traversal.getDefaultWeb().getVertices());
    4. addToWeb("/com/runemate/maxiscripts/looping/fisher/karamja_f2p_surface.bin");
    5.  
    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 bots. I then just call the addToWeb() method specifying the absolute path of my resource.
     
  2. Geashaw

    Joined:
    Jan 8, 2015
    Messages:
    1,429
    Likes Received:
    252
    @Aidden Could you elaborate the use of adding web?
     
  3. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    Why you would do it? Certain areas aren't mapped so you need to map them if they're going to be used in you're script bot
     
  4. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    What about the edges?
     
  5. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    What do you mean?
     
  6. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    Are the edges added as well? I guess they would be if the vertex itself holds the edge data.
     
  7. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    Yeah, everything is added.
     
  8. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    Hmmm, makes sense. In the case of two webs overlapping, but not connected, what happens?
     
  9. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    I'm not sure. @Cloud
     
  10. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    If they're not connected only one or the other will be used likely depending on which contains a closer vertex.
     
  11. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    408
    Likes Received:
    84
    #11 Hazard, Jun 20, 2015
    Last edited: Jun 20, 2015
  12. muttaclien

    Joined:
    Jul 18, 2015
    Messages:
    6
    Likes Received:
    0
    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!
     
  13. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    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.
     
  14. DarkenedSoul

    Joined:
    Oct 2, 2015
    Messages:
    31
    Likes Received:
    5
    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
     
  15. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    why would you need that? it's not for human reading lol
     
  16. DarkenedSoul

    Joined:
    Oct 2, 2015
    Messages:
    31
    Likes Received:
    5
    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
     
  17. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    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.
     
  18. Emrys

    Joined:
    Sep 21, 2018
    Messages:
    21
    Likes Received:
    2
    i can't find any web extenders on the bot store
     

Share This Page

Loading...