home *** CD-ROM | disk | FTP | other *** search
/ Hope PC Multimedia SuperPack 2 / HOMEPC.iso / TAROT / DOWNLOAD / VT3.ZIP / C1.DXR / 00224.ls < prev    next >
Encoding:
Text File  |  1995-11-02  |  5.6 KB  |  216 lines

  1. on keyHandler
  2.   global fieldNM
  3.   if (the key = RETURN) or (the key = TAB) then
  4.     enterChar()
  5.   else
  6.     if the key = numToChar(8) then
  7.       deleteChar()
  8.     else
  9.       if the commandDown or (charToNum(the key) < 32) or (charToNum(the key) > 216) then
  10.         dontPassEvent()
  11.       else
  12.         enterChar()
  13.       end if
  14.     end if
  15.   end if
  16. end
  17.  
  18. on enterChar
  19.   global charCnt, strg1, strg2, charPos, KeyMod, fieldNM, MaxChars, fieldIndex, Warned, logged, Stall
  20.   set KeyMod to 1
  21.   set Warned to 0
  22.   if logged = 1 then
  23.     puppetSound("EntryLogged")
  24.     return 
  25.   end if
  26.   set charCnt to the number of chars in field fieldNM
  27.   if (the key = RETURN) or (the key = TAB) then
  28.     puppetSound("TextClick")
  29.     updateStage()
  30.     set Stall to 0
  31.     if strg1 = -1 then
  32.       nothing()
  33.     else
  34.       put strg1 & strg2 into field fieldNM
  35.       set strg1 to -1
  36.       set strg2 to EMPTY
  37.       when timeOut then nothing
  38.     end if
  39.     getNextField()
  40.     if fieldNM = "Key1" then
  41.       set the castNum of sprite 9 to the number of cast "Key 1"
  42.       set the locH of sprite 9 to 87
  43.       set the locV of sprite 9 to 232
  44.       set fieldIndex to 1
  45.       set MaxChars to 10
  46.     else
  47.       if fieldNM = "Key2" then
  48.         set the castNum of sprite 9 to the number of cast "Key 2"
  49.         set the locH of sprite 9 to 266
  50.         set the locV of sprite 9 to 231
  51.         set fieldIndex to 2
  52.         set MaxChars to 10
  53.       else
  54.         if fieldNM = "Key3" then
  55.           set the castNum of sprite 9 to the number of cast "Key 3"
  56.           set the locH of sprite 9 to 444
  57.           set the locV of sprite 9 to 230
  58.           set fieldIndex to 3
  59.           set MaxChars to 10
  60.         else
  61.           if fieldNM = "LogEntry" then
  62.             set the castNum of sprite 9 to the number of cast "Log Entry"
  63.             set the locH of sprite 9 to 286
  64.             set the locV of sprite 9 to 265
  65.             set fieldIndex to 4
  66.             set MaxChars to 275
  67.           else
  68.             return 
  69.           end if
  70.         end if
  71.       end if
  72.     end if
  73.     updateStage()
  74.     return 
  75.   else
  76.     if the key = "," then
  77.       set KeyChar to " "
  78.     else
  79.       set KeyChar to the key
  80.     end if
  81.     if charCnt = 0 then
  82.       put KeyChar into field fieldNM
  83.       set charCnt to 1
  84.     else
  85.       if charCnt <= MaxChars then
  86.         if strg1 = -1 then
  87.           put field fieldNM & KeyChar into field fieldNM
  88.         else
  89.           set strg1 to strg1 & KeyChar
  90.           put strg1 & "*" & strg2 into field fieldNM
  91.           set charPos to the number of chars in strg1 + 1
  92.         end if
  93.         set charCnt to charCnt + 1
  94.       else
  95.         if Stall = 0 then
  96.           keySound("FieldFul")
  97.           set Stall to 1
  98.         end if
  99.       end if
  100.     end if
  101.     dontPassEvent()
  102.   end if
  103. end
  104.  
  105. on deleteChar
  106.   global charCnt, strg1, strg2, charPos, KeyMod, fieldNM, Stall
  107.   set KeyMod to 1
  108.   set Stall to 0
  109.   if charCnt > 1 then
  110.     set charCnt to charCnt - 1
  111.     if strg1 = -1 then
  112.       put chars(field fieldNM, 1, charCnt) into field fieldNM
  113.     else
  114.       set strg1 to chars(strg1, 1, the number of chars in strg1 - 1)
  115.       put strg1 & "*" & strg2 into field fieldNM
  116.       set charPos to the number of chars in strg1 + 1
  117.     end if
  118.   else
  119.     put " " into field fieldNM
  120.     set strg1 to -1
  121.     set strg2 to EMPTY
  122.     when timeOut then nothing
  123.   end if
  124. end
  125.  
  126. on getNextField
  127.   global FieldNames, fieldNM, fieldIndex
  128.   if fieldIndex < 4 then
  129.     if the number of words in field ("key" & fieldIndex) <= 1 then
  130.       nothing()
  131.     else
  132.       PlaySound(1, "navVocal:KeyWdCnt", 0, 0)
  133.       put " " into field ("key" & fieldIndex)
  134.       return 
  135.     end if
  136.   end if
  137.   if fieldIndex = 4 then
  138.     set fieldIndex to 1
  139.   else
  140.     set fieldIndex to fieldIndex + 1
  141.   end if
  142.   set fieldNM to FieldNames(mget, fieldIndex)
  143. end
  144.  
  145. on selectCast
  146.   global MaxChars, strg1, strg2, charPos, fieldNM, charCnt, Warned, fieldIndex, logged, Stall
  147.   set Warned to 0
  148.   set Stall to 0
  149.   set charPos to the mouseChar
  150.   if logged = 1 then
  151.     puppetSound("EntryLogged")
  152.     return 
  153.   end if
  154.   puppetSound("TextClick")
  155.   updateStage()
  156.   if strg1 = -1 then
  157.     nothing()
  158.   else
  159.     put strg1 & strg2 into field fieldNM
  160.     set strg1 to -1
  161.     set strg2 to EMPTY
  162.     when timeOut then nothing
  163.   end if
  164.   set fieldNM to the name of cast the mouseCast
  165.   if fieldNM = "Key1" then
  166.     set the castNum of sprite 9 to the number of cast "Key 1"
  167.     set the locH of sprite 9 to 87
  168.     set the locV of sprite 9 to 232
  169.     set fieldIndex to 1
  170.     set MaxChars to 10
  171.   else
  172.     if fieldNM = "Key2" then
  173.       set the castNum of sprite 9 to the number of cast "Key 2"
  174.       set the locH of sprite 9 to 266
  175.       set the locV of sprite 9 to 231
  176.       set fieldIndex to 2
  177.       set MaxChars to 10
  178.     else
  179.       if fieldNM = "Key3" then
  180.         set the castNum of sprite 9 to the number of cast "Key 3"
  181.         set the locH of sprite 9 to 444
  182.         set the locV of sprite 9 to 230
  183.         set fieldIndex to 3
  184.         set MaxChars to 10
  185.       else
  186.         if fieldNM = "LogEntry" then
  187.           set the castNum of sprite 9 to the number of cast "Log Entry"
  188.           set the locH of sprite 9 to 286
  189.           set the locV of sprite 9 to 265
  190.           set fieldIndex to 4
  191.           set MaxChars to 275
  192.         else
  193.           return 
  194.         end if
  195.       end if
  196.     end if
  197.   end if
  198.   updateStage()
  199.   set charCnt to the number of chars in field fieldNM
  200.   set fieldString to field fieldNM
  201.   if fieldString = " " then
  202.     when timeOut then nothing
  203.     set strg1 to -1
  204.     set strg2 to EMPTY
  205.   else
  206.     set strg1 to chars(fieldString, 1, charPos - 1)
  207.     set strg2 to chars(fieldString, charPos, the number of chars in fieldString)
  208.     put strg1 & "*" & strg2 into field fieldNM
  209.     when timeOut then ToggleInsert
  210.   end if
  211. end
  212.  
  213. on ToggleInsert
  214.   when timeOut then nothing
  215. end
  216.