Results 1 to 3 of 3
  1. #1
    Mokomi is offline Member
    Join Date
    May 2011
    Rep Power

    Default Selecting what to read in a .txt files

    Hello and welcome,
    long story short my friends and I play a DnD type game and it has become more like a universe more than spawning 30+ people casuals and hardcores alike. We are trying to get all this organized and easily able to send to everyone there character sheets and get so people from across country can still play. so i took it up and started to learn programing! yay me!

    now to the problem:

    I'm currently making the character sheets in a word .txt document and being able to read them. problem i have at the moment is it is always reading the first in a line or a row.
    I cannot get it to "Fish" for a piece of information i need. like exp.
    NAME: Mokomi Jay Tas.
    I do not want the NAME:
    This will also help in the future when I add items,spells and abilities.
    please and thank you in advance ^.^

    Java Code:
    public void readPc(){
    	}catch(Exception d){
    		System.out.println("Failed to read Charater Sheet!");}}

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power


    One comment on your code: You only have one hasNext() call and there are 4 next() calls.

    What happens when you execute the posted code with the input shown?
    What is the output from the printf?

    If you know you want to ignore the first token, why not do that. Read it and ignore it.
    Last edited by Norm; 05-25-2011 at 12:02 AM.

  3. #3
    Mokomi is offline Member
    Join Date
    May 2011
    Rep Power


    hasNext() is nice because it goes though the row and the while loop makes new rows but that is all place holders atm.
    what i'm trying to do is get it so it reads all words after the NAME: but not in the next line.

    NAME: Mokomi J Tas
    RACE: Human
    LEVEL: 18
    HEALTH: 2200/2300
    MANA: 1700/1700
    AURA: 0
    this is currently the code. yes i can have it just eat it all have each string/int saved each time i pull, but that feels like a huge waste. and when i start putting gear they have/inventory/inventory that is shown/etc i won't be able to show that. I do not know how to look up a search for the what is after the NAME: to place in the title window etc.

Similar Threads

  1. Read from two files
    By globo in forum New To Java
    Replies: 1
    Last Post: 01-29-2011, 11:25 PM
  2. Files, cannot read!
    By LennyKosmos in forum New To Java
    Replies: 2
    Last Post: 10-02-2010, 02:35 PM
  3. Selecting Files in a folder
    By ravjot28 in forum New To Java
    Replies: 1
    Last Post: 02-26-2010, 05:25 PM
  4. Read/Write Files
    By FlyNn in forum New To Java
    Replies: 3
    Last Post: 02-06-2010, 09:45 PM
  5. Read and Open *.txt Files? help!!
    By ashton in forum New To Java
    Replies: 9
    Last Post: 11-01-2009, 04:42 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