Array saving/loading is messed up.

For questions about using Classic.

Post » Tue Jan 01, 2008 8:08 pm

First, download all of these 3 files.

http://www.mediafire.com/?29mcnco8wa2
http://www.mediafire.com/?2xtnbmdcbvd
http://www.mediafire.com/?0hotxqmmt2d

In the first file array.txt, that's how I want the array to be. I wrote that in notepad. Loading this into Construct does not changes the array values.

In the second file array2.txt, it's the result of Construct's array saving. What.

The third file is the .cap I used for testing.


What I ask is to change array loading to the one I want, because it's 1)simple, 2)clean, 3)easily modificable; I also want Construct to save arrays like that.
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Tue Jan 01, 2008 8:14 pm

New problem :

http://www.mediafire.com/?2jzxacv9uvz

^ ^ ^ In this .cap when debugging it and checking the array, I can only see the X values I choose, the Y values are not displayed.
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Tue Jan 01, 2008 8:20 pm

New problem :

You can't compare an array value.
We need a condition :

Compare array value at X,Y,Z
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Tue Jan 01, 2008 10:00 pm

[quote="SuperV":2533e5v9]In the first file array.txt, that's how I want the array to be. I wrote that in notepad. Loading this into Construct does not changes the array values.[/quote:2533e5v9]

That's because it's not a valid array file. The array object uses its own array files in a special binary format. This is absolutely necessary to store information such as the type of the data held in an element (string/float/integer), the dimensions of the array etc. etc.

[quote="SuperV":2533e5v9]In the second file array2.txt, it's the result of Construct's array saving. What.[/quote:2533e5v9]

An example of the binary format the Array object saves. It's not possible to manually write an array saved file in notepad.

[quote="SuperV":2533e5v9]The third file is the .cap I used for testing.[/quote:2533e5v9]

The first thing the file does is resize the array to a zero sized array. All dimensions must be 1 or more for there to be any elements. Do the multiplication: 3 x 3 x 0 = 0 elements! You probably meant 3 x 3 x 1. The array object ignores the set dimensions call because it doesnt allow you to create a zero sized array - I've changed this for 0.89 though, which will allow zero sized arrays (so you don't get confused with the wrong dimension sizes).

[quote="SuperV":2533e5v9]In this .cap when debugging it and checking the array, I can only see the X values I choose[/quote:2533e5v9]

Hmm, a limitation in the Array object's debugging. It's coded specifically only to show the first values on the X axis, ie. all values where Y = 0 and Z = 0. I did this because with a 100 x 100 x 100 array, you'd end up with the debugger spammed with a million entries which could be quite slow or hard to use. I'll try come up with something better.

[quote="SuperV":2533e5v9]Compare array value at X,Y,Z[/quote:2533e5v9]
Added for 0.89, woops!

As for your array.txt file you want Construct to load: it's impossible to write a loader for this file! Should I interpret the first line as four numbers, 1, 1, 1, 1, or a single number, 1111? It's ambiguous and your way would be limited to single character values anyway, so this is the kind of thing you need a custom loader for.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue Jan 01, 2008 11:18 pm

I have an idea, why don't you code an external array creator?
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Wed Jan 02, 2008 12:42 am

Aah I'm just the guy who writes Construct. Someone else can if they think its important ;)
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Jan 02, 2008 2:30 pm

I could even code it but I don't know the parameters the array uses for saving/loading.
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Wed Jan 02, 2008 7:42 pm

Just make a save/loading app in Construct, using the array object :)

0.89 is released now and has the changes you wanted.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Fri Jan 04, 2008 11:00 am

That would be well easy to make in construst :P

If no-one can be bothered but its still in high demand I'll have a look at making one.
B
2
S
2
G
5
Posts: 448
Reputation: 2,546


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests