home *** CD-ROM | disk | FTP | other *** search
/ Carsten's PPE Collection / Carstens_PPE_Collection_2007.zip / T / TWRL_100.ZIP / TWIRL.PPS < prev   
Text File  |  1995-05-29  |  4KB  |  136 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ; TwirlyPrompt PPE v1.0 by Criminal [PiL]
  3. ; Last updated 5-28-95
  4.  
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6. ; Procedure Declarations
  7.  
  8. declare procedure Initialize()
  9. declare procedure TwirlyInput()
  10.  
  11. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  12. ; Global Variable Declarations
  13.  
  14. string twirly_input, twirl, prompt, color, failsafe, cmd_line
  15. int x, y, cycle, min_length, max_length, color_cycle, start_height, page_len
  16. int input_length, twirl_type, a, b
  17. boolean done, hot_key
  18. byte ascii, user_cmd
  19.  
  20. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  21. ; Main program body
  22.  
  23.   Initialize()
  24.   TwirlyInput()
  25.     kbdstuff upper(twirly_input)
  26. END
  27.  
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29. ; Initialize program variables
  30.  
  31. procedure Initialize()
  32.   getuser
  33.   hot_key = FALSE
  34.   cmd_line = tokenstr()
  35.   tokenize cmd_line
  36.   print ""
  37.   if (!getx()=1) newline
  38.   prompt = ppepath() + gettoken()
  39.   input_length = s2i(gettoken(),10)
  40.   twirl_type = s2i(gettoken(),10)
  41.   if (input_length = -1) hot_key = TRUE
  42.   if (input_length > 255) input_length = 255
  43.   if (input_length < 1) input_length = 1
  44.   dispfile prompt, defs+lang
  45.   print ""
  46.   twirly_input=""
  47.   if ((twirl_type>4) | (twirl_type<1)) then
  48.     time time
  49.     for a = 1 to random((u_timeon() + sec(time) + hour(time)) * 3.14)+3
  50.       b = random((u_timeon() + sec(time) + hour(time)) * 6.66)+1
  51.     next a  ;   gen random number seed
  52.     twirl_type = random(2)+1
  53.   endif
  54.   select case (twirl_type)
  55.     case 1
  56.       twirl = "│/─\"
  57.     case 2
  58.       twirl = "░▒▓█▓▒"
  59.     case 3
  60.       twirl = "▌▀▐▄"
  61.     case 4
  62.       twirl = ""
  63.   endselect
  64.   cycle = 0
  65.   color_cycle = 1
  66.   color = "@X08"  ; edit this to change color of spinner
  67.   done = FALSE
  68.   page_len = u_pagelen()
  69.   x = getx()
  70.   y = gety()
  71.   start_height = y
  72.   min_length = x
  73.   max_length = 80
  74. endproc
  75.  
  76. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  77. ; Get input, twirl cursor for fun
  78.  
  79. procedure TwirlyInput()
  80.   while (!done) do
  81.     cycle = cycle + 1
  82.     if (cycle>len(twirl)) cycle=1
  83.     ansipos x,y
  84.     print color + mid(twirl,cycle,1)
  85.     ansipos x,y
  86.     ascii=asc(inkey())
  87.     if (ascii = 27) then
  88.       ansipos x,y
  89.       print " "
  90.     endif
  91.     if (ascii = 13) done = TRUE
  92.       if (ascii = 8) then
  93.          if (len(twirly_input)>=1) then
  94.           ansipos x,y
  95.           print " "
  96.           twirly_input = left(twirly_input,len(twirly_input)-1)
  97.           x=x-1
  98.           if (x=0) then
  99.             x=79
  100.             y=y-1
  101.             if (y<1) y=1
  102.           endif
  103.         select case (twirly_input)
  104.           case 79-x
  105.             y = start_height
  106.           case (79*2)-x
  107.             y = start_height + 1
  108.           case (79*3)-x
  109.             y = start_height + 2
  110.         end select
  111.         endif
  112.       else
  113.       if ((!ascii=0) & (len(twirly_input)<input_length)) then
  114.         twirly_input=twirly_input+chr(ascii)
  115.         ansipos x,y
  116.         defcolor  ; change this to 'print "@Xnn"' if you want diff. color input
  117.         print chr(ascii)
  118.         x=x+1
  119.         if (x=80) then
  120.           y=y+1
  121.           x=1
  122.           if (y>page_len) then
  123.             failsafe=scrtext(1,1,80,TRUE)
  124.             newline
  125.             if (!scrtext(1,1,80,TRUE)=failsafe) start_height = start_height - 1
  126.           endif
  127.         endif
  128.       endif
  129.     endif
  130.   if ((len(twirly_input)>0) & (hot_key)) done = TRUE
  131.   endwhile
  132.   ansipos x-1,y
  133.   print "   "
  134.   ansipos x-1,y
  135.     print ""
  136. endproc