PoopDeck Posted August 20, 2008 Share Posted August 20, 2008 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 More sharing options...
Glyph Posted August 20, 2008 Share Posted August 20, 2008 (edited) Local $choice For $i = 10 to 1 step -1 $choice = Random(1, 3, 1) Consolewrite($choice) Next Edited August 20, 2008 by BackStabbed tolle indicium Link to comment Share on other sites More sharing options...
BrettF Posted August 20, 2008 Share Posted August 20, 2008 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 Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
PoopDeck Posted August 20, 2008 Author Share Posted August 20, 2008 (edited) Nope, backstabbed version didn't work let me try yours brett Edited August 20, 2008 by PoopDeck Link to comment Share on other sites More sharing options...
PoopDeck Posted August 20, 2008 Author Share Posted August 20, 2008 (edited) 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 August 20, 2008 by PoopDeck Link to comment Share on other sites More sharing options...
Triblade Posted August 20, 2008 Share Posted August 20, 2008 If you use Switch then Case $choice = 0 is wrong. That should be: Case 0 Cause Switch allready knows it's about $choice. My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now