Help meeeeeeEE random text in my gamme!

For questions about using Classic.

Post » Mon Mar 28, 2011 4:22 pm

Well.. I want to insert a random text if i Click on a button (there are 29text) . I want insert one of them (randomm) In the specify position
How Do I??? HElP ME PLEASE!!!! Sorry for my translate into english but I'm Italian
B
1
G
1
Posts: 7
Reputation: 439

Post » Mon Mar 28, 2011 5:03 pm

You could simply have a string containing all your words with the default delimiter.

car,fence,loophole,bat,cigarette,opium,bottle,wheel,...

Then if you used the gettoken expression like so

Gettoken(string,4)

would return "bat" in case of this example. Get it?

You could insert a random word easily into sentence for example:

"He opened the trunk and there it was: a giant "&Gettoken(string,Random(Numtokens(string)+1))

The Numtokens expression counts the number of tokens, the plus one is there because the Random expression is 0-based.

Hope that helped!
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 9 guests