Need help with text problem?

0 favourites
  • 6 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Question1

    I have an offscreen text object(1) that is made up of 10 paragraphs.

    When the player clicks on a button (1 to 12) I want the a second text object to display the chosen paragraph (button number)

    Couldnt find anything on the forums.

    Question 2

    If the above cannot be done, can i use the webstorage or ajax object to achieve this?

    Thanks in advance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sounds like you could use an array there.

    One paragraph/cell.

    When clicking a button, you set text(2) to the value of the correct cell (the paragraph you're aiming for).

    You would have to fill the array at some point, but your question doesn't let know much about your implementation, so hard to tell.

    You could always fill a text object and "analyze" its content with system expressions like tokenat.


    Webstorage would allow you to store the paragraphs as 10 keys, and be able to (like with an array) to pull out the value/paragraph when needed.

    Nevertheless, you would have first to save the 10 keys for this to work.

    Ajax would allow you to send only the paragraph you need.

    Ex: click button 3

    Send a request to your webserver "I_Want_Paragraph", parameter 3

    Returns the paragraph.

    Get this data and display it in the text(2).

    I hope I make sense and that my explanation is clear.

    From what you ask/tell, I'd say the array is the better solution.

    But I might be wrong. Hope I gave you some clues.

  • Kyatric@

    'You could always fill a text object and "analyze" its content with system expressions like tokenat.'

    This sounded like the best(easiest) option, but i doesnt seem to work.

    As a test, I tried the example in 'system expressions':

    tokenat(src, index, separator)

    Return the Nth token from src, splitting the string by separator. For example, tokenat("apples|oranges|bananas", 1, "|") returns oranges.

    Here is a screen shot after i entered the information in my project:

    <img src="" border="0" />

    Yann@ (BUILT IN R71)

    Thanks for the example, but I am still using R70. I downloaded R71 but not installed it yet, after seeing a few ' fixed in next build ' posts about it.

  • I just got it to work.

    tokenat("one/two/three", 2, "/")

    gave me the result: three


  • Well... That's what I did, but using newline as a separator...

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