Page 1 of 1

How to read...

PostPosted: Fri Dec 05, 2008 12:35 pm
by Psyke
Hi all!

I have one question about reading text files. Is it possible to read a file LINE per LINE and CHAR per CHAR?

Example:

//Music 01
1000 - a
2000 - b
3000 - c


Which these values (1000; 2000; 3000) are the time in miliseconds and these (a; b; c) are the type of the notes.

I need at the Start of Layout, the Construct to read a text file called: "music01.txt", reading each line and each character. Sorry if it's so complexy.


ps: i am making a Guitar Hero game style.


Thanks!

Re: How to read...

PostPosted: Fri Dec 05, 2008 12:49 pm
by Aeal5566
You could use an ini file. it just like a txt file but its is seperated by groups and Items. So you could have an A group and then the 1000 2000 and so on just use a get Item value this.

it would be something like

Every ini.Itemvalue(A,1000) // these are the groups and the items in the group.
play A note


you would use the ini object to write your values at the start of the program or make a program to write the file for you and then make it global and read the values as you need them. I think this would be a much easier way to read in from a file and is exactly what you are looking for... Hope this helps.

Re: How to read...

PostPosted: Fri Dec 05, 2008 1:02 pm
by Psyke
Thanks for the help Aeal5566, but it's too complexy for me, i am newbie at INI, could you make an little example about that? Or just give me a link with INI tutorial, because i don't understand any of read/write files.


thanks!

Re: How to read...

PostPosted: Fri Dec 05, 2008 1:14 pm
by Aeal5566
Sure NP I can have a demo for you your gonna have to give me a little time though Ill try to have it to you by the end of the day I have to go to work now but my boss is out today so I think can make a quick demo for you. Its not so bad once you get into it....

Re: How to read...

PostPosted: Fri Dec 05, 2008 1:19 pm
by Psyke
np, i can wait, relax, now i am making the design of the notes and the guitar table, so, i will finish that at the end of day too. thanks again.

Re: How to read...

PostPosted: Fri Dec 05, 2008 6:51 pm
by Aeal5566
Check you PMs i sent you a link to the thing I wrote for you... Sorry if its hard to use ill try to refine it ill let you know about any updates.

Re: How to read...

PostPosted: Sat Dec 06, 2008 7:09 pm
by alee
ah crap i thought this thread was going to teach me how to read :(

wow. my posts really are getting worse and worse...