----------------------------------- cutecotton Tue Dec 24, 2002 5:38 pm too many variables? ----------------------------------- hi everyone, what i'm trying to do with my program is i'll have 5 litlte buttons, and the buttons will change when the user runs their mouse over it. So let's say for button 1 i have 2 variables for it, one contains the pic b4 the mouse is run over, the 2nd contains the pic that will be dispalyed when the mouse is over it. Now my question is, i'll have to do that for all 5 buttons, so does that mean i'll have to declare 10 variables? since i'll need 2 for each button? that seems to take a lot of...well variables and i don't know if there's a limit of the amoutn of varaibles i can declare. is there a more efficient way of doing this? or will i really have to declare a variable for every single pic i put on screen? :roll: ----------------------------------- Tony Tue Dec 24, 2002 6:20 pm ----------------------------------- try using arrays. var picID : array 1..5, 1..2 of int for i:1..5 for i2:1..2 picID(i,i2) := Pic.FileNew("image"+i+i2) end for end for that assuming you know what arrays are. ----------------------------------- cutecotton Tue Dec 24, 2002 6:22 pm ----------------------------------- *ahem* goes to find an array tutorial :oops: :shock: hmm...well i found an array tutorial and tried to understand it best as ic an..so from waht u posted.. var picID : array 1..5, 1..2 of int for i:1..5 for i2:1..2 picID(i,i2) := Pic.FileNew("image"+i+i2) end for end for u have 5 variables, and within them there's 2. What i dont' get is this line: picID(i,i2) := Pic.FileNew("image"+i+i2) I undersantd the Pic.FileNew, and then u put hte filename in replacement of image, but wha'ts the +i+i2 thing? [/code] ----------------------------------- Tony Tue Dec 24, 2002 6:29 pm ----------------------------------- var arrayname : array first demention , second demention , etc of type where dementions are ranges such as 1..10 (1 to 10) and work same as in for loop type is string/int/real/etc array variable is accessed using arrayname(1st demention , 2nd demetion) as in arrayname(5,2) ----------------------------------- cutecotton Tue Dec 24, 2002 6:36 pm ----------------------------------- ooo i get it...*kinda* have to test it out myself to se eif it works..will post back in a few minutes ^^ ----------------------------------- cutecotton Tue Dec 24, 2002 6:43 pm ----------------------------------- right..so now what do i do if i wanna use the variables and make them show up? sof ar i go: var buttons : array 1 .. 5, 1 .. 2 of int for b1 : 1 .. 5 for b2 : 1 .. 2 buttons (b, b1) := Pic.FileNew ("lvl1a.bmp") end for end for loop Mouse.Where (x, y, b) if x >= 60 and x = 130 and y