I wanna make a program that after a clic display some random text.
like I have these texts:
"text one"
"text two"
"text three"
"text four"
"text five"
So once y press a button it take me to a new page were it displays:
"{random}"
where "random" can be any of the five texts I have at random.
How?
Thanks!
Question about Random function.
Moderator: Neosoft Support
-
- NeoSoft Team
- Posts: 5628
- Joined: Thu Mar 31, 2005 10:48 pm
- Location: Oregon, USA
- Contact:
First create an array of variables for the text:
SetVar "[T0]" "text one"
SetVar "[T1]" "text two"
SetVar "[T2]" "text three"
SetVar "[T3]" "text four"
SetVar "[T4]" "text five"
Then you can choose one of the text strings at random like this:
Random "4" "[Rnd]"
SetVar "[RandomText]" "[T[Rnd]]"
The selected text will be stored in the variable [RandomText].
SetVar "[T0]" "text one"
SetVar "[T1]" "text two"
SetVar "[T2]" "text three"
SetVar "[T3]" "text four"
SetVar "[T4]" "text five"
Then you can choose one of the text strings at random like this:
Random "4" "[Rnd]"
SetVar "[RandomText]" "[T[Rnd]]"
The selected text will be stored in the variable [RandomText].
NeoSoft Support