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

Get help using Construct 2

Post » Mon Oct 17, 2016 1:29 am

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.
B
19
S
4
G
2
Posts: 97
Reputation: 2,244

Post » Mon Oct 17, 2016 2:44 am

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.
B
122
S
42
G
40
Posts: 846
Reputation: 27,994

Post » Mon Oct 17, 2016 3:52 am

andreyin wrote: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!!
B
19
S
4
G
2
Posts: 97
Reputation: 2,244


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests