Latch,
After I printed out your replies and hung them on the wall in front of me, (believe me, it was very helpful
) I wrote some code and it works the way I want it to, but can you think of an easier way to check for the LowEnd and HighEnd values?
Rem * Title : Donald Smith
Rem * Author : Nov 1, 2022
REM *** Slot(X,1) holds the $$$ amounts in ascending order, bottom to top ***
REM *** Slot(X,2) if (X,2) = 0, the slot is useable & 1 if not ***
DIM Slot(10,2)
REM *** When clicked, this places the money in the slot clicked and ***
REM *** places the amount in Slot(X,1) ***
DIM MiddlePanel(10,2)
REM *** Draws the 10 slots ***
X = 235 : Y = 39
For Draw = 1 to 10
ink rgb(0,255,0),1
REM *** Stores the X & Y positions ***
MiddlePanel(11 - Draw,1) = X : MiddlePanel(11 - Draw,2) = Y
REM *** Clears the slots ***
Slot(11 - Draw,1) = 0 : REM *** This is the money portion ***
Slot(11 - Draw,2) = 0 : REM *** This is the flag, 0 if empty, 1 if not ***
REM *** This draws the outside line then the inside line ***
line x, y, x + 169, y
line x + 1 , y + 1, x + 168, y + 1
line x + 169, y ,x + 169, y + 30
line x + 168, y + 1 ,x + 168, y + 29
line x + 169, y + 30, x, y + 30
line x + 168, y + 29, x + 1, y + 29
line x, y + 30, x, y
line x + 1, y + 29, x + 1, y + 1
REM *** This draws the slot numbers in descending order ***
ink rgb(128,128,128),1
Num$ = STR$(11 - Draw)
set text font "Gulim"
set text size 12
if Draw = 1
center text 314,y + 5,"."
center text 319,y + 10,Num$
center text 327,y + 5,"."
else
if Draw >= 2 and Draw <= 10
center text 316,y + 5,"."
center text 320,y + 10,Num$
center text 325,y + 5,"."
endif
endif
Y = Y + 35
Next Draw
REM *** Draws the 10 slots ***
REM *** Change line 68 to a value in-between & the slot values in-between light up ***
REM *** Comment out line 70 & leave the Money value alone and the slot values below light up ***
REM *** Comment out line 71 & leave the Money value alone and the slot values above light up ***
Money = 30
Slot(3,1) = 11 : Slot(3,2) = 1
Slot(9,1) = 85 : Slot(9,2) = 1
ink rgb(0,0,0),1
box 0,455,639,479
ink rgb(0,128,0),1
set cursor 175, 459 : Print "In which slot do you want to place the ";"$";Money;",000?"
REM *** This section shows what slots are available for input ***
REM *** Checks to see if all the slots are empty ***
For EmptyCheck = 1 to 10
If Slot(11 - EmptyCheck,2) = 1 then goto NextTest
Next EmptyCheck
If EmptyCheck = 11
LowEnd = 1
HighEnd = 10
goto AllEmpty
endif
REM *** Checks to see if all the slots are empty ***
REM *** Checks for the HighEnd value ***
NextTest:
Compare = 10 : HighEnd = 0
HighCheckAgain:
If Slot(Compare,2) = 0 then goto NextValue1
If Slot(Compare,2) = 1
If Money < Slot(Compare,1) then HighEnd = Compare
endif
NextValue1:
Compare = Compare - 1
If Compare <> 0 then goto HighCheckAgain
If HighEnd = 0 then HighEnd = 11
If HighEnd = 0 then goto HighCheckDone
If Slot(HighEnd - 1) = 0 then HighEnd = HighEnd - 1
REM *** Checks for the HighEnd value ***
REM *** Checks for the LowEnd value ***
HighCheckDone:
Compare = 1 : LowEnd = 0
LowCheckAgain:
If Slot(Compare,2) = 0 then goto NextValue2
If Slot(Compare,2) = 1
If Money > Slot(Compare,1) then LowEnd = Compare
endif
NextValue2:
Compare = Compare + 1
If Compare <> 11 then goto LowCheckAgain
If Slot(LowEnd + 1) = 0 then LowEnd = LowEnd + 1
REM *** Checks for the LowEnd value ***
REM *** Shows the useable slots ***
AllEmpty:
X = 235
If HighEnd = 10 then Y = 39 else Y = 39 + ((10 - HighEnd) * 35)
For Draw = HighEnd to LowEnd step -1
ink rgb(0,120,0),1
box x + 3, y + 3, 308, y + 27
circle 320,y + 15,10
box 332,y + 3, x + 166, y + 27
Y = Y + 35
Next Draw
REM *** Shows the useable slots ***
REM *** This section shows what slots are available for input ***
set cursor 520,210 : Print "Money = ";Money
set cursor 520,240 : Print "LowEnd = ";LowEnd
set cursor 520,255 : Print "HighEnd = ";HighEnd
set cursor 520,285 : Print "Slot(1,1) = ";Slot(1,1)
set cursor 520,300 : Print "Slot(2,1) = ";Slot(2,1)
set cursor 520,315 : Print "Slot(3,1) = ";Slot(3,1)
set cursor 520,330 : Print "Slot(4,1) = ";Slot(4,1)
set cursor 520,345 : Print "Slot(5,1) = ";Slot(5,1)
set cursor 520,360 : Print "Slot(6,1) = ";Slot(6,1)
set cursor 520,375 : Print "Slot(7,1) = ";Slot(7,1)
set cursor 520,390 : Print "Slot(8,1) = ";Slot(8,1)
set cursor 520,405 : Print "Slot(9,1) = ";Slot(9,1)
set cursor 520,420 : Print "Slot(10,1) = ";Slot(10,1)
do:loop
Thanks, Donald