AlmarM Posted March 19, 2009 Share Posted March 19, 2009 (edited) Hi!Mayby just a stupid thing, but I cant see it.Whats wrong with this?Func _RandomColor() $Random = Random(1, 6) Switch $Random Case 1 $_NewColor = $_Red Case 2 $_NewColor = $_Yellow Case 3 $_NewColor = $_Green Case 4 $_NewColor = $_Blue Case 5 $_NewColor = $_Purple Case 6 $_NewColor = $_Orange EndSwitch Return $_NewColor EndFuncERROR:\Documents and Settings\xxxx\Bureaublad\Test File.au3 (151) : ==> Variable used without being declared.: Return $_NewColor Return ^ ERRORAlmarMNew problem. See post #3! Edited March 19, 2009 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Marlo Posted March 19, 2009 Share Posted March 19, 2009 (edited) Maybe the _RandomColor() is being called somewhere in your script before the variable has been declared. Try this Func _RandomColor() Local $_NewColor Local $Random = Random(1, 6) Switch $Random Case 1 $_NewColor = $_Red Case 2 $_NewColor = $_Yellow Case 3 $_NewColor = $_Green Case 4 $_NewColor = $_Blue Case 5 $_NewColor = $_Purple Case 6 $_NewColor = $_Orange EndSwitch Return $_NewColor EndFunc Edited March 19, 2009 by Marlo Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
AlmarM Posted March 19, 2009 Author Share Posted March 19, 2009 (edited) Nope, and I already got it. It was the random.Random(1, 6, 1)AlmarMEDIT:My next problem, how do I reset the color of a graphic? Edited March 19, 2009 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
AlmarM Posted March 19, 2009 Author Share Posted March 19, 2009 Nevermind! I found out, now I still have some problems with the Graphics. AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 19, 2009 Share Posted March 19, 2009 What problem? Why not ? ConsoleWrite(_RandomColor() & @CRLF) Func _RandomColor() Local $colors[3] = ['00FF00', '0000FF', 'FF0000'] ; just example Return '0x' & $colors[Random(0, UBound($colors)-1 , 1)] EndFunc Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
AlmarM Posted March 19, 2009 Author Share Posted March 19, 2009 What problem? Why not ? ConsoleWrite(_RandomColor() & @CRLF) Func _RandomColor() Local $colors[3] = ['00FF00', '0000FF', 'FF0000'] ; just example Return '0x' & $colors[Random(0, UBound($colors)-1 , 1)] EndFunc MegaYeah thx And about the problem, could I add you on MSN? Talks alot easier PM me for email k ? AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 20, 2009 Share Posted March 20, 2009 Yeah thx And about the problem, could I add you on MSN?Talks alot easier PM me for email k ?AlmarMTry your luck via ICQ. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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