Jump to content

Switch and Random Help


Recommended Posts

Switch $choice = Random(0, 2, 1)

I tried this multiple times in many differen't situations, and used consolewrite and $choice doesn't come up at all

Is this possible?

at first it was working, with Random(0, 1, 1) i was getting 0 and 1 but with this i get nothing.

Here is an example:

Local $choice
For $i = 10 to 1 step -1
    
    Switch $choice = Random(0, 2, 1)
        
        Case $choice = 0
        
            Consolewrite($choice)
            
        Case $choice = 1

            Consolewrite($choice)
            
        Case $choice = 2

            Consolewrite($choice)
            
    EndSwitch
        
Next

I don't know what i'm doing wrong, any help is appreciated.

Link to comment
Share on other sites

For $i = 10 To 1 Step - 1
    $choice = Random(0, 2, 1)
    Switch $choice
        Case $choice = 0
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
        Case $choice = 1
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
        Case $choice = 2
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
    EndSwitch
    ConsoleWrite(@TAB & "CHOICE BRU: " & $choice & @CRLF)
Next

Link to comment
Share on other sites

For $i = 10 To 1 Step - 1
    $choice = Random(0, 2, 1)
    Switch $choice
        Case $choice = 0
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
        Case $choice = 1
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
        Case $choice = 2
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
    EndSwitch
    ConsoleWrite(@TAB & "CHOICE BRU: " & $choice & @CRLF)
Next

That worked, Oddly enough i tried putting the $choice = Random(0, 2, 1) before switch and then Switch $choice but it didn't work before.

It works now though. Thanks.

... and stop editing your post backstabbed lol.. ;)

Edited by PoopDeck
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...