Thread: Doing map read values.

Results 1 to 9 of 9
  1. #1 Doing map read values. 
    Registered Member
    Join Date
    Dec 2014
    Posts
    43
    Thanks given
    10
    Thanks received
    0
    Rep Power
    11
    So when i tried to make read values (Buffer value) wont just work can someone help me and tell me what's wrong with it?
    Attached image
    Code:
    public void decode(Buffer buffer) {
    		while(true) {
    			int opcode = buffer.readUByte();
    
    			if (opcode == 0) {
    				break;
    			} else if (opcode == 1) {
    				int len = buffer.readUByte();
    				if (len > 0) {
    					if (modelIds == null) {
    						modelTypes = new int[len];
    						modelIds = new int[len];
    
    						for (int i = 0; i < len; i++) {
    							modelIds[i] = buffer.readUShort();
    							modelTypes[i] = buffer.readUByte();
    						}
    					} else {
    						buffer.currentOffset += len * 3;
    					}
    				}
    			} else if (opcode == 2) {
    				name = buffer.readString();
    			} else if (opcode == 5) {
    				int len = buffer.readUByte();
    				if (len > 0) {
    					if (modelIds == null) {
    						modelTypes = null;
    						modelIds = new int[len];
    						for (int i = 0; i < len; i++) {
    							modelIds[i] = buffer.readUShort();
    						}
    					} else {
    						buffer.currentOffset += len * 2;
    					}
    				}
    			} else if (opcode == 14) {
    				width = buffer.readUByte();
    			} else if (opcode == 15) {
    				length = buffer.readUByte();
    			} else if (opcode == 17) {
    				solid = false;
    			} else if (opcode == 18) {
    				impenetrable = false;
    			} else if (opcode == 19) {
    				interactive = (buffer.readUByte() == 1);
    			} else if (opcode == 21) {
    				contouredGround = true;
    			} else if (opcode == 22) {
    				nonFlatShading = true;
    			} else if (opcode == 23) {
    				modelClipped = true;
    			} else if (opcode == 24) {
    				animation = buffer.readUShort();
    				if (animation == 0xFFFF) {
    					animation = -1;
    				}
    			} else if (opcode == 27) {
    				clipType = 1;
    			} else if (opcode == 28) {
    				decorDisplacement = buffer.readUByte();
    			} else if (opcode == 29) {
    				ambientLighting = buffer.readSignedByte();
    			} else if (opcode == 39) {
    				contrast = buffer.readSignedByte() * 25;
    			} else if (opcode >= 30 && opcode < 35) {
    				if (actions == null) {
    					actions = new String[5];
    				}
    				actions[opcode - 30] = buffer.readString();
    				if (actions[opcode - 30].equalsIgnoreCase("Hidden")) {
    					actions[opcode - 30] = null;
    				}
    			} else if (opcode == 40) {
    				int len = buffer.readUByte();
    				modifiedModelColors = new int[len];
    				originalModelColors = new int[len];
    				for (int i = 0; i < len; i++) {
    					modifiedModelColors[i] = buffer.readUShort();
    					originalModelColors[i] = buffer.readUShort();
    				}
    			} else if (opcode == 41) {
    				int len = buffer.readUByte();
    				modifiedTexture = new short[len];
    				originalTexture = new short[len];
    				for (int i = 0; i < len; i++) {
    					modifiedTexture[i] = (short) buffer.readUShort();
    					originalTexture[i] = (short) buffer.readUShort();
    				}
    
    			} else if (opcode == 62) {
    				inverted = true;
    			} else if (opcode == 64) {
    				castsShadow = false;
    			} else if (opcode == 65) {
    				scaleX = buffer.readUShort();
    			} else if (opcode == 66) {
    				scaleY = buffer.readUShort();
    			} else if (opcode == 67) {
    				scaleZ = buffer.readUShort();
    			} else if (opcode == 68) {
    				mapscene = buffer.readUShort();
    			} else if (opcode == 69) {
    				surroundings = buffer.readUByte();
    			} else if (opcode == 70) {
    				translateX = buffer.readUShort();
    			} else if (opcode == 71) {
    				translateY = buffer.readUShort();
    			} else if (opcode == 72) {
    				translateZ = buffer.readUShort();
    			} else if (opcode == 73) {
    				obstructsGround = true;
    			} else if (opcode == 74) {
    				removeClipping = true;
    			} else if (opcode == 75) {
    				supportItems = buffer.readUByte();
    			} else if (opcode == 78) {
    				buffer.readUShort(); // ambient sound id
    				buffer.readUByte();
    			} else if (opcode == 79) {
    				buffer.readUShort();
    				buffer.readUShort();
    				buffer.readUByte();
    				int len = buffer.readUByte();
    
    				for (int i = 0; i < len; i++) {
    					buffer.readUShort();
    				}
    			} else if (opcode == 81) {
    				buffer.readUByte();
    			} else if (opcode == 82) {
    				mapIcon = buffer.readUShort();
    
    				if (mapIcon == 0xFFFF) {
    					mapIcon = -1;
    				}
    			} else if (opcode == 77 || opcode == 92) {
    				varp = buffer.readUShort();
    
    				if (varp == 0xFFFF) {
    					varp = -1;
    				}
    
    				varbit = buffer.readUShort();
    
    				if (varbit == 0xFFFF) {
    					varbit = -1;
    				}
    
    				int value = -1;
    
    				if (opcode == 92) {
                        value = buffer.readUShort();
    
                        if (value == 0xFFFF) {
                            value = -1;
                        }
                    }
    
    				int len = buffer.readUByte();
    
    				morphisms = new int[len + 2];
    				for (int i = 0; i <= len; ++i) {
    					morphisms[i] = buffer.readUShort();
    					if (morphisms[i] == 0xFFFF) {
    						morphisms[i] = -1;
    					}
    				}
    				morphisms[len + 1] = value;
    			} else {
    				System.out.println("invalid opcode: " + opcode);
    			}
    
    		}
    
    		if (name != null && !name.equals("null")) {
    			interactive = modelIds != null && (modelTypes == null || modelTypes[0] == 10);
    			if (actions != null)
    				interactive = true;
    		}
    
    		if (removeClipping) {
    			solid = false;
    			impenetrable = false;
    		}
    
    		if (supportItems == -1) {
    			supportItems = solid ? 1 : 0;
    		}
    	}
    Reply With Quote  
     

  2. #2  
    Donator

    Join Date
    Dec 2014
    Posts
    289
    Thanks given
    160
    Thanks received
    56
    Rep Power
    37
    What does the error say when you float over the Buffer underlined in read. It is almost as if the Buffer class is not imported.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Community Veteran

    mige5's Avatar
    Join Date
    Aug 2008
    Posts
    5,528
    Thanks given
    573
    Thanks received
    1,410
    Rep Power
    2114
    Thats object readvalues not map readvalues..
    Number of page #1 releases with most views & posts: (Updated: 2023)
    RS2 server section: 1
    RS2 client section: 2
    Reply With Quote  
     

  5. #4  
    Registered Member
    Join Date
    Dec 2014
    Posts
    43
    Thanks given
    10
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by mikey96 View Post
    What does the error say when you float over the Buffer underlined in read. It is almost as if the Buffer class is not imported.
    Umm ye import Buffer (java.nio)
    After that every UByte get's error and fix says add cast but that's not how it works.


    Quote Originally Posted by mige5 View Post
    Thats object readvalues not map readvalues..
    And ye my mistake
    Reply With Quote  
     

  6. #5  
    Registered Member
    rebecca's Avatar
    Join Date
    Aug 2017
    Posts
    1,071
    Thanks given
    862
    Thanks received
    915
    Rep Power
    5000
    Buffer could be Stream
    Reply With Quote  
     

  7. Thankful user:


  8. #6  
    Registered Member
    Join Date
    Dec 2014
    Posts
    43
    Thanks given
    10
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Expand View Post
    Buffer could be Stream
    Wow you just saved me
    On other post still got some variables im not sure i have.
    like this
    Code:
    			} else if (opcode == 27) {
    				clipType = 1;
    or this
    Code:
    			} else if (opcode == 41) {
    				int len = buffer.readUByte();
    				modifiedTexture = new short[len];
    				originalTexture = new short[len];
    				for (int i = 0; i < len; i++) {
    					modifiedTexture[i] = (short) buffer.readShort();
    					originalTexture[i] = (short) buffer.readShort();
    				}
    Reply With Quote  
     

  9. #7  
    Banned

    Join Date
    Oct 2012
    Posts
    4,710
    Thanks given
    1,679
    Thanks received
    1,105
    Rep Power
    0
    Use eclipse, wtf is that notepad.
    Reply With Quote  
     

  10. #8  
    Ex Rune-Scaper

    Join Date
    Jun 2008
    Posts
    3,534
    Thanks given
    457
    Thanks received
    1,257
    Rep Power
    990
    Quote Originally Posted by crazybeast View Post
    Wow you just saved me
    On other post still got some variables im not sure i have.
    like this
    Code:
    			} else if (opcode == 27) {
    				clipType = 1;
    or this
    Code:
    			} else if (opcode == 41) {
    				int len = buffer.readUByte();
    				modifiedTexture = new short[len];
    				originalTexture = new short[len];
    				for (int i = 0; i < len; i++) {
    					modifiedTexture[i] = (short) buffer.readShort();
    					originalTexture[i] = (short) buffer.readShort();
    				}
    OSDC uses all the same values as RuneLite except opcode 249 (params). (See here)
    not every opcode is going to be used by 317s
    Attached image
    Reply With Quote  
     

  11. Thankful user:


  12. #9  
    Registered Member
    Join Date
    Dec 2014
    Posts
    43
    Thanks given
    10
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by _Patrick_ View Post
    Use eclipse, wtf is that notepad.
    And that is eclipse ...

    Quote Originally Posted by nshusa View Post
    OSDC uses all the same values as RuneLite except opcode 249 (params). (See here)
    not every opcode is going to be used by 317s
    Thanks
    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. #148 Maps Animation Read Values
    By Thorrin in forum Help
    Replies: 2
    Last Post: 07-13-2017, 10:48 AM
  2. how do i do read values
    By yungstunna in forum Help
    Replies: 1
    Last Post: 08-24-2016, 10:45 AM
  3. 525 maps/objects read values
    By helpMe in forum Help
    Replies: 4
    Last Post: 05-03-2012, 11:40 PM
  4. Secondary map packet values
    By peterbjornx in forum Snippets
    Replies: 3
    Last Post: 03-15-2009, 10:33 PM
  5. how do i read~
    By rOoNeY in forum Tutorials
    Replies: 2
    Last Post: 02-16-2008, 01: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
  •