home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 005 / autop2_0.zip / AUTOPLUS.PPS < prev    next >
Text File  |  1994-11-18  |  14KB  |  519 lines

  1. ;*******************************************************************************
  2. ;*                                                                             *
  3. ;*                               Autoplus.PPE                                  *
  4. ;*                           Written by Kyle Eli                               *
  5. ;*                                                                             *
  6. ;*******************************************************************************
  7.  
  8. ;*******************************************************************************
  9. ;*                                                                             *
  10. ;* This is a easy-to-use and popular addition to PCBoard BBSs. Will allow user *
  11. ;* to enter a message that will be seen every time someone logs on.            *
  12. ;*                                                                             *
  13. ;* NEW to 2.0                                                                  *
  14. ;*  Basically nothing. Just re-wrote the code from scratch and cleaned it up a *
  15. ;*  a little. Also used the new FUNCTIONS/PROCEDURES.                          *
  16. ;*                                                                             *
  17. ;* COMING SOON to 2.5 (4th Quarter '94 - 1st Quarter '95)                      *
  18. ;*  + RIP Support                                                              *
  19. ;*  + Arrow-key Interface                                                      *
  20. ;*  + Sysop Configuration                                                      *
  21. ;*  + Word Filtering                                                           *
  22. ;*                                                                             *
  23. ;*******************************************************************************
  24.  
  25. ;***********************************
  26. ;* Declare Functions and Procedures
  27. ;*
  28.  
  29. DECLARE PROCEDURE display_message()                      ;Displays the Automessage
  30. DECLARE PROCEDURE display_menu()                         ;Displays Menu Selections
  31. DECLARE PROCEDURE new_message()                          ;Makes a new message
  32. DECLARE PROCEDURE reply_message()                        ;Replies to a message
  33. DECLARE FUNCTION  getch() STRING                         ;Gets user Input (Thanks CDC)
  34.  
  35. *USEFUNCS
  36.  
  37. ;***********************************
  38. ;* Declare Global Variables
  39. ;*
  40.  
  41. STRING automessage
  42. STRING selection
  43. STRING YourName
  44. STRING firstname
  45. STRING lastname
  46.  
  47. BEGIN
  48.  
  49.     ;Initialize all Global Variables
  50.       automessage = PPEPATH()+"AUTOM.PLS"             ;Change this to suit you
  51.  
  52.           yourname = U_NAME()
  53.       Tokenize yourname
  54.       gettoken firstname
  55.       gettoken lastname
  56.  
  57.        :DO_IT
  58.        display_message()
  59.        display_menu()
  60.        getuser
  61.        while (UPPER(selection) != "G") do             ;While the user has not entered G
  62.  
  63.         selection = getch()                       ;Get User Input
  64.  
  65.         SELECT CASE (selection)                   ;Act on User Input
  66.  
  67.                CASE "Q","q"
  68.              GOTO END
  69.                CASE "N","n"
  70.              new_message()
  71.              goto do_it
  72.                CASE "R","r"
  73.              reply_message()
  74.              fclose 1
  75.              goto do_it
  76.         END SELECT
  77.        endwhile
  78.        GOODBYE
  79. :END
  80. END
  81.  
  82. ;***********************************
  83. ;* PROCEDURE reply_message Replies to a message
  84.  
  85. PROCEDURE reply_message()
  86.  
  87. STRING OldText[5]
  88. STRING QuotedText[2]
  89. STRING GarbageVar[4]
  90. STRING GarbageLine[3]
  91. STRING IsItQuoted
  92. DATE   Blah
  93. STRING ByWhom
  94. STRING ByWhomLast
  95. STRING WhoDunIt
  96. STRING WhoDunItLast
  97. String NewText[5]
  98. STRING today
  99. STRING PressIt
  100. STRING Cursor_Up
  101. STRING Cursor_Down
  102. STRING Your_name
  103. STRING SaveNew
  104. STRING OnLine
  105. STRING TextToQuote[2]
  106. INTEGER NewCounter
  107. INTEGER Counter
  108. INTEGER TICK
  109. INTEGER Point
  110.  
  111. Counter = 1
  112. NewCounter = 1
  113. Cursor_Up = "UP"
  114. Cursor_Down = "DOWN"
  115. Your_Name = U_NAME()
  116. Today = DATE()
  117. Point = 1
  118.  
  119.       GETUSER
  120.       FCLOSE 1
  121. Point = 2
  122. ;        WHILE (!FERR(1)) DO
  123. Point = 7777
  124.       FOPEN 1,Automessage,O_RW,S_DN
  125. Point = 3
  126.       FGET 1,GarbageLine[1]
  127.       FGET 1,GarbageLine[2]
  128.       FGET 1,GarbageLine[3]
  129. Point = 4
  130.       TOKENIZE GarbageLine[1]
  131.       GETTOKEN GarbageVar[3]
  132.       GETTOKEN GarbageVar[4]
  133.       GETTOKEN ByWhom
  134.       GETTOKEN ByWhomLast
  135.       TOKENIZE GarbageLine[2]
  136.       GETTOKEN GarbageVar[1]
  137.       GETTOKEN IsItQuoted
  138.       GETTOKEN GarbageVar[2]
  139.       IF (GarbageVar[2] = "NONE") THEN
  140.         GOTO GOONDUDE
  141.       ENDIF
  142.       GETTOKEN WhoDunIt
  143.       GETTOKEN WhoDunItLast
  144.       :GOONDUDE
  145.       IF (IsItQuoted = "YES") THEN
  146. Point = 5
  147.          FGET 1,QuotedText[1]
  148.          FGET 1,QuotedText[2]
  149.          FGET 1,OldText[1]
  150.          FGET 1,OldText[2]
  151.          FGET 1,OldText[3]
  152.          FGET 1,OldText[4]
  153.          FGET 1,OldText[5]
  154.       ELSEIF (IsItQuoted = "NO") THEN
  155. Point = 6
  156.          FGET 1,OldText[1]
  157.          FGET 1,OldText[2]
  158.          FGET 1,OldText[3]
  159.          FGET 1,OldText[4]
  160.          FGET 1,OldText[5]
  161.       ENDIF
  162. Point = 7
  163.       FCLOSE 1
  164. :Sub_1
  165.       Pressit = "BLAH"
  166.       CLS
  167.       If (Counter = 1) THEN
  168.        Tick = 1
  169.       ElseIf (Counter = 2) Then
  170.        Tick = 2
  171.       ENDIF
  172.       PRINTLN "@X0AUse The Arrow Keys to Select A Line. Press [@X02ENTER@X0A] To  "
  173.       PRINTLN "@X0AConfirm Your Choice. Choose Quote Line #@X09",Tick
  174.       PRINTLN ""
  175.       PRINTLN "@X0A┌─────────────────────────────────────────────────────┐"
  176.       PRINTLN "@X0A│                                                     │"
  177.       PRINTLN "@X0A│                                                     │"
  178.       PRINTLN "@X0A│                                                     │"
  179.       PRINTLN "@X0A│                                                     │"
  180.       PRINTLN "@X0A│                                                     │"
  181.       PRINTLN "@X0A└─────────────────────────────────────────────────────┘"
  182.       ANSIPOS 3,5
  183.       PRINT "@X0E"+OldText[1]
  184.       ANSIPOS 3,6
  185.       PRINT "@X08"+OldText[2]
  186.       ANSIPOS 3,7
  187.       PRINT "@X08"+OldText[3]
  188.       ANSIPOS 3,8
  189.       PRINT "@X08"+OldText[4]
  190.       ANSIPOS 3,9
  191.       PRINT "@X08"+OldText[5]
  192.       ANSIPOS 3,5
  193.       OnLine = 1
  194.       WHILE (Pressit != CHR(13)) DO
  195.         Pressit = getch()
  196.         IF (Pressit = Cursor_Up) THEN
  197.           IF (OnLine = 1) THEN
  198.         ANSIPOS 3,5
  199.         PRINT "@X08"+OldText[1]
  200.         ANSIPOS 3,9
  201.         PRINT "@X0E"+OldText[5]
  202.         OnLine = 5
  203.           ELSEIF (OnLine = 2) THEN
  204.         ANSIPOS 3,6
  205.         PRINT "@X08"+OldText[2]
  206.         ANSIPOS 3,5
  207.         PRINT "@X0E"+OldText[1]
  208.         OnLine = 1
  209.           ELSEIF (OnLine = 3) Then
  210.         ANSIPOS 3,7
  211.         PRINT "@X08"+OldText[3]
  212.         ANSIPOS 3,6
  213.         PRINT "@X0E"+OldText[2]
  214.         OnLine = 2
  215.           ELSEIF (OnLine = 4) Then
  216.         ANSIPOS 3,8
  217.         PRINT "@X08"+OldText[4]
  218.         ANSIPOS 3,7
  219.         PRINT "@X0E"+OldText[3]
  220.         OnLine = 3
  221.           ELSEIF (OnLine = 5) Then
  222.         ANSIPOS 3,9
  223.         PRINT "@X08"+OldText[5]
  224.         ANSIPOS 3,8
  225.         PRINT "@X0E"+OldText[4]
  226.         OnLine = 4
  227.           ENDIF
  228.         ELSEIF (PressIt = Cursor_Down) Then
  229.           IF (OnLine = 1) THEN
  230.         ANSIPOS 3,5
  231.         PRINT "@X08"+OldText[1]
  232.         ANSIPOS 3,6
  233.         PRINT "@X0E"+OldText[2]
  234.         OnLine = 2
  235.           ELSEIF (OnLine = 2) THEN
  236.         ANSIPOS 3,6
  237.         PRINT "@X08"+OldText[2]
  238.         ANSIPOS 3,7
  239.         PRINT "@X0E"+OldText[3]
  240.         OnLine = 3
  241.           ELSEIF (OnLine = 3) Then
  242.         ANSIPOS 3,7
  243.         PRINT "@X08"+OldText[3]
  244.         ANSIPOS 3,8
  245.         PRINT "@X0E"+OldText[4]
  246.         OnLine = 4
  247.           ELSEIF (OnLine = 4) Then
  248.         ANSIPOS 3,8
  249.         PRINT "@X08"+OldText[4]
  250.         ANSIPOS 3,9
  251.         PRINT "@X0E"+OldText[5]
  252.         OnLine = 5
  253.           ELSEIF (OnLine = 5) Then
  254.         ANSIPOS 3,9
  255.         PRINT "@X08"+OldText[5]
  256.         ANSIPOS 3,5
  257.         PRINT "@X0E"+OldText[1]
  258.         OnLine = 1
  259.           ENDIF
  260.         ENDIF
  261.       ENDWHILE
  262.       Counter = Counter + 1
  263.       IF (Online = 1) Then
  264.         IF (Counter = 2) Then
  265.           TextToQuote[1] = OldText[1]
  266.           GOTO Sub_1
  267.         ELSEIF (Counter = 3) Then
  268.           TextToQuote[2] = OldText[1]
  269.           GOTO End
  270.         ENDIF
  271.       ELSEIF (Online = 2) Then
  272.         If (Counter = 2) Then
  273.           TextToQuote[1] = OldText[2]
  274.           GOTO Sub_1
  275.         ELSEIF (Counter = 3) Then
  276.           TextToQuote[2] = OldText[2]
  277.           GOTO End
  278.         ENDIF
  279.       ELSEIF (Online = 3) Then
  280.         If (Counter = 2) Then
  281.           TextToQuote[1] = OldText[3]
  282.           GOTO Sub_1
  283.         ELSEIF (Counter = 3) Then
  284.           TextToQuote[2] = OldText[3]
  285.           GOTO End
  286.         ENDIF
  287.       ELSEIF (Online = 4) Then
  288.         If (Counter = 2) Then
  289.           TextToQuote[1] = OldText[4]
  290.           GOTO Sub_1
  291.         ELSEIF (Counter = 3) Then
  292.           TextToQuote[2] = OldText[4]
  293.           GOTO End
  294.         ENDIF
  295.       ELSEIF (Online = 5) Then
  296.         If (Counter = 2) Then
  297.           TextToQuote[1] = OldText[5]
  298.           GOTO Sub_1
  299.         ELSEIF (Counter = 3) Then
  300.           TextToQuote[2] = OldText[5]
  301.           GOTO End
  302.         ENDIF
  303.       ENDIF
  304. :END
  305.       DELAY 18
  306.       CLS
  307.       PRINTLN "@X0AAutoPlus Message Editor [@X02REPLY MODE@X0A]"
  308.       PRINTLN "@X0AEnter your Text. 50 Chars. Per Line, 5 Lines. Word-Wrap Enabled"
  309.       PRINTLN "@X0A────────────────────────────────────────────────────────────────"
  310.       NewCounter = 1
  311.       While (NewCounter != 6) DO
  312.             PRINT "@X0A",NewCounter,"@X0A:"
  313.         INPUTSTR "_",NewText[NewCounter],@X0A,50,MASK_ASCII(),NEWLINE+WORDWRAP
  314.         NewCounter = NewCounter + 1
  315.       EndWhile
  316.       Newline
  317.       :ReAsk
  318.       INPUTSTR "@X0ASave Automessage(@X09Y@X0A/@X09N@X0A)_",SaveNew,@X0A,1,MASK_ASCII(),NEWLINE
  319.       IF (UPPER(SaveNew) = "Y") THEN
  320.         FCLOSE 1
  321.         FCREATE 1,Automessage,O_RW,S_DN
  322.             FPUT 1,"Automessage By: "+U_NAME()+" On: "
  323.             FPUTLN 1,DATE()
  324.             FPUT 1,"Quote: YES Quoted: "+ByWhom
  325.             FPUTLN 1," "+ByWhomLast
  326.             FPUTLN 1,"──────────────────────────────────────────"
  327.         FPUTLN 1,TextToQuote[1]
  328.         FPUTLN 1,TextToQuote[2]
  329.         FPUTLN 1,NewText[1]
  330.         FPUTLN 1,NewText[2]
  331.         FPUTLN 1,NewText[3]
  332.         FPUTLN 1,NewText[4]
  333.         FPUTLN 1,NewText[5]
  334.         FCLOSE 1
  335.         GOTO TheEnd
  336.       ELSEIF (UPPER(SaveNew) = "N") THEN
  337.         GOTO TheEnd
  338.       ELSE GOTO ReAsk
  339.       ENDIF
  340.  
  341.  ;       ENDWHILE
  342. ;        PRINTLN "FERR: Error in Using File (",AutoMessage,") At Point #",Point,"."
  343. :TheEnd
  344. FCLOSE 1
  345. ENDPROC
  346. ;***********************************
  347. ;* PROCEDURE new_message Makes a new message
  348.  
  349. PROCEDURE new_message()
  350.  
  351. STRING  line[5]
  352. STRING  save
  353. STRING  edit
  354. INTEGER counter
  355.  
  356. LINE[0] = " "
  357. COUNTER = 1
  358. EDIT = "n"
  359. SAVE = "y"
  360.  
  361. GETUSER
  362.     :BLAH
  363.     CLS
  364.     PRINTLN "@X0AAutomessage Editor. @X095@X0A Lines, @X0950@X0A Chars per line."
  365.     PRINTLN "─────────────────────────────────────────────────────"
  366.     while (counter != "6") do
  367.       PRINT "@X0A",counter,":"
  368.       INPUTSTR "_",line[counter],@X0A,50,MASK_ASCII(),NEWLINE+WORDWRAP
  369.       counter = counter + 1
  370.       endwhile
  371.       NEWLINE
  372.       INPUTSTR "@X0AEdit Automessage(@X09Y@X0A/@X09N@X0A)_",edit,@X0A,1,"yYnN",NEWLINE+UPCASE
  373.       if (edit = "Y") then
  374.         COUNTER = 1
  375.         GOTO BLAH
  376.       endif
  377.       NEWLINE
  378.       INPUTSTR "@X0ASave Automessage(@X09Y@X0A/@X09N@X0A)_",save,@X0A,1,"yYnN",NEWLINE+UPCASE
  379.       if (save = "Y") then
  380.         GOTO SAVE
  381.       elseif (save = "N") then
  382.         GOTO END
  383.       endif
  384.       :SAVE
  385.       FCREATE 1,automessage,O_RW,S_DN
  386.           FPUT 1,"Automessage By: "+u_name()+" On: "
  387.           FPUTLN 1,DATE()
  388.       FPUTLN 1,"Quote: NO Quoted: NONE"
  389.           FPUTLN 1,"───────────────────────────────────────────"
  390.       FPUTLN 1,line[1]
  391.       FPUTLN 1,line[2]
  392.       FPUTLN 1,line[3]
  393.       FPUTLN 1,line[4]
  394.       FPUTLN 1,line[5]
  395.       FCLOSE 1
  396.       GOTO END
  397.       :END
  398. ENDPROC
  399.  
  400. ;***********************************
  401. ;* PROCEDURE display_menu Displays Menu Selections
  402.  
  403. PROCEDURE display_menu()
  404.  
  405.     ANSIPOS 1,13
  406.     PRINTLN "@X1F┌────────────────────────────────────────────@X10┐@X0F"
  407.     ANSIPOS 1,14
  408.     PRINTLN "@X1F│ (@X1E@TIMELEFT@ @X1Fmins.) (@X1EN@X1F)ew (@X1ER@X1F)eply (@X1EQ@X1F)uit (@X1EG@X1F)oodbye @X10│@X0F"
  409.     ANSIPOS 1,15
  410.     PRINTLN "@X1F└@X10────────────────────────────────────────────┘@X0F"
  411.  
  412. ENDPROC
  413.  
  414. ;***********************************
  415. ;* PROCEDURE display_message Displays Automessage
  416.  
  417. PROCEDURE display_message()
  418.  
  419. STRING byline
  420. STRING aline
  421. STRING g1
  422. STRING g2
  423. STRING g3
  424. STRING g4
  425. STRING g5
  426. STRING bname
  427. STRING bnamelast
  428. STRING wdate
  429. STRING qinfo
  430. STRING qname
  431. STRING qnamelast
  432. STRING maybe
  433. STRING qline1
  434. STRING qline2
  435. STRING opline1
  436. STRING line1
  437. STRING line2
  438. STRING line3
  439. STRING line4
  440. STRING line5
  441.  
  442.     CLS
  443.     FOPEN 1,automessage,O_RW,S_DN
  444.         while (!FERR(1)) do
  445.         FGET 1,byline
  446.         TOKENIZE byline
  447.         GETTOKEN g1
  448.         GETTOKEN g2
  449.         GETTOKEN bname
  450.         GETTOKEN bnamelast
  451.         GETTOKEN g3
  452.         GETTOKEN wdate
  453.         FGET 1,qinfo
  454.         TOKENIZE qinfo
  455.         GETTOKEN g4
  456.         GETTOKEN maybe
  457.         GETTOKEN g5
  458.         GETTOKEN qname
  459.         GETTOKEN qnamelast
  460.         if (maybe = "YES") then
  461.             FGET 1,aline
  462.             FGET 1,qline1
  463.             FGET 1,qline2
  464.             FGET 1,opline1
  465.             FGET 1,line1
  466.             FGET 1,line2
  467.             FGET 1,line3
  468.             FGET 1,line4
  469.             FGET 1,line5
  470.                                 PRINTLN "@X0AAutomessage By: @X09"+bname+" "+bnamelast+" @X0AOn: @X09"+wdate
  471.                                 PRINTLN "@X0AQuoted Text By: @X09"+qname+" "+qnamelast
  472.                 PRINTLN "@X0A"+aline
  473.                 PRINTLN "@X0B-> @X09"+qline1
  474.                 PRINTLN "@X0B-> @X09"+qline2
  475.                 PRINTLN opline1
  476.                 PRINTLN "@X09"+line1
  477.                 PRINTLN "@X09"+line2
  478.                 PRINTLN "@X09"+line3
  479.                 PRINTLN "@X09"+line4
  480.                 PRINTLN "@X09"+line5
  481.                 NEWLINE
  482.                 GOTO END
  483.          elseif (maybe = "NO") then
  484.             FGET 1,aline
  485.             FGET 1,line1
  486.             FGET 1,line2
  487.             FGET 1,line3
  488.             FGET 1,line4
  489.             FGET 1,line5
  490.                 PRINTLN "@X0AAutomessage By: @X09"+bname+" "+bnamelast+" @X0AOn: @X09"+wdate
  491.                 PRINTLN "@X0A"+aline
  492.                 PRINTLN "@X09"+line1
  493.                 PRINTLN "@X09"+line2
  494.                 PRINTLN "@X09"+line3
  495.                 PRINTLN "@X09"+line4
  496.                 PRINTLN "@X09"+line5
  497.                 NEWLINE
  498.                 GOTO END
  499.          endif
  500.     endwhile
  501.     PRINTLN "@X0CError! ("+automessage+")"
  502.     FCLOSE 1
  503.     WAIT
  504.     END
  505. :END
  506. FCLOSE 1
  507. ENDPROC
  508.  
  509. ;***************************
  510. ;* FUNCTION getch Gets a Character from the User
  511.  
  512. FUNCTION getch() STRING
  513.  
  514.      while (getch = "") do
  515.            getch = INKEY()
  516.      endwhile
  517.  
  518. ENDFUNC
  519.