[SOLVED]Understanding array-file structure

This forum is currently in read-only mode.
From the Asset Store
a complete set of modular graphics, perfect for all kind of levelbuilding
  • Hi everyone!

    Short version:

    How do I load predefined entries (much of them!) into an array? What format does the file need to be?

    Long version:

    After being able to create a heap of random stars I now want to give them individual names. Each instance has its private variable "name", awaiting to be filled.

    I planned doing this with an array, that in turn I fill from a prepopulated list (textfile for instance). The problem: "Load from file" doesn't work OR does not work the way I though it would.

    I have a starnames.ini/txt with the following content:

    5653 Felis
    1947 Eridani
    6649 Chitra
    7801 Liu Xiu
    1954 Andromedae
    3504 Fornacis
    7245 Felis[/code:1l8hgza7]
    
    After filling the array with this file I print the array into a text-element, which promptly displays: "0". Nothing else.
    (Printing into the textfield is done by a loop "for i = 1 to Array.SizeY which loops the following: set text to Array(global('counter'), 1) and global('counter')++)
    
    So obviously I cant simply load a textfile into an array. I filled the array with some entries by hand and then used "save to file" just to see what structure it would have, only to get some unreadable hickup of chars and stuff.
    
    Can someone please help me on this? I found nothing by searching the forum for keywords "array" (which returned an error by the way [you can't search at the moment], probably too much hits), "file array", "load from file" and so on.
    
    Best regards,
    Noel
  • Try this

    http://dl.dropbox.com/u/24325446/tar.zip

    (I used "-1" for NumTokens because of some crappy stuff appeared in the end of string, don't know what it was)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well that works. I do not fully understand what happens in your example, but I managed to port it to my needs and that is all that counts.

    Thanks for the great and fast help!

    Best regards,

    Noel

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