0 Favourites

How do I check if a line of text is displaying?

  • I have Ajax request a text file --- trim(tokenat(Dictionary.Get("ReadData"),random(0,300),";")) --- as you can see it's randomized so any of the 301 lines could be displayed upon System Create Object Text and Text display one of these lines.

    I needed to check which line is being displayed so that I could create another event based on which line is displayed.

    Hope I made myself clear. thanks and help if you can.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I'm not sure where are you going with this but you could create a temp variable that takes the random number and compare it later. Also the random function will generate decimals so you have to use int, floor or ceil to round it.

    For instance:

    Set varrandom to floor(random(0,300))

    Set whatever to trim(tokenat(Dictionary.Get("ReadData"),varrandom,";"))

    Since you've set the varrandom to a random number, you can compare this number so you can tell which line it got.

  • I'm not sure where are you going with this but you could create a temp variable that takes the random number and compare it later. Also the random function will generate decimals so you have to use int, floor or ceil to round it.

    For instance:

    Set varrandom to floor(random(0,300))

    Set whatever to trim(tokenat(Dictionary.Get("ReadData"),varrandom,";"))

    Since you've set the varrandom to a random number, you can compare this number so you can tell which line it got.

    I am making this game basically with questions and answers and instead of creating several documents, which would be excrutiating, I want to have it in one document so that when the player chooses a certain answer to a question there will be a reply to that answer, this reply has to match the answer he chose. A little consfusing but your insight will work fine for me. I am going to try it.

    Thank you a lot!!

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