0 Favourites

Set Value Variable - Array - help please

  • 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.

    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.

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

    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.

  • See if this is any help or not. Not sure.

  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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.

    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)

  • 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.

  • blackhornet

    I want to do this

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

    blackhornet thank you very much for helping me.

    I will research the dictionary

  • 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.

  • I think google translate is not very good jajaja.

    I'm trying not select a variable literally.

  • I need to fix it please.

  • danhanfry I don't understand what do you need... Do you speak Spanish? If so pm me and then if I can't help you whit issue it's possible I will be able to help you showing your issue in forum to get help in English...

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