Arrays could store strings?

0 favourites
  • 5 posts
From the Asset Store
This collection of music is the beautiful performance of rather small strings ensemble (8 first violins, 6 second violin
  • I tried a simple thing.

    System (on start of layout) -> Array (set value at 0 to "test")

                                -> Text (set text to str(Array.at(0))

    But text displayed "0" instead of "test".

    Could you help? Thanks.

  • Should work, you can lose the str() when getting value from the array.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The Array object does support strings. Are you sure you didn't make a zero sized array?

  • Thanks vee41 and Ashley. Actually my code is like that

    Empty event -> Array (set value at 0 to "test")

    System (on start of layout) -> Text (set text to str(Array.at(0))

    I'm planning a multi-level puzzle. All levels will share the same layout. I have an array that keeps all the levels info. When user skipped to new level, after the reset layout action, i don't want to reload array again.

    So i put an empty event an the top of the event sheet. But in event order it still works as second i think

  • I think arrays are global by default, so if you just load your array at the beggining of the game it shouldn't be a problem.

    Did you get this to work? I actually ran into something similar some time ago and I gave up when I noticed that the dictionary object was better for what I wanted to do (multiple lines of text).

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