Thread: Run error [WILL REPP]

Results 1 to 6 of 6
  1. #1 Run error [WILL REPP] 
    sup3rman
    Guest
    I have recently attempted to add a new variable onto the char files, using a minigame base i found on my server. This is what i added...

    Code:
    			characterfile.write("character-saradomin = ", 0, 22);
    			characterfile.write(Integer.toString(saraKills), 0, Integer.toString(saraKills).length());
    			characterfile.newLine();
    			characterfile.write("character-anchor = ", 0, 23);
    			characterfile.write(Integer.toString(anchor), 0, Integer.toString(anchor).length());
    			characterfile.newLine();
    Code:
    					} else if (token.equals("character-saradomin")) {
    						saraKills = Integer.parseInt(token2);
    					} else if (token.equals("character-anchor")) {
    						saraKills = Integer.parseInt(token2);
    Code:
    public int saraKills;
    public int anchor;
    The base was the saradomin kills and the new added was the anchor part...

    Doing this made me unable to save a char file giving me this error...

    Code:
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    String index out of range: 23
    [Anyname]: Failed to load player: Anyname
    [null]: Disconnected
    Please help... I will rep!!!
    Reply With Quote  
     

  2. #2  
    Registered Member
    DaraX's Avatar
    Join Date
    Apr 2009
    Posts
    1,183
    Thanks given
    18
    Thanks received
    29
    Rep Power
    262
    } else if (token.equals("character-saradomin")) {
    saraKills = Integer.parseInt(token2);
    } else if (token.equals("character-anchor")) {
    saraKills = Integer.parseInt(token2);
    Reply With Quote  
     

  3. #3  
    Previously Hyperion


    Join Date
    Jan 2009
    Posts
    1,254
    Thanks given
    3
    Thanks received
    18
    Rep Power
    138
    Quote Originally Posted by Knight's Saga View Post
    } else if (token.equals("character-saradomin")) {
    saraKills = Integer.parseInt(token2);
    } else if (token.equals("character-anchor")) {
    saraKills = Integer.parseInt(token2);
    wrong although this is messed up too

    do you see the 23 beside "character-anchor"? That is how long your string is. "character-saradomin = " is 22 characters counting spaces and = mark. Now "character-anchor = " is only 19, so replace 23 with 19. And it will work, also change the saraKills to whatever the real int is.
    Reply With Quote  
     

  4. #4  
    sup3rman
    Guest
    i cant rep you sorry, i've only jsut recently repped you :/
    Reply With Quote  
     

  5. #5  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Thank you mental on this, actually helped me learn
    I had that problem before when i was a joke and had toget a friend to actually help me.
    Reply With Quote  
     

  6. #6  
    Previously Hyperion


    Join Date
    Jan 2009
    Posts
    1,254
    Thanks given
    3
    Thanks received
    18
    Rep Power
    138
    Quote Originally Posted by Dustscapex View Post
    Thank you mental on this, actually helped me learn
    I had that problem before when i was a joke and had toget a friend to actually help me.
    Not a problem, Think everyones made this mistake before. @OP dont worry about rep, its about as useful as half this community. Just glad I helped you understand it better. Also glad to finally see someone attempting to do it on their own before posting. Most just beg for code without trying.
    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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •