What I thought should be a very simple display solution does not seem to be working properly. While I'm sure there are easier methods for much of the code in the program (which I will explore after solving this issue), please just help me understand why the storepic and recallpic is not working. Basically, what happens is the square that displays to outline the current square doesn't display in the proper position once I implemented the if statement for clrdraw and recallpic. Without the store/recall code it works perfectly fine, so I'm at a bit of a loss here.
*The program is a well known game using 4 rows of 4 squares, each containing a number between 1-15 with one blank, where the user has to align the numbers in the correct order with the space ending in the bottom right corner. Of course much of the code is missing from here (including the sub program that creates and originally displays the list, but that will all come after this issue is solved). Thanks.
If you'd prefer to mess with the code yourself, I've uploaded the 2 programs to megaupload (not sure if I could to this site). I uploaded the working code, minus the if statements for recall/storepic just so you can get an idea of how the program works before messing with it. http://www.megaupload.com/?d=DOOE5K0J
Here's the code:
-----------------------
C = Current column number
P = Current position in list (generated by C and R)
R = Current row number
S = Square selected [0/1]
X = Line Top Left X Coord
Y = Line Top Left Y Coord
Theta = Temp var //used for proper square alignment
L1=List of numbers 1-16
L2=X pos diff between squares //used for alignment
L3=Y pos diff between squares //used for alignment
-----------------------
Lbl 1:StorePic 1
-6.5>X:7>Y:1>C
1>R:DelVar S
{3.3,3.4,3.6>L2
{3.2,3.2,3.3>L3
While S=0
getKey>Z
**If Z!=0:Then
**StorePic 1:End
C+4(R-1)>P
(Z=105)(L1(P)!=16>S
If Z=26 and C!=4:Then
X+L2(C>X
C+1>C:End
If Z=24 and C!=1:Then
C-1>C
X-L2(C>X:End
If Z=34 and R!=4:Then
Y-L3(R>Y
R+1>R:End
If Z=25 and R!=1:Then
R-1>R
Y+L3(R>Y:End
Line(X,Y,X+2.5,Y
Line(X,Y-2.5,X+2.5,Y-2.5
Line(X,Y,X,Y-2.5
Line(X+2.5,Y,X+2.5,Y-2.5
**If Z!=0:Then
**ClrDraw
**Recallpic 1:End
2.4-.2(P=1)-.2(P=5)-.2(P=9)-.2(P=13>Theta
Line(X+.2,Y-.2,X+.2,Y-2.2
Line(X+.2,Y-.2,X+Theta,Y-.2
Line(X+Theta,Y-.2,X+Theta,Y-2.2
Line(X,Y-2.2,X+Theta,Y-2.2
** = Code that is making the program act weird.