How to read...

This forum is currently in read-only mode.
  • 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!

  • 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.

  • 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!

  • 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....

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • ah crap i thought this thread was going to teach me how to read

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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)