I want to make the application to display a message random before at close.
How Make this?
Thanks!
Develop games in your browser. Powerful, performant & highly capable.
You mean choose a random message from a set of pre-made messages?
the two!
I was trying to use SET text,
more i not have had success!
show me how to do it using set and pre-made messages?
then I see which is better!
You could add all of your messages to a list box, then get the text from a random line. Here's an example for how it could be done:
Random message example
you could also put all your messages in a hashtable, and name them message0, message1, message2, message3, for example, and then when you go to retrieve your message for the key, put in:
"message"&random(3)
Hum LinkMan, nice example , thanks,
but, I do not understand the example of lucid
Lucid, you can show me your example in CAP file?
Thank you.
click left mouse button to choose a random string
http://files.getdropbox.com/u/1013446/hashrandomexample.cap
after looking at the cap, this is how/why it works:
all you're doing is making a string by sticking together two parts
for instance
"hello,"&" how ya doin?"[/code:ulh6eztr] would add the strings and make it [code:ulh6eztr]"hello, how ya doin?"[/code:ulh6eztr] so when you get the values from the hashtable with [code:ulh6eztr]"msg"&random(4)[/code:ulh6eztr] it's picking a random number between 0 and 3 and sticking it on the end of the string "msg" making it end up as one of the strings that's set in start of layout by adding the random number to the end [code:ulh6eztr]"msg0" "msg1" "msg2" "msg3" [/code:ulh6eztr]
Ohh
Very Good Lucid.
Thank you very much!