Thread: explain playersave.java

Results 1 to 2 of 2
  1. #1 explain playersave.java 
    Donator
    nonononooooooo's Avatar
    Join Date
    Nov 2012
    Posts
    370
    Thanks given
    13
    Thanks received
    4
    Rep Power
    20
    so i'm pretty new to this and i've been having a lot of saving issues could some one explain to me how playersave.java works

    characterfile.write("crystal = ", 0, 7);
    characterfile.write(Integer.toString(p.crystal), 0, Integer.toString(p.crystal).length());
    characterfile.newLine();

    that's from my playersave.java could someone explain to me how it works? what is the 0, 7 ?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Dec 2009
    Posts
    488
    Thanks given
    11
    Thanks received
    12
    Rep Power
    15
    You ask for explanation of code? well....

    you know when you go to the data/characters file and open up your player .txt and see all that stuff written in there? well this code determines what is written.

    Code:
    characterfile.write("crystal = ", 0, 7);
    characterfile.write(Integer.toString(p.crystal), 0, Integer.toString(p.crystal).length());
    characterfile.newLine();
    Code:
    characterfile.write("crystal = ", 0, 7);
    this writes out "crystal = " in the player file without the "" marks.
    that is the amount of characters that is inside the first argument
    Code:
    characterfile.write(Integer.toString(p.crystal), 0, Integer.toString(p.crystal).length());
    that puts the value of the crystal next to "crystal = " depending upon what you made it in player.java
    Code:
    characterfile.newLine();
    that just makes the new blank line =]
    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 crash
    By Mark in forum Help
    Replies: 2
    Last Post: 04-28-2011, 01:16 AM
  2. [PI] Messed up Playersave.java ?
    By Martyr in forum Help
    Replies: 3
    Last Post: 01-26-2011, 08:26 AM
  3. PlayerSave.java: 2kB for a FULL player
    By Colby in forum Snippets
    Replies: 18
    Last Post: 12-19-2010, 02:15 AM
  4. [508] FileManager.java explain please?
    By Tomjrmkay in forum Help
    Replies: 5
    Last Post: 08-27-2009, 04:54 PM
  5. [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
  •