Sign in to follow this  
Followers 0
GodForsakenSoul

Arrays?

4 posts in this topic

i have no idea what's an array. i would like someone to clarify if my dad understands what's an array because i asked him about the topic.

from what i understood from my dad, who has been playing abit with C++, an array is something like a square of data.

[_][_][_][_]

[_][_][_][_]

[_][_][_][_]

[_][_][_][_]

and some data sits in every square.

i can not figure out how to use them though.

if you could be so kind to try and explain arrays and how to use them in autoit (summoning and such) properly.

if you're going to try, please explain like i'm some sort of mentally retarded baby. :);

while i will not like that, it's the best way for me to understand something.

Share this post


Link to post
Share on other sites



Your Father is correct, that is a two-dimensional array.

So, lets start with basics, a single dimension array example

#include <Array.au3> ; for the display only

; Single dimension array

; Create the array
Dim $array[5] = ["4","here","now","brown","cow"]

; Access
For $x = 1 To UBound($array) -1 ; ubound finds the "total" 
    MsgBox(4096, $x, "$array number " & $x & " = " & $array[$x] & "   ", 5)
Next

; Display all
_ArrayDisplay($array)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You should check this, its about arrays, and it's for beginners. I learnt arrays from there.

Good luck :)

Edited by colafrysen

[font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size]

Share this post


Link to post
Share on other sites

You should check this, its about arrays, and it's for beginners. I learnt arrays from there.

Good luck ;)

Great wiki on how they work. Its still insanely hard to get it to work! :D

Basically what i wanted to do was to read the amount of lines from a .txt file, simple enough using a loop and FileReadLine. Now the problem came when i wanted to write the results into an array. The thing which made it so hard was that i would never know the size of the array. Started reading on the wiki and found some interesting code. However i just couldnt get it all to work in a while loop(FileReadLine dont seem to work outside a while loop?).

I tried mix in the FileReadLine in the For loop i got from the wiki but didnt work at all, the array results were always empty. At least the array got the size right, it just didnt write anything into the array values.

Anyway after lots of searching etc i found exactly what i were looking for!

#Include <File.au3>

_FileReadToArray()

My jaw dropped to the ground, exactly what i was looking for and it was all done with just a couple of lines :D

I do wonder how it would have looked without the above.

Still working on my "project". What its suppose to do when its done is to just copy files(lots) from one folder to another(overwrite if files exist).


"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
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
Sign in to follow this  
Followers 0