How do I choose a phrase of random text for text box?

Get help using Construct 2

Post » Tue May 12, 2015 1:15 am

Hello,

I need the user to push a button and a text box become populated with a random phrase. I'm guessing it would be a string of phrases with separators of some sort with the random function. Anyone have example code or .capx?

Thanks!
Image
B
11
S
2
G
1
Posts: 40
Reputation: 746

Post » Tue May 12, 2015 8:00 am

you could use choose()

on button clicked set text to = choose("this is the first line", "This is the second line", "this is the third line")

another way would be to put the sentences in a dictionary object and use the TokenAt expression.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests