Jump to content

Arrays larger than 21 items?


Recommended Posts

The autoit helpfile lists the array limits as

Arrays: A maximum of 64 dimensions and/or a total of 16 million elements

Yet I cant seem to use arrays larger than 21 items.

I know that _ArrayCreate says it has a limit of 21 but as far as Im aware im not using _ArrayCreate.

Im sure I'm missing something simple here....

Link to comment
Share on other sites

HI,

needs beta. I ran into that myself. :D

Global $array[22] = ['', '1', '2' .... ]

So long,

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

  • Developers

Yes ?! :D

15. What are the current technical limits of AutoIt v3?

Here are details of the current technical limits of AutoIt. Please note that some of the limits are theoretical and you may run into performance or memory related problems before you reach the actual limit.

Maximum length of a single script line: 4,095

Maximum string length: 2,147,483,647 characters

Number range (floating point): 1.7E308 to 1.7E+308 with 15-digit precision

Number range (integers): 64-bit signed integer

Hexadecimal numbers: 32-bit signed integer (0x80000000 to 0x7FFFFFFF)

Arrays: A maximum of 64 dimensions and/or a total of 16 million elements

Maximum depth of recursive function calls: 384 levels

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yes ?! :wacko:

Sounds good to me, JdeB :D

I know of no other bounds unless as specified witch is high enough to use for most?

Edit:

kev51773, perhaps time to show your problems?

Edited by MHz
Link to comment
Share on other sites

You'll have to excuse my horribly messy code (or ignore it at least)

#include <file.au3>
#include <GUICONSTANTS.au3>
#include <array.au3>
#Include <process.au3>

;Initialize variables
Global $GUIWidth
Global $GUIHeight
Global $a_csv
Global $a_data[30]

;check for the existence of the csv file
$s_Path = @ScriptDir & "\levels.csv"
If FileExists($s_Path) Then
Else
    MsgBox(4096,"", "levels.csv does not exist.")
    Exit
EndIf

;Load csv here
_FileReadToArray($s_Path, $a_csv)
_ArraySort( $a_csv)
$number = (_ArrayMax( $a_csv, 0, 1)-1)

$GUIWidth = 400
$GUIHeight = 300

;Create window
GUICreate("EDITEDITEDITEDIT", $GUIWidth, $GUIHeight)

;Create a list box with level titles in it
$levellist = GuiCtrlCreateList("", 5, 5, 390, 200)
GUICtrlSetOnEvent($levellist, "NewItem")
$a = 1
While $a <= $number
$line = $a_csv[$a]
$split = StringSplit($line, ';')
For $i = 1 to $split[0]
_ArrayAdd( $a_data, $split[$i])
Next
;GuiCtrlSetData(-1, $split[1])
$a = $a + 1
Wend
_ArrayAdd( $a_data, "The End")
$index = _ArrayBinarySearch ( $a_data, "The End" );

For $i = 1 to ($index -1) Step 3
GuiCtrlSetData($levellist, $a_data[$i])
Next

;Create the runcommand label
GUICtrlCreateLabel ("Run Command",  5, 248, 80)

;Create the runcommand box
$Runcommand = GUICtrlCreateInput("", 80, 245, 315, 20)

$comments = GUICtrlCreateLabel ( "Comments", 5, 195, 390, 40 )

;Create a "Run" button
$Run_Btn = GUICtrlCreateButton("Run Level", 5, 270, 190, 25)
GUICtrlSetOnEvent($Run_Btn, "RunGame")

;Create a "CANCEL" button
$Cancel_Btn = GUICtrlCreateButton("Cancel", 205, 270, 190, 25)
GUICtrlSetOnEvent($Cancel_Btn, "CLOSEClicked")

;Show window/Make the window visible
GUISetState(@SW_SHOW)

Opt("GUIOnEventMode", 1)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

Func CLOSEClicked()
  Exit
EndFunc

Func NewItem()
$selected = GUICtrlRead ( $levellist )
For $i = 1 to ($index -1) Step 3
If $a_data[$i] = $selected Then
GuiCtrlSetData($Runcommand, $a_data[($i + 1)])
GuiCtrlSetData($comments, $a_data[($i + 2)])
EndIf
Next
EndFunc


Func RunGame()
$rundir = FileGetShortName ( @scriptDir )
$run = $rundir & "\game\" & GUICtrlRead ( $Runcommand )
_RunDOS( $run )
EndFunc


While 1
  Sleep(1000) ; Idle around
WEnd

Basically It should parse a csv file, and provide a menu. It works fine until their are 21 entries.

Thanks

Link to comment
Share on other sites

Hi,

Needs your csv too for a test run..

Randallc

csv can be anything really 3 columns separeated by semicolons

ie

1;2;3

4;5;6

7;8;9

10;11;12

It seems to require one blank at the end

Edited by kev51773
Link to comment
Share on other sites

What is wrong with 3.1.1.0 and arrays above 21 elements, th.meger?

Is this a UDF issue? I know of none.

Hi,

nothing. But I tried to create an array with more than 21 elements and didn't know the right way to write it. I asked it quite a while ago in the support area. And nobody really could help me. :D

But then Smoke_N helped out.

So long,

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

nothing. But I tried to create an array with more than 21 elements and didn't know the right way to write it. I asked it quite a while ago in the support area. And nobody really could help me. :D

But then Smoke_N helped out.

No problem. Seems you had or have some issues with arrays yourself. If Smoke_N was able to help then good. We are always there for a fellow member if you ever need help :wacko: .
Link to comment
Share on other sites

No problem. Seems you had or have some issues with arrays yourself. If Smoke_N was able to help then good. We are always there for a fellow member if you ever need help :D .

Thanks,

yeah I really HAD some issues, because it isn't/wasn't documented in the helpfile how to create an array bigger than 21 elements. I'd appreciate if somebody could amend the helpfile of _ArrayCreate with the typo ...

Global $big_Array[25] = ['', '1', '2', '3' ... '23', '24']

.. to make it clear and easy.

Just a thought.

So long,

Mega

Edit :@MHz : Germany will revenge Australia tonight. (Soccer WM)

Edited by th.meger

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

Edit :@MHz : Germany will revenge Australia tonight. (Soccer WM)

Ha, we will see. :wacko:

I see

Remarks

Arrays up to 21 elements are supported.

so _ArrayCreate() looks to be obsolete with the next beta version release as what you showed with "Global $big_Array[25] = ['', '1', '2', '3' ... '23', '24']"? That was just a parameter limit with _ArrayCreate() and not an array limit at all. Duly noted. Yep, the way of using beta is definitely better :D .
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...