Array object

For questions about using Classic.

Post » Tue Jan 05, 2010 1:13 pm

Hello, one more post from me :oops:

Anyway, now i trying to learn on the array object.
I'm trying to make a simple nonogram game and well i'm having some problems regarding the number system on the sides. If you are not familiar with the type of game you can see it here : [url:3s5t3aw0]http://en.wikipedia.org/wiki/Picross[/url:3s5t3aw0]

The problem is adding the numbers together.
For example if the blocks are "0 0 1 1 0 1 0 1 1 1" it should read out "2 1 3" but there is a glitch in my calculations. There are two .caps in the zip and one array that can be loaded.
In one of the caps i'm only trying to get the number system to work.
In the other one the cells are made and the textboxes, all marked with rows, colums and x.y in the variables.

Here are the files:
[url:3s5t3aw0]http://internet.is/eski/nonogram.zip[/url:3s5t3aw0]

I havent found much info about the array object so i thought i would ask.
Also, in the debug why does it only show one row for the array object though the list is 10x10x1 or 100x100x5 for that matter.. ?

Anyway i would appreciate any comments on this matter.
So far the people here on the forum have been really nice and quick with responses and help. :wink:
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Wed Jan 06, 2010 12:06 am

[quote="eski":3vg7sc73]Also, in the debug why does it only show one row for the array object though the list is 10x10x1 or 100x100x5 for that matter.. ?[/quote:3vg7sc73]
I think it's just for practicality, since dumping thousands of items in to the list for all elements might be inconvenient.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Wed Jan 06, 2010 12:11 am

Yeah i understand.
At first i thought it was something that i did wrong, but then i saw that the array worked like it should despite that the debug said otherwise... 8)
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Wed Jan 06, 2010 5:06 pm

aaaaanny input.. would love it :oops:
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Wed Jan 13, 2010 3:30 am

Sorry to bump this up again but i am going NUTS, i just dont get how to do this... :evil:

If anybody has a clue, doesnt even have to help me with the codeing just point me in the rigth direction.

Should i use arrays for the boxes to tick in ? Can i connect them somehow with the number system ?
The problem with the number system is that it doesnt calculate right if the last number is 1.

Basicly what i have on the number system is this.

+checked = 1
- counter + 1

+checked = 0
- textbox = textbox.text & counter
- counter = 0
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Wed Jan 13, 2010 4:08 am

To solve the problem you're having with the last number, you can use regular "For" loops and then check to see if you've reached the last iteration of the loop, adding the current number if you've reached the end. Here's an example(be sure to extract it with the array file):

Picross Array Thingy

I hope this helps some. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Wed Jan 13, 2010 2:17 pm

yah, that definitely helped.. :D i'm understanding this better, of coz use a for loop..

Its just the whole picture now.. Trying to connect the number system to the boxes(or the array).
Can i take one line in the array and copy the values to a textbox ?
Like if i could take the top row and put it in a box then i have a string that i can work with.
Same with the columns. Anyway i cant find or think of the way to do it.


Another thing.
When you have 2 for loops and they both loop 10 times, does the first one finish before the second one starts ? If so, i cant use the loopindex of first loop in the second loop.. ?
i was trying to do this, dont remember why though (trying alot of methods go get this to work) and the loopindex return -1.
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Wed Jan 13, 2010 10:18 pm

Alright, this CAP file should answer any remaining questions you have about this(once again, be sure to extract it):

Picross Square Number Finder Thingy

The trick to it is using nested loops to loop through the array; that is, you start a loop inside of another loop through use of a sub-event. This allows you to check column by column or row by row depending on whether you loop through starting with the X or Y axis first.

Once again, I hope this helps. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Wed Jan 13, 2010 10:48 pm

[quote="linkman2004":1af76lxy]Alright, this CAP file should answer any remaining questions you have about this(once again, be sure to extract it):

Picross Square Number Finder Thingy

The trick to it is using nested loops to loop through the array; that is, you start a loop inside of another loop through use of a sub-event. This allows you to check column by column or row by row depending on whether you loop through starting with the X or Y axis first.

Once again, I hope this helps. :)[/quote:1af76lxy]


I dont believe it, i was really close to the right solution, the for loops were little off..
But i didnt really get it though i was doing it myself..
i will have to write this thing up on a big teachers table to get how it works.. the for loops are really messing up my head..

but on the other hand, you got some skillz.. i mean.. did you have to ponder on this ?
i have been spending some seriously hours on this thing

and also.. A BIG THANK YOU for this.. nicely set up .cap with explanation... SUPER
finally i can continue.. :D
B
7
S
1
G
3
Posts: 66
Reputation: 1,651


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests