dazza Posted March 2, 2009 Share Posted March 2, 2009 This code returns an error: Dim $array[100][20][30] $array[1][1][1] = "cake" ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: Can I not use 3d arrays? Link to comment Share on other sites More sharing options...
cageman Posted March 2, 2009 Share Posted March 2, 2009 that code doesn't give any error. you can use up 64 dimensions ( got that directly from the helpfile ) i tested the code myself and works fine for me. Link to comment Share on other sites More sharing options...
CodyBarrett Posted March 2, 2009 Share Posted March 2, 2009 as far as i know autoit doesnt support 3D Arrays [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
weaponx Posted March 2, 2009 Share Posted March 2, 2009 (edited) as far as i know autoit doesnt support 3D ArraysSure it does, it actually supports up to 64 dimensions.http://www.autoitscript.com/autoit3/docs/faq.htm#15 Edited March 2, 2009 by weaponx Link to comment Share on other sites More sharing options...
BlackPhoenix Posted March 2, 2009 Share Posted March 2, 2009 This code returns an error: Dim $array[100][20][30] $array[1][1][1] = "cake" ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: Can I not use 3d arrays? #include <Array.au3> Dim $array[100][20][30] $array[1][1][1] = "cake" Msgbox(0,'Arraytest','Array contains:'&$array[1][1][1]) It works, try that code Link to comment Share on other sites More sharing options...
SpookMeister Posted March 2, 2009 Share Posted March 2, 2009 (edited) #include <Array.au3> Dim $array[100][20][30] $array[1][1][1] = "cake" Msgbox(0,'Arraytest','Array contains:'&$array[1][1][1]) It works, try that code You do not need to include array.au3 for that example, only needed if you want to use special array functions like _ArraySort or _ArrayDisplay etc. [edit] typo Edited March 2, 2009 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
weaponx Posted March 2, 2009 Share Posted March 2, 2009 You don't need array.au3, especially since it has no functions for arrays over 2 dimensions. Link to comment Share on other sites More sharing options...
BlackPhoenix Posted March 2, 2009 Share Posted March 2, 2009 You do not need to include array.au3 for that example, only needed if you want to use special array functions like _ArraySort or _ArrayDisplay etc. [edit] typoYeah you're right. ^^ Link to comment Share on other sites More sharing options...
dazza Posted March 2, 2009 Author Share Posted March 2, 2009 (edited) Aha! You cannot use the upper limit. So $array[100][1][1] returns an error whilst $array[99][1][1] doesn't So I have to dim the array as: Dim $array[101][21]31] Thanks for the feedback guys Edited March 2, 2009 by dazza Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted March 2, 2009 Share Posted March 2, 2009 But you can use the upper limit, you have to remember that arrays start at 0, so if you create the array as Dim $array[100] the highest will be 99. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
SpookMeister Posted March 2, 2009 Share Posted March 2, 2009 For Example: Dim $array[3] creates these three array elements: $array[0] $array[1] $array[2] Trying to access $array[3] will give you an error because it does not exist [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
dazza Posted March 3, 2009 Author Share Posted March 3, 2009 Sorted! Many thanks. 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