===========================================================================
MSG.PPE - a PPE designed to give your callers a menu to choose from when
they enter a (C)omment to Sysop. This will let you have messages addressed
to the person on your system that takes care of a particular area of the
board.
============================================================================
INSTALLATION:
To install this PPE, create a new directory under your existing \PCB\PPE
directory called MSG. The resulting path will be \PCB\PPE\MSG. Copy all
the files from this archive into it. Then go into PCBSetup:File
Locations:Configuration Files, to the CMD.LST file. Hit F2 to edit the
file and you'll see something similar to this:
CMD.LST Editor
Charges Per PPE/MNU File Specification -or-
Command Sec Minute Use Keystroke Substitution
══════════════ ═══ ═════════════════ ═════════════════════════════════
1) CLS 0 0 0 C:\PCB\PPE\CLS.PPE
2) BR 0 0 0 H:\PCB\PPE\BROADCST\BR.PPE
3) RESTRICT 0 0 0 H:\PCB\PPE\UPLOAD\RESTRICT.PPE
4) V 0 0 0 C:\PCB\GEN\V.PPE
5) U 0 0 0 H:\PCB\PPE\UPLOAD\U.PPE
6) READ 0 0 0 R;O;A;Y;S^M
Hit Alt+I to insert a new line and enter:
2) C 0 0 0 C:\PCB\PPE\MSG\MSG.PPE
Once this is done, you'll need to set up the configuration file. It is
layed out like this:
Menu item
Name
with each line following the other. The Menu item can be up to 75
characters in length, and the name can be any name that has a valid user
record on the system. At this point you can bring your system back up
and run it. When your callers enter a "C" command for comment to Sysop
they'll be presented with this menu to re-direct the message to whoever
it should be addressed to.
============================================================================
EXPLAINATION OF CODE:
-Declare the variables used in the PPE
String Prompt(10),Response(10),Input
Integer Line,Key,Last
-Declare the procedure to make the arrow keys work for moving the menu
-highlight bar up and down the menu options.
Declare Procedure Down ()
Declare Procedure Up ()
-Open the configuration file and read through it to the end. Assign each
-line to a seperate variable so they can be used to build the menu and
-respond appropriately when the caller selects an option. Close the file.
FOpen 1,PPEPath()+"MSG.CFG",O_RD,S_DN
While (!Ferr(1)) do
FGet 1,Prompt(Line)
FGet 1,Response(Line)
EndWhile
FClose 1
-Build the menu and print the instructions at the bottom of the screen,
-then go back to the top and highlight the top entry, so it's the default
-selection.
Line = 1
Cls
While (Prompt(Line) <> "") do
PrintLn " @X0E",String(Line)," - @X0F",Left(Prompt(Line),50),"@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
PrintLn " @X3E",String(Line)," - @X3F",Left(Prompt(Line),50),"@X07"
-This is the section that actually does the work. It waits for the caller
-to press a key, then takes action based on what keystroke the caller has
-pressed. It takes whatever action is appropriate (moves the highlight bar
-up or down, quits, or selects the option based on the key pressed.
:Loop
Input = ""
While (Input = "") do
Delay 2
Input = Inkey()
EndWhile
Select Case Input
Case Chr(13)
Key = GetY()
KbdStuff Response(Key)
End
Case "Q","q"
Cls
End
Case "UP"
Up()
Goto Loop
Case "DOWN"
Down()
Goto Loop
End Select
Goto Loop
End
===========================================================================
-This is the procedure that moves the highlight bar up if the up arrow key
-is pressed. It re-draws the menu option in the default (white and yellow
-on black) colors, then moves up one position and re-draws that line in the
-highlight (white and yellow on cyan) colors. If the highlight bar is
-already at the top of the screen, it moves it down to the bottom of the
-screen and redraws that line.
Procedure Up()
IF ((GETY()-1) < 1) THEN
ANSIPOS 1,GETY()
PRINT " @X0F",GETY(),". - @X0E",Left(Prompt(GetY()),50),"@X07"
ANSIPOS 1,LAST
PRINT " @X3F",GETY(),". - @X3E",Left(Prompt(GetY()),50),"@X07"
Input = ""
Return
ENDIF
ANSIPOS 1,GETY()
PRINT " @X0F",GETY(),". - @X0E",Left(Prompt(GetY()),50),"@X07"
ANSIPOS 1,(GETY()-1)
PRINT " @X3F",GETY(),". - @X3E",Left(Prompt(GetY()),50),"@X07"
Input = ""
EndProc
-This is the procedure that moves the highlight bar down if the down arrow key
-is pressed. It re-draws the menu option in the default (white and yellow
-on black) colors, then moves down one position and re-draws that line in the
-highlight (white and yellow on cyan) colors. If the highlight bar is
-already at the bottom of the screen, it moves it up to the top of the
-screen and redraws that line.
Procedure Down()
IF ((GETY()+1) > LAST) THEN
ANSIPOS 1,GETY()
PRINT " @X0F",GETY(),". - @X0E",Left(Prompt(GetY()),50),"@X07"
ANSIPOS 1,1
PRINT " @X3F",GETY(),". - @X3E",Left(Prompt(GetY()),50),"@X07"
Input = ""
Return
ENDIF
ANSIPOS 1,GETY()
PRINT " @X0F",GETY(),". - @X0E",Left(Prompt(GetY()),50),"@X07"
ANSIPOS 1,(GETY()+1)
PRINT " @X3F",GETY(),". - @X3E",Left(Prompt(GetY()),50),"@X07"
EndProc