Jump to content

Random Variable?


hlstriker
 Share

Recommended Posts

Is it possible to have a few variables, then have the send command use 1 of the variables?

Example:

I want a variable that contains different colors such as... red, purple, green, blue, and orange.

Then I would use the send command...

Send( "The random color is... " & $random )

Now is there any way I can get $random to display a random color when the send command is run?

Thanks in advance ;)!

Link to comment
Share on other sites

Heres how I would do it:

$random = Random(1, 5, 1)
If $random = 1 Then
   Send("blue")
ElseIf $random = 2 Then
   Send("red")
ElseIf $random = 3 Then
   Send("orange")
ElseIf $random = 4 Then
   Send("yellow")
Else
   Send("green")
EndIf
FootbaG
Link to comment
Share on other sites

:P

I've been working with php lately (reworking a school site from pure html to simple php stuff), so I've had to work with easy modifications to the site (god bless csv files :mad2:). I guess it gets you thinking of how not to use if...then statements for every option ;)

Edited by MSLx Fanboy

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...