Sign in to follow this  
Followers 0
jokke

2d array failing.

3 posts in this topic

#1 ·  Posted (edited)

Hiya, trying to create a 2d array. and for some reason i can create it like this:

#include <array.au3>
#include <GuiConstants.au3>

Global $pic[8][15]

Dim $adder,$adder2,$x,$i

GUICreate('Mappergrid',500,500)


For $i = 1 To 8 Step +1
    For $x = 1 to 14 step +1 
        $pic[$i][$x] = GUICtrlCreatePic(@ScriptDir&'\img\none.bmp',5+$adder,5+$adder2,25,25)
        $adder = $adder + 26
    Next
    $adder = 0
    $adder2 = $adder2 + 26
Next

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd
oÝ÷ Ù»­ø¢+eG­+'¢Û('Á¬ºÚ"µÍÚ[ÛYH   Ø^K]LÉÝÂÚ[ÛYH ÑÝZPÛÛÝ[Ë]LÉÝÂÛØ[    ÌÍÜXÖÎVÌMWB[H ÌÍØY ÌÍØY ÌÍÞ  ÌÍÚBÕRPÜX]J    ÌÎNÓXÜY ÌÎNË
L
L
BÌÍÚHH   ÌÍÚH
ÌBQÜ  ÌÍÞHHÈMÝ
ÌHBIÌÍÜXÖÉÌÍÚWVÉÌÍÞHHÕRPÝÜX]TXÊØÜ[ÉÌÎNÉÌLÚ[YÉÌLÛÛK ÌÎNË
JÉÌÍØY
JÉÌÍØYKJBBIÌÍØYH ÌÍØY
ÈS^IÌÍØYHIÌÍØYH  ÌÍØY
ÈBÌÍÚHH ÌÍÚH
ÌBQÜ  ÌÍÞHHÈMÝ
ÌHBIÌÍÜXÖÉÌÍÚWVÉÌÍÞHHÕRPÝÜX]TXÊØÜ[ÉÌÎNÉÌLÚ[YÉÌLÛÛK ÌÎNË
JÉÌÍØY
JÉÌÍØYKJBBIÌÍØYH ÌÍØY
ÈS^IÌÍØYHIÌÍØYH  ÌÍØY
ÈÌÍÚHH  ÌÍÚH
ÌBQÜ  ÌÍÞHHÈMÝ
ÌHBIÌÍÜXÖÉÌÍÚWVÉÌÍÞHHÕRPÝÜX]TXÊØÜ[ÉÌÎNÉÌLÚ[YÉÌLÛÛK ÌÎNË
JÉÌÍØY
JÉÌÍØYKJBBIÌÍØYH ÌÍØY
ÈS^IÌÍØYHIÌÍØYH  ÌÍØY
ÈÕRTÙ]Ý]J
BÚ[HBIÌÍÛÙÈHÕRQÙ]ÙÊ
BRY ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑH[^]Ñ[

Anyone have any idea?

All help apreciated :whistle:

Edited by jokke

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

Share this post


Link to post
Share on other sites



Your first dimension kept getting exceeded because you said it was an eight element first dimension. Your for loop made the first dimension go up to a value of eight, but that can't be because an eight element first dimension can only go up to seven because the dimensions always start their numbering at 0, not one.

#include <array.au3>
#include <GuiConstants.au3>

Global $pic[8][15]

Dim $adder,$adder2,$x,$i

GUICreate('Mappergrid',500,500)


For $i = 0 To 7 Step 1
    For $x = 0 to 14 step 1
        $pic[$i][$x] = GUICtrlCreatePic(@ScriptDir&'\img\none.bmp',5+$adder,5+$adder2,25,25)
        $adder += 26
    Next
    $adder = 0
    $adder2 += 26
Next

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Your second for loop didn't error, but it also completely ignored the first element of the second domain every time it passed. I fixed it and it now starts at 0 as well. I also made your variable self adding statements less awkward by using the += operator.


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

Hiya, thanks alot, finaly you made my brain able to wrap around this, thank you :whistle:


UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

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