Vindicator209 Posted June 9, 2008 Share Posted June 9, 2008 Sorry I'm new to this whole dimension thing, but whats wrong with this: Dim $A[30][30] For $x = 0 to 30 For $y = 0 to 30 $A[$x][$y] = GUICtrlCreatePic($Tiles & "Empty.bmp",$x * 25,$y *25,25,25) Next Next I figure its something with the Dim line [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] Link to comment Share on other sites More sharing options...
GEOSoft Posted June 9, 2008 Share Posted June 9, 2008 Sorry I'm new to this whole dimension thing, but whats wrong with this: Dim $A[30][30] For $x = 0 to 30 For $y = 0 to 30 $A[$x][$y] = GUICtrlCreatePic($Tiles & "Empty.bmp",$x * 25,$y *25,25,25) Next Next I figure its something with the Dim lineYou will probably have to change the dim to [31][31] But you should change For $x = 0 to 30 to For $x = 0 To Ubound($A)-1 George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Vindicator209 Posted June 9, 2008 Author Share Posted June 9, 2008 (edited) Thanks... but what exactly doest that do? Edited June 9, 2008 by VindicatorOmega [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] Link to comment Share on other sites More sharing options...
JRowe Posted June 9, 2008 Share Posted June 9, 2008 For $x = 0 Starts the iteration (loop) at 0, To Ubound($A)-1 Iterates (loops) through values of x until it reaches Ubound($A)-1 Which is a way of determining the upper bound(the actual number of elements) of the array $A, minus one, so that you will never try to iterate through the loop more times than there are elements in the array. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Vindicator209 Posted June 9, 2008 Author Share Posted June 9, 2008 Ah, thanks. I can't believe I dodn't look that up earlier, that would have helped me so much in other projects.. lol [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] Link to comment Share on other sites More sharing options...
GEOSoft Posted June 9, 2008 Share Posted June 9, 2008 (edited) If the first element contains Data and not the number of elements then you use Ubound. It depends on how the array is built. For example StringSplit uses Array[0] to hold the number of elements so you can use For $I = 1 To array[0] or if the number of elements is known you can use For $I = 1 To Number of Elements. In all situations you can use Ubound(Array) -1. The onnly thing that may change is the first element that contains data. It could be either 1 or 0. Edited June 9, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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