Array building

For questions about using Classic.

Post » Fri Mar 19, 2010 11:23 pm

Has anyone at any point created a Construct app for building arrays more easily, or extracting arrays from text files?

I've got to build 16+ 10x10 arrays (or possibly a 10x10x16 array, whichever is easier) made up of nothing but A04AB2A1A3B0D1CAC2 and so on (tiled level data). I could make an INI instead but it would be freely editable and take forever to fill in the data. In essence, I could brute force write it but it would take days.

Or is there already a more straightforward way to do this in Construct that I am missing?

NB: I did attempt to search for this but the forum search yielded little results and another search caused the search engine to fold its arms and glare at me until I went away.
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Fri Mar 19, 2010 11:43 pm

What keeps you from using the built-in "Load from file"/"Save to file" actions of arrays/ hash tables?
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Mar 19, 2010 11:52 pm

...that's not quite the problem.

I need to easily and smoothly construct 16 arrays with 100 characters in each one, in a way that is faster than manually telling Construct to put the values into the array using events.

As in just inputting them into a Construct app or simpler text file than an INI and have Construct read the characters into an array.

Load from file doesn't seem to act as I expect it to unless the array already exists, and so I'm not sure how to use it properly.
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Sat Mar 20, 2010 12:17 am

I have used arrays quite a bit, but I have to admit that I'm not sure what it is that you're trying to achieve.

[quote="GoldMatenes":1lrqzmks]I've got to build 16+ 10x10 arrays (or possibly a 10x10x16 array, whichever is easier) made up of nothing but A04AB2A1A3B0D1CAC2 and so on (tiled level data). I could make an INI instead but it would be freely editable and take forever to fill in the data. In essence, I could brute force write it but it would take days.
[/quote:1lrqzmks]

So where does this data "A04AB2A1A3B0D1CAC2" actually come from?

Of course you can load strings into an array from a plain text file. I was just sitting here working on an example that involves something like that:

[url:1lrqzmks]http://dl.dropbox.com/u/2306601/gettokenthing06.cap[/url:1lrqzmks]

Think of the text object SourceText as the text file. The Size of the array is determined by the source text and the different values/strings are put into the array using delimiters. I just had a vague hunch that this could be interesting for you. :?

Other than that you'll have to explain the problem further for people like me to get it. :P
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sat Mar 20, 2010 12:20 am

That's basically what I wanted to do:

Extract a bunch of information from either a text file or some other means, into an array.

I just didn't know whether there was a simpler way to do it than manually telling Construct to set each array value.
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Sat Mar 20, 2010 12:26 am

[quote="GoldMatenes":8rakn3bw]That's basically what I wanted to do:

Extract a bunch of information from either a text file or some other means, into an array.

I just didn't know whether there was a simpler way to do it than manually telling Construct to set each array value.[/quote:8rakn3bw]

So it wasn't completely improper to post this wip example?!?! I'm glad. :)

You'll find yourself using For each element and loops in general a lot when working with arrays. At least that's what I do. Good luck with your project(s)!
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Tue Mar 23, 2010 2:31 pm

So, I'm back.

I decided after much fiddling that building a Construct app that can easily write and read arrays would ultimately be useful not only to me, but maybe to other people. Besides, that just means only people who bothered to read this thread can tool with arrays.

However, I need a bit of help. The writing arrays I think I have down, thanks to PixelRebirth's example, but I think I am not fully understanding how Construct does FOR loops, as my for loop seems to refuse to repeat more than once. I think I may be using the wrong identifiers with the array calls as well...

Anyway, any input would be appreciated. Sorry about the .ymt addition for the filenames, it was originally designed for making levels for my game. It can easily be chopped out of the code, and will be if I actually get this thingy done.

[url:fswk31br]http://www.megaupload.com/?d=77WMEPKZ[/url:fswk31br]
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Wed Mar 24, 2010 12:28 am

I was just now able to download your cap, since Megaupload told me before the file wasn't available for some reason. :(

So I didn't really look into your cap so far I'm afraid. Won't you include the Z dimension of the array in your app? Anyway, will give you more feedback soon.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Wed Mar 24, 2010 12:35 am

No problem.

Again, it was originally just X and Y for my game, but if I can actually make this thing work I could definitely think of other features... filetypes, Z, etc.
B
2
S
1
G
3
Posts: 43
Reputation: 1,086


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest