home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PWAECS20.ZIP / ECS.PPS < prev    next >
Text File  |  1995-03-26  |  10KB  |  301 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ; Enhanced Comment to Sysop v2.0
  3. ; Written by Drew [PWA]
  4. ; Last updated 03-25-95
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6.  
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8. ; function/procedure prototypes (declarations)
  9. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  10. declare procedure Initialize()
  11. declare procedure PrintMenu()
  12. declare procedure SaveState(int cr, int cc, int cs, var string st, \
  13.                                     var int sr, var int sc)
  14. declare procedure PrintState(string st, int cr, int cc, int cs)
  15. declare procedure RestoreState(string st, int sr, int sc)
  16. declare procedure ParseSelected(int cursysop)
  17. declare procedure CheckSysNum(int a, var boolean q, var string s, \
  18.                                var int sr, var int sc, int cs, int cr, int cc)
  19. declare procedure PrintQuit()
  20. declare procedure GetInput()
  21.  
  22. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  23. ; some global variables
  24. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  25. boolean hl_numb            ; highlight sysop number or not
  26. string color_num           ; color of unlighted sysop number
  27. string color_high_num      ; color of highlighted sysop number
  28. string subj                ; subject of comment to sysop
  29. integer numsysops          ; number of sysops user can leave comment to
  30. integer numspaces          ; numb of spaces after sysop numb to sysop name
  31. string sysnames(1)         ; stores the sysop names (redimensioned array)
  32. string sysdescs(1)         ; stores the sysop descriptions (redim'ed)
  33. string rowpos(1)           ; stores x-positions
  34. string colpos(1)           ; stores y-positions
  35.  
  36.  
  37.  
  38. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  39. ; main
  40. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  41. begin
  42.     Initialize()
  43.     startdisp FNS
  44.     GetInput()
  45.     PrintQuit()
  46.     resetdisp
  47.     startdisp NC
  48. end
  49.  
  50.  
  51.  
  52. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  53. ; gets input from the user and manages the lightbars
  54. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  55. procedure GetInput()
  56.     string save_text  ; saves text before highlighting
  57.     int save_row      ; saves old row
  58.     int save_col      ; saves old column
  59.     int cursysop      ; current sysop number
  60.     int currow        ; current row
  61.     int curcol        ; current column
  62.     int ascii         ; ascii # of keyboard input
  63.     boolean quit      ; quit or not
  64.  
  65.     ; print menu, move cursor to first sysop
  66.     ;
  67.     PrintMenu()
  68.     cursysop = 1
  69.     currow = rowpos(1)
  70.     curcol = colpos(1)
  71.     ansipos curcol, currow
  72.  
  73.     ; save state and print highlighted
  74.     ;
  75.     SaveState(currow, curcol, cursysop, save_text, save_row, save_col)
  76.     PrintState(save_text, currow, curcol, cursysop)
  77.  
  78.     quit = FALSE
  79.     while (quit == FALSE) do
  80.         ; let's be nice to the cpu and use a small delay
  81.         delay 1
  82.  
  83.         ascii = asc(inkey())
  84.         select case (ascii)
  85.             case 13
  86.                 ; return
  87.                 ParseSelected(cursysop)
  88.                 quit = TRUE
  89.             case 85, 65, 97, 76
  90.                 ; up arrow, or "A" or "a"
  91.                 RestoreState(save_text, save_row, save_col)
  92.  
  93.                 dec cursysop
  94.                 if (cursysop < 1) cursysop = numsysops
  95.  
  96.                 currow = rowpos(cursysop)
  97.                 curcol = colpos(cursysop)
  98.  
  99.                 SaveState(currow, curcol, cursysop, save_text, save_row, \
  100.                           save_col)
  101.                 PrintState(save_text, currow, curcol, cursysop)
  102.             case 68, 90, 122, 82
  103.                 ; down arrow, or "Z" or "z"
  104.                 RestoreState(save_text, save_row, save_col)
  105.  
  106.                 inc cursysop
  107.                 if (cursysop > numsysops) cursysop = 1
  108.  
  109.                 currow = rowpos(cursysop)
  110.                 curcol = colpos(cursysop)
  111.  
  112.                 SaveState(currow, curcol, cursysop, save_text, save_row, \
  113.                           save_col)
  114.                 PrintState(save_text, currow, curcol, cursysop)
  115.             case 113, 27, 81
  116.                 ; ESCape, "Q" or "q"
  117.                 quit = TRUE
  118.             default
  119.                 ; user has hit some other key, so check if it's a sysop number
  120.                 CheckSysNum(ascii, quit, save_text, save_row, save_col, \
  121.                             cursysop, currow, curcol)
  122.         endselect
  123.     endwhile
  124. endproc
  125.  
  126.  
  127.  
  128. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  129. ; i hope no one minds. :)
  130. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  131. procedure PrintQuit()
  132.     getuser
  133.     defcolor
  134.     ansipos 1, u_pagelen
  135.     println "@X08ECS v2.0 by Drew [PWA]@X07"
  136. endproc
  137.  
  138.  
  139.  
  140. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  141. ; user has entered something other than the lightbar keys, so check if it's
  142. ; a matching number for one of the sysops listed
  143. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  144. procedure CheckSysNum(int ascii, var boolean quit, var string save_text,\
  145.     var int save_row, var int save_col, int cursysop, int currow, int curcol)
  146.  
  147.     int num
  148.  
  149.     quit = FALSE
  150.     num = s2i(chr(ascii), 10)
  151.     if (num && (num <= numsysops)) then
  152.         RestoreState(save_text, save_row, save_col)
  153.  
  154.         cursysop = num
  155.         currow = rowpos(cursysop)
  156.         curcol = colpos(cursysop)
  157.  
  158.         SaveState(currow, curcol, cursysop, save_text, save_row, save_col)
  159.         PrintState(save_text, currow, curcol, cursysop)
  160.  
  161.         ParseSelected(cursysop)
  162.  
  163.         quit = TRUE
  164.     endif
  165. endproc
  166.  
  167.  
  168.  
  169. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  170. ; User has hit RETURN or has hit a valid hotkey (sysop number), so stuff
  171. ; keyboard to correct sysop
  172. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  173. procedure ParseSelected(int cursysop)
  174.     kbdstuff "E" + CHR(13) + sysnames(cursysop) + CHR(13) + subj + \
  175.              CHR(13) + "R" + CHR(13)
  176. endproc
  177.  
  178.  
  179.  
  180. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  181. ; restores text that was highlighted after the lightbar has moved
  182. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  183. procedure RestoreState(string save_text, int save_row, int save_col)
  184.     if (hl_numb == TRUE) then
  185.         ansipos save_col - 1, save_row
  186.         print save_text
  187.     else
  188.         ansipos save_col + numspaces, save_row
  189.         print save_text
  190.     endif
  191. endproc
  192.  
  193.  
  194.  
  195. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  196. ; print the lightbar
  197. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  198. procedure PrintState(string save_text, int currow, int curcol, \
  199.                              int cursysop)
  200.     if (hl_numb == TRUE) then
  201.         ansipos curcol - 1, currow
  202.         print color_high_num + stripatx(save_text)
  203.         backup 1
  204.     else
  205.         ansipos curcol + numspaces, currow
  206.         print sysdescs(cursysop)
  207.         backup 1
  208.     endif
  209. endproc
  210.  
  211.  
  212.  
  213. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  214. ; save the text about to be printed over from the lightbar
  215. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  216. procedure SaveState(int currow, int curcol, int cursysop, \
  217.                     var string save_text, var int save_row, var int save_col)
  218.  
  219.     save_row = currow
  220.     save_col = curcol
  221.     if (hl_numb == TRUE) then
  222.         save_text = scrtext(save_col - 1, save_row, 3, TRUE)
  223.     else
  224.         save_text = scrtext(save_col + numspaces, save_row, \
  225.                             len(stripatx(sysdescs(cursysop))) , TRUE)
  226.     endif
  227. endproc
  228.  
  229.  
  230.  
  231. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  232. ; prints the menu/ansi screen
  233. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  234. procedure PrintMenu()
  235.     if (exist(ppepath() + "ECS.PCB")) then
  236.         dispfile ppepath() + "ECS.PCB", DEFS
  237.     else
  238.         cls
  239.         println "@X0CError!  Missing ECS.PCB - Inform your main sysop!@X07"
  240.         end
  241.     endif
  242. endproc
  243.  
  244.  
  245.  
  246. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  247. ; duh
  248. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  249. procedure Initialize()
  250.     string ecs_cfg, tmpstr1
  251.     int i
  252.  
  253.     ecs_cfg = ppepath() + "ECS.CFG"
  254.  
  255.     if (!exist(ecs_cfg)) then
  256.         println "@X0CError!  ECS.CFG not found!@X07"
  257.         end
  258.     endif
  259.  
  260.     fopen 1, ecs_cfg, O_RD, S_DW
  261.     fdefin 1
  262.  
  263.     fdget tmpstr1
  264.     if (upper(tmpstr1) == "N") then
  265.         hl_numb = TRUE
  266.     elseif (upper(tmpstr1) == "D") then
  267.         hl_numb = FALSE
  268.     endif
  269.  
  270.     fdget color_high_num
  271.     fdget tmpstr1
  272.     numspaces = s2i(tmpstr1, 10)
  273.  
  274.     fdget subj
  275.  
  276.     ; i don't trust ppl with their 0-based arrays, since it seems like it
  277.     ; is and isn't at the same time.  so just to be safe, we'll redimension
  278.     ; the arrays to one size larger and just not use the zero-th (first)
  279.     ; element.
  280.     ;
  281.     fdget tmpstr1
  282.     numsysops = s2i(tmpstr1, 10)
  283.     redim sysnames, numsysops + 1
  284.     redim sysdescs, numsysops + 1
  285.     redim rowpos, numsysops + 1
  286.     redim colpos, numsysops + 1
  287.  
  288.     for i = 1 to numsysops
  289.         fdget tmpstr1
  290.         tokenize tmpstr1
  291.         rowpos(i) = s2i(gettoken(), 10)
  292.         colpos(i) = s2i(gettoken(), 10)
  293.  
  294.         fdget sysdescs(i)
  295.         fdget sysnames(i)
  296.     next i
  297.  
  298.     fclose 1
  299. endproc
  300.  
  301.