Thread: PlayerSave error.

Results 1 to 5 of 5
  1. #1 PlayerSave error. 
    Registered Member danjoshmac's Avatar
    Join Date
    Oct 2009
    Posts
    74
    Thanks given
    1
    Thanks received
    0
    Rep Power
    1
    I have recently programmed the 'Cooks assistant' quest into my server and everything is fine apart from the methods in the 'PlayerSave' file.
    This is what I added:
    else if (token.equals("cooksAss")) {
    p.cooksAss = Integer.parseInt(token2);
    }
    and..

    characterfile.write("cooksAss = ", 0, 8);
    characterfile.write(Integer.toString(p.cooksAss), 0, Integer.toString(p.cooksAss).length());
    characterfile.newLine();
    but it won't save properly, in the Character's configuration text document it displays the integer as:
    cooksAss0
    instead of:

    cooksAss = 0
    and I can't figure out why.. this is causing the saving problem. I will rep and thank for whoever solves the problem.

    RuneSaga - Returning to the classics.
    Reply With Quote  
     

  2. #2  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    characterfile.write("cooksAss = ", 0, 8); replace with

    characterfile.write("cooksAss = ", 0, 11);
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member danjoshmac's Avatar
    Join Date
    Oct 2009
    Posts
    74
    Thanks given
    1
    Thanks received
    0
    Rep Power
    1
    Quote Originally Posted by 'Boss View Post
    characterfile.write("cooksAss = ", 0, 8); replace with

    characterfile.write("cooksAss = ", 0, 11);
    thanks mate. worked a treat! could you quickly explain how the '8' and '11' differ?

    RuneSaga - Returning to the classics.
    Reply With Quote  
     

  5. #4  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    Quote Originally Posted by danjoshmac View Post
    thanks mate. worked a treat! could you quickly explain how the '8' and '11' differ?
    you need count the words on the "cookass = " has 11 words. you need count spaces and = too.
    Reply With Quote  
     

  6. #5  
    Registered Member
    Wiffles's Avatar
    Join Date
    Dec 2007
    Posts
    1,168
    Thanks given
    100
    Thanks received
    198
    Rep Power
    493
    Quote Originally Posted by danjoshmac View Post
    thanks mate. worked a treat! could you quickly explain how the '8' and '11' differ?
    "cooksAss = "

    The length of that string is 11. (Used for substring)
    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. [PI] PlayerSave
    By Trivium in forum Help
    Replies: 2
    Last Post: 12-12-2011, 02:11 AM
  2. Replies: 4
    Last Post: 07-26-2011, 10:00 PM
  3. [508] playersave
    By josue992222 in forum Help
    Replies: 1
    Last Post: 06-04-2009, 11:10 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •