Metropoli BBS
VIEWER: msg.pps MODE: TEXT (LATIN1)
String Logo(20),Prompt(20),Name(20),Input,buffer
Integer Line,Key,Last

Declare Procedure BuildList()
Declare Procedure ShowNames()
Declare Procedure ShowLogo()
Declare Procedure ProcessInput(INTEGER Input)
Declare Procedure ProcessKey(INTEGER iOne, INTEGER iTwo, INTEGER iGoTo, INTEGER iRow)
Declare Procedure ShowLine(INTEGER iRow, STRING sColor1, STRING sString, STRING sColor2, INTEGER iLen)

*$USEFUNCS

BEGIN
   BuildList()
   ShowNames()
   ShowLogo()
   :loop
      ANSIPOS 1,GETY()
      Input = ""
      While (Input = "") do
        Delay 2
        Input = Inkey()
      EndWhile
      ProcessInput(Input)
   goto loop
END


Procedure ProcessInput(STRING Input)
   Select Case Input
     Case Chr(13)
       Key = GetY()
       Cls
       KbdStuff "E"+Chr(13)+Name(Key)+Chr(13)
       End
     Case "Q","q",Chr(27)
       Cls
       End
     Case "UP"
       ProcessKey(1,(GETY()-1), LAST,(GETY()-1))
       return
     Case "DOWN"
       ProcessKey((GETY()+1), LAST,1, (GETY()+1))
       return
   End Select
EndProc


Procedure BuildList()
   FOpen 1,PPEPath()+"MSG.CFG",O_RD,S_DN
   Line = 1
   While ((!Ferr(1))&&(Line < 21)) do
     FGet 1,buffer
     IF (instr("//==",left(buffer,2))==0) THEN
        Prompt(Line)=trim(left(buffer,24)," ")
        Name(Line)=trim(left(buffer,24)," ")+Mid(buffer,25,15)
        Inc Line
     ENDIF
   EndWhile
   FClose 1       
   IF (FileInf(PPEPath()+"LOGO.CFG",1)==TRUE) THEN
      FOpen 2,PPEPath()+"LOGO.CFG",O_RD,S_DN
      Line = 1
      While ((!Ferr(1))&&(Line < 21)) do
        FGet 2,logo(Line)
        Inc Line
      EndWhile
      FClose 2
   ENDIF
EndProc

Procedure ShowNames()
   Line = 1
   Cls
   While (Prompt(Line) <> "") do
      PrintLn "@X0E","   ","@X0F",Left(Prompt(Line),24),"@X07"
      Inc Line
   EndWhile
   Last = (GetY()-1)
   PrintLn Chr(13)
   PrintLn "@X0A   Use the arrow keys to highlight the subject, then press `Enter' @X0A(@X0EQ@X0A) = Quit@X07"
   AnsiPos 1,1
   Print "@X3F","©>>","@X3E",Left(Prompt(1),24),"@X07"
EndProc

Procedure ShowLogo()
   Line = 1
   While (Logo(Line) <> "") do
      AnsiPos 30,Line
      PrintLn Logo(Line)
      Inc Line
   EndWhile
   AnsiPos 1,1
EndProc

Procedure ProcessKey(INTEGER iOne, INTEGER iTwo, INTEGER iGoTo, INTEGER iRow)
    IF (iOne > iTwo) THEN
       ShowLine(GETY(),"@X0E","   ","@X0F",24)
       ShowLine(iGoTo,"@X3F","©>>","@X3E",24)
       Input = ""
       return
    ENDIF
    ShowLine(GETY(),"@X0E","   ","@X0F",24)
    ShowLine(iRow,"@X3F","©>>","@X3E",24)
EndProc

Procedure ShowLine(INTEGER iRow, STRING sColor1, STRING sString, STRING sColor2, INTEGER iLen)
    ANSIPOS 1,iRow
    PRINT sColor1,sString,sColor2,left(Prompt(GetY()),iLen),"@X07"
EndProc
[ RETURN TO DIRECTORY ]