Thread: Need help with increasing arrays? :)

Results 1 to 3 of 3
  1. #1 Need help with increasing arrays? :) 
    Registered Member
    Join Date
    Jun 2016
    Posts
    17
    Thanks given
    2
    Thanks received
    5
    Rep Power
    12
    So ive packed 116 data and everything is okay anims, gfx and npc's! but when i add obj.dat/idx and repack index items, i can login into the game although i get this error
    Code:
    Exception in thread "Thread-1" java.lang.ArrayIndexOutOfBoundsException: 41058
    	at ItemDef.forID(ItemDef.java:397)
    	at ItemDef.getSprite(ItemDef.java:914)
    	at Client.drawInterface(Client.java:11762)
    	at Client.drawInterface(Client.java:11680)
    	at Client.draw3dScreen(Client.java:12849)
    	at Client.method146(Client.java:16701)
    	at Client.drawGameScreen(Client.java:11455)
    	at Client.processDrawing(Client.java:12750)
    	at RSApplet.run(RSApplet.java:189)
    Now i know its it saying that its sending some more than it holds right?

    Line 397 Itemdef.forID
    Code:
    		stream.currentOffset = streamIndices[i];
    So i got to this
    Code:
    public static void unpackConfig(StreamLoader archive) {
    		ItemDef.stream = new Stream(archive.getDataForName("obj.dat"));
    		Stream stream = new Stream(archive.getDataForName("obj.idx"));
    		totalItems = stream.readUnsignedWord() + 21;
    		streamIndices = new int[totalItems + 5687];
    		int i = 2;
    
    		int i1;
    		for (i1 = 0; i1 < totalItems - 21; ++i1) {
    			streamIndices[i1] = i;
    			i += stream.readUnsignedWord();
    		}
    
    		cache = new ItemDef[10];
    
    		for (i1 = 0; i1 < 10; ++i1) {
    			cache[i1] = new ItemDef();
    		}

    Then noticed this
    Code:
    streamIndices = new int[totalItems + 5687];
    Is this what is causing the problem? If so what do i change it to? and if not can someone please point me in the right direction.
    Thanks


    EDIT- 20 views and not one person can point in the right direction? i am looking at java tutorials on index out of bounds but its not helping
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Sep 2014
    Posts
    4
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    coukd be readvalues, crc, or that tbh. Play around with it
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jun 2016
    Posts
    17
    Thanks given
    2
    Thanks received
    5
    Rep Power
    12
    Quote Originally Posted by RollingOnXTC View Post
    coukd be readvalues, crc, or that tbh. Play around with it
    Been playing around with it for 4 days mate, hence why i'm posting a help thread
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 5
    Last Post: 09-15-2014, 08:13 PM
  2. Need help with arrays
    By Integer in forum Help
    Replies: 3
    Last Post: 11-01-2011, 06:04 PM
  3. need help with arrays for crafting
    By Propel_ in forum Help
    Replies: 2
    Last Post: 08-17-2010, 06:27 AM
  4. Need help with item.java arrays
    By Aeronix in forum Help
    Replies: 0
    Last Post: 09-05-2009, 11:49 AM
  5. [508] Need help with an array list, will rep+
    By EndlessZombies in forum Help
    Replies: 5
    Last Post: 04-22-2009, 03:08 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •