Set Value Variable - Array - help please

Get help using Construct 2

Post » Sat Mar 15, 2014 2:15 am

Good, I will try to explain my problem to see if we can resolve it. I'm very sorry but there are English speaking and I'm using a translator.

I'm a programmer and maybe for that reason I'm trying to do something actually done otherwise.

I'm trying to cycle in array to MINIMIZE the task in case you want to add or expand the level of mines or buildings.

We started taking two mines. Wood and Glass. We create two variables to see what levels are in the game.

We create an Array and introduce some data.

Array( 0 , 0 ) = "cristal" ; this is a text string
Array( 0 , 1 ) = "metal" ; this is a text string
Array( 1 , 0 ) = cristal_LVL ; This is a variable
Array( 1 , 0 ) = metal_LVL ; This is a variable

El Array.X = 0 equals strings
El Array.X = 1 are variable

I show pictures of the project.

Image
Image
Image
Image

As a non-English speaking and I do not get how to explain what I want to achieve. You had better put trying to explain what I want a photo.

Image

You could say that what I want is, instead of choosing a variable.

Image

Assign a value has a variable but we walk on an array.

Really sorry, I hope you understand me because the images without knowing English I can not express what I want to accomplish.

I hope your help Thanks.
You do not have the required permissions to view the files attached to this post.
B
6
G
1
Posts: 15
Reputation: 405

Post » Sat Mar 15, 2014 3:14 am

See if this is any help or not. Not sure.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Sat Mar 15, 2014 12:36 pm

thanks for help @blackhornet .

But what I need is to assign a value to an array variable array traveled by ie.

Array (1, 1) = Array (0, 1)
Variable = String Text
cristal_LVL = wood

That's what I need

I hope someone can help me.
B
6
G
1
Posts: 15
Reputation: 405

Post » Sat Mar 15, 2014 2:17 pm

Still not entirely clear what want, but maybe something in this one will help. If not, maybe just write it in the programming language you are used to, and that may be quicker to convert.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Sat Mar 15, 2014 2:41 pm

Really @blackhornet Thank you, but it is not that.

Do not explain to me the language.

I'll try again.

In your example arrayDemo_BHTB

you define Set cristal_LVL to Array.at (0.0)

Then when I have 50 mines or buildings construction. We'll have to program each.

However what I want is to program in Array 1 time per cycle and then adding the value you deserve. And if I decide to go from 50-68 buildings, not I have to change anything. Only the array.

At the end of the day I need to assign a value to a variable but instead of selecting the variable in this way.

Image

You can select the variable by an array cycle.
instead of defining a select so you can define it by code

Array (1, 1) = Array (0, 1)
B
6
G
1
Posts: 15
Reputation: 405

Post » Sat Mar 15, 2014 3:48 pm

Event 5 is setting Array(1,y) to Array(0,y). Is that not close to what you want? Or are you trying to search for the name "cristal" to get the index, and then get the value at the same index in (1,y)? In that case the Dictionary object may be a better option.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Sat Mar 15, 2014 4:35 pm

@blackhornet

I want to do this

Image

Not know how to explain. I hope someone gets me understand.

blackhornet thank you very much for helping me.

I will research the dictionary
B
6
G
1
Posts: 15
Reputation: 405

Post » Sat Mar 15, 2014 5:11 pm

That's exactly what event 5 is doing. You can't use Array.CurY because you need to only iterate in Y, not XY. The way to do it is with loopindex.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Sat Mar 15, 2014 5:39 pm

I think google translate is not very good jajaja.

I'm trying not select a variable literally.

Image
B
6
G
1
Posts: 15
Reputation: 405

Post » Sat Mar 15, 2014 10:17 pm

I need to fix it please.
B
6
G
1
Posts: 15
Reputation: 405

Next

Return to How do I....?

Who is online

Users browsing this forum: Alvaro2, Hadyurik, Yahoo [Bot] and 10 guests