Hey, a legitimate question! Dio Senior Member Posts: 650 Threads: 26 Joined: Aug 2004 03-03-2007, 08:43 AM It's about time... anyways, I see stuff like Code:`Dim a(100,100)` and i think to myself, "What it that comma doing in there?" I don't know how to use that and it look useful. does anyone know of a tutorial or somthing? i plan on making a minesweeper clone and this sounds like somthing i should learn. i have only known the subscript to have one number. quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote] Here DrV Posting Freak Posts: 1,439 Threads: 15 Joined: Apr 2003 03-03-2007, 08:59 AM That's a two-dimensional array. You can even have more than two dimensions if you want. Everything works just like a normal array, except when you reference an element, you have to give two (or more, if you are using more dimensions) indexes: Code:```dim arr(100, 100) arr(x, y) = 12``` Skyler Senior Member Posts: 421 Threads: 22 Joined: Oct 2005 03-03-2007, 06:05 PM Being math, you're not limited to three or even four dimensions- you can have ten or twenty-six, if you want. In the beginning, there is darkness â the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor phycowelder Member Posts: 121 Threads: 21 Joined: Oct 2005 03-03-2007, 08:03 PM i use them all the time! for X,Y locations! and graphic memory arrays! i even use more detailed ones like type arrays. eg. Code:`dim shared exitbut(0 to 1,4*(48*16)+4) as byte`a snippit for my two exit buttons from my MAPGEN.bas 0 and 1 is my button waiting and button pressed! 4*(48*16)+4 is the memory slot i needed for each pictures Eg. PUT (100,100), exitbut(0,0), PSET -pastes exit button one on the screen Code:`dim shared xandys(0 to 25,0 to 1) as short`this snippet from the same MAPGEN.bas i have 0-25 buttons and other graphics going on the screen and 0-1 is the X location and Y location! eg. PUT (xandys(10,0),xandys(10,1)), exitbut(0,0), PSET -pastes exit button one on the screen -10 is the X and Y value i wanted the exit button Code:`dim shared paltool(0 to 849,0 to 1,4*(16*16)+4) as byte`this was for my Brush for the tile painter, 0-849 = how many tiles it can hold in memory 0-1 = visable tile and mask tile 4*(16*16)+4= memmory to hold a 16x16 tile I hope this helps a little! if not i tryed or chalk me up to a retard, and i should keep my nose out of it!! t is better to error on the side of caution than the side of haste!!! Dio Senior Member Posts: 650 Threads: 26 Joined: Aug 2004 03-04-2007, 06:27 AM ok, so i'm trying this experiment: Code:```screenres 800,600,32,2,1 dim water(800,600) dim list(480000) for i = 0 to 2399   do     x = int(rnd*800):y = int(rnd*600)   loop until water(x,y) = 0   list(i) = water(x,y)   water(x,y) = 1   pset(x,y),255 next sleep do   i = int(rnd*2399) if water(x,y+1) = 0 then   water(x,y+1) = 1   water(x,y) = 0   pset(x,y-1),0   pset(x,y),255   list(i) = water(x,y) end if loop``` before, i had it just pick a random x and y and if that happened to be a blue pixel, it would move it down. but that was really slow. so i made List(480000) and used the first 2400. line eight seems to be te problem. quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote] Here phycowelder Member Posts: 121 Threads: 21 Joined: Oct 2005 03-04-2007, 07:34 AM Code:```do   i = int(rnd*2399) if water(x,y+1) = 0 then   water(x,y+1) = 1   water(x,y) = 0   pset(x,y-1),0   pset(x,y),255   list(i) = water(x,y) end if loop``` how do you check your WATER(X,Y) values! X and Y are always the same never changing! so nothing in the loop will change except line 21 which will always make your random list(i)=water(x,y) which i believe is always 0 t is better to error on the side of caution than the side of haste!!! Skyler Senior Member Posts: 421 Threads: 22 Joined: Oct 2005 03-04-2007, 07:41 AM Line 8 sets list(i) to 0. Every single time. Notice: Code:```do     x = int(rnd*800):y = int(rnd*600)   loop until water(x,y) = 0   list(i) = water(x,y)```I doubt that's what you want. Also, I don't think FB likes the size of the arrays you are dimming. I haven't had much luck with anything above 256x256. In the beginning, there is darkness â the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor phycowelder Member Posts: 121 Threads: 21 Joined: Oct 2005 03-04-2007, 08:04 AM i dont know about that! this allocates a full 800x600 screen in to memory of 16x16 pixels! and it is only one of about 40 arrays in my one program! it runs fast and smooth! Code:`dim shared paltool(0 to 849,0 to 1,4*(16*16)+4) as byte` t is better to error on the side of caution than the side of haste!!! Skyler Senior Member Posts: 421 Threads: 22 Joined: Oct 2005 03-04-2007, 05:17 PM Hmm, maybe it's just me, but my programs tend to exit on startup if I try to use a large array. By the way, phycowelder, is your period key broken? In the beginning, there is darkness â the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor phycowelder Member Posts: 121 Threads: 21 Joined: Oct 2005 03-04-2007, 08:05 PM lol sorry no! i just use "!" alot always have doent know y. i guess it how people realy know it its me ! ! ! ! ! ! ! ! ! ! t is better to error on the side of caution than the side of haste!!! « Next Oldest | Next Newest »