home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 October / Pcwk1097.iso / REKLAMY / ATA-INT / 3220 / 3220.EXE / 3220.DXR / 00001.ls next >
Encoding:
Text File  |  1997-02-13  |  6.6 KB  |  317 lines

  1. global gDepth, gPath, gR, gW, gLang, gFields, gLangNames, gOpenField, gFieldInfo, gBtns1, gCasts1, gBtns2, gCasts2, gBtns3, gCasts3, gHilite, gCopierPics, gCopySpr, gCopierMsgs, gMsgSpr, gBtns4, gCasts4, gMode, gDelay, gTrigger, gHiliteDelay, gWaitCursor, gStandardDelay, gReturnChar, gDONT_ANIMATE
  2.  
  3. on startMovie
  4.   clearGlobals()
  5.   set gDepth to the colorDepth
  6.   set the colorDepth to 4
  7.   set the exitLock to 1
  8.   if the machineType = 256 then
  9.     set s to "\"
  10.   else
  11.     set s to ":"
  12.   end if
  13.   set gPath to the pathName
  14.   set gLang to 0
  15.   set gFields to []
  16.   set gLangNames to []
  17.   set gFieldInfo to []
  18.   set gOpenField to 0
  19.   set gBtns1 to [12, 13, 14, 15, 16, 17]
  20.   set gCasts1 to [101, 111, 121, 131, 141, 151, 271]
  21.   set gBtns2 to [12, 13]
  22.   set gCasts2 to [161, 171]
  23.   set gBtns3 to [12, 13, 14, 15, 16, 17, 18, 19, 20, 47]
  24.   set gCasts3 to [181, 191, 201, 211, 221, 231, 241, 251, 261, 291]
  25.   set gHilite to 1
  26.   set gCopierPics to [184, 194, 204, 214, 224, 234, 244, 254, 254, 0]
  27.   set gCopySpr to 21
  28.   set gCopierMsgs to []
  29.   set n to "04.01.0"
  30.   repeat with i = 1 to 9
  31.     add(gCopierMsgs, the number of cast (n & i & "b"))
  32.   end repeat
  33.   add(gCopierMsgs, 0)
  34.   set gMsgSpr to 41
  35.   set gBtns4 to [45, 46, 47, 48]
  36.   set gCasts4 to [271, 281, 291, 301]
  37.   set gMode to 1
  38.   set gDelay to 0
  39.   set gTrigger to 0
  40.   set gHiliteDelay to 0
  41.   set gWaitCursor to [91, 92]
  42.   set gStandardDelay to 660
  43.   set gReturnChar to RETURN & numToChar(10)
  44.   set gDONT_ANIMATE to 0
  45.   getLanguageNames()
  46.   set the checkboxType to 1
  47. end
  48.  
  49. on getLanguageNames
  50.   if objectp(gR) then
  51.     gR(mdispose)
  52.   end if
  53.   set gR to FileIO(mnew, "read", gPath & "0.txt")
  54.   set data to gR(mReadFile)
  55.   gR(mdispose)
  56.   set c to the number of lines in data
  57.   set i to 1
  58.   repeat while voidp(├»)
  59.     set n to line i of data
  60.     set n to charTest(n)
  61.     if char 1 of n = "#" then
  62.       delete char 1 of n
  63.       add(gLangNames, n)
  64.       set i to i + 1
  65.       set s to line i of data
  66.       set the text of cast n to charTest(s)
  67.     end if
  68.     set i to i + 1
  69.     if i > c then
  70.       exit
  71.     end if
  72.   end repeat
  73. end
  74.  
  75. on charTest n1
  76.   if charToNum(char 1 of n1) = 10 then
  77.     delete char 1 of n1
  78.   end if
  79.   return n1
  80. end
  81.  
  82. on kdScript
  83.   if gOpenField then
  84.     exit
  85.   end if
  86.   if the key = "m" then
  87.     set gMode to 1
  88.   else
  89.     if the frameLabel contains "11.06" then
  90.       exitjob2()
  91.     else
  92.       if the key = "a" then
  93.         autoJob()
  94.       else
  95.         if the key = "q" then
  96.           exitJob()
  97.         else
  98.           if the key = "l" then
  99.             languageJob()
  100.           end if
  101.         end if
  102.       end if
  103.     end if
  104.   end if
  105. end
  106.  
  107. on autoJob
  108.   puppetJob1(0)
  109.   puppetJob2(0)
  110.   set gTrigger to 0
  111.   set gMode to 0
  112. end
  113.  
  114. on exitJob
  115.   global f
  116.   if f contains "14.15" then
  117.     stopMovie()
  118.     quit()
  119.   end if
  120.   if f contains "14.01" then
  121.     set f to "14.15"
  122.     go(f)
  123.   else
  124.     set f to "14.01"
  125.   end if
  126.   if not f contains "14.01" then
  127.     set f to "14.01"
  128.   end if
  129.   puppetJob1(0)
  130.   puppetJob2(0)
  131.   set gTrigger to 0
  132.   go(f)
  133. end
  134.  
  135. on exitjob2
  136.   set f to the frameLabel
  137.   if (f contains "11.06") and (the key = "q") then
  138.     set f to "11.10"
  139.   end if
  140.   puppetJob1(0)
  141.   puppetJob2(0)
  142.   set gTrigger to 0
  143.   go(f)
  144. end
  145.  
  146. on languageJob
  147.   set f to the frameLabel
  148.   if f = "01.01" then
  149.     exit
  150.   end if
  151.   puppetJob1(0)
  152.   puppetJob2(0)
  153.   set gTrigger to 0
  154.   disableEdit()
  155.   storeLangText()
  156.   go("01.01")
  157. end
  158.  
  159. on setLanguage n1
  160.   if objectp(gR) then
  161.     gR(mdispose)
  162.   end if
  163.   set gR to FileIO(mnew, "read", gPath & n1 & ".txt")
  164.   if not objectp(gR) then
  165.     alert("Sorry - no language file was found.")
  166.     exit
  167.   else
  168.     cursor(gWaitCursor)
  169.   end if
  170.   set data to gR(mReadFile)
  171.   gR(mdispose)
  172.   set gFields to []
  173.   set i to 1
  174.   repeat while voidp(├»)
  175.     set n to line i of data
  176.     set n to charTest(n)
  177.     if n = "<<" then
  178.       exit repeat
  179.     end if
  180.     if char 1 of n = "#" then
  181.       delete char 1 of n
  182.       add(gFields, n)
  183.       set f to EMPTY
  184.       set i to i + 1
  185.       repeat while voidp(├»)
  186.         set s to line i of data
  187.         set s to charTest(s)
  188.         if (s = "<<") or (s = "**") then
  189.           delete char -30003 of f
  190.           set the text of cast n to f
  191.           exit repeat
  192.           next repeat
  193.         end if
  194.         put s & RETURN after f
  195.         set i to i + 1
  196.       end repeat
  197.       next repeat
  198.     end if
  199.     set i to i + 1
  200.     next repeat
  201.   end repeat
  202.   set gLang to n1
  203.   puppetJob1(0)
  204.   cursor(0)
  205.   go(marker(1))
  206. end
  207.  
  208. on stopMovie
  209.   cursor(gWaitCursor)
  210.   storeLangNames()
  211.   storeLangText()
  212.   set the colorDepth to gDepth
  213.   cursor(0)
  214.   clearGlobals()
  215. end
  216.  
  217. on storeLangNames
  218.   if objectp(gW) then
  219.     gW(mdispose)
  220.   end if
  221.   if not gLang then
  222.     exit
  223.   end if
  224.   set gW to FileIO(mnew, "write", gPath & "0.txt")
  225.   set data to EMPTY
  226.   repeat with i in gLangNames
  227.     put "#" & i & gReturnChar & the text of cast i after data
  228.     if i = getLast(gLangNames) then
  229.       set s to gReturnChar & "<<"
  230.     else
  231.       set s to gReturnChar & "**" & gReturnChar
  232.     end if
  233.     put s after data
  234.   end repeat
  235.   gW(mWriteString, data)
  236.   gW(mdispose)
  237. end
  238.  
  239. on storeLangText
  240.   if objectp(gW) then
  241.     gW(mdispose)
  242.   end if
  243.   if not gLang then
  244.     exit
  245.   end if
  246.   set gW to FileIO(mnew, "write", gPath & gLang & ".txt")
  247.   set data to EMPTY
  248.   repeat with i in gFields
  249.     set t1 to the text of cast i
  250.     set c1 to the number of lines in t1
  251.     set t2 to EMPTY
  252.     repeat with j = 1 to c1
  253.       put line j of t1 & gReturnChar after t2
  254.     end repeat
  255.     put "#" & i & gReturnChar & t2 after data
  256.     if i = getLast(gFields) then
  257.       set s to "<<"
  258.     else
  259.       set s to "**" & gReturnChar
  260.     end if
  261.     put s after data
  262.   end repeat
  263.   gW(mWriteString, data)
  264.   gW(mdispose)
  265. end
  266.  
  267. on puppetJob1 n1
  268.   repeat with i = 12 to 21
  269.     set the puppet of sprite i to n1
  270.   end repeat
  271. end
  272.  
  273. on puppetJob2 n1
  274.   repeat with i = 30 to 48
  275.     set the puppet of sprite i to n1
  276.   end repeat
  277. end
  278.  
  279. on editClick
  280.   if not gMode then
  281.     exit
  282.   end if
  283.   if not (the controlDown) then
  284.     exit
  285.   end if
  286.   if gOpenField then
  287.     exit
  288.   end if
  289.   pause()
  290.   set f to the clickOn
  291.   set the ink of sprite f to 0
  292.   set the editableText of sprite f to 1
  293.   set c to the castNum of sprite f
  294.   set gFieldInfo to [f, c]
  295.   add(gFieldInfo, the foreColor of cast c)
  296.   add(gFieldInfo, the backColor of cast c)
  297.   set the foreColor of cast c to 15
  298.   set the backColor of cast c to 4
  299.   set gOpenField to 1
  300.   updateStage()
  301. end
  302.  
  303. on disableEdit
  304.   if not gMode or (gFieldInfo = []) then
  305.     exit
  306.   end if
  307.   set L to gFieldInfo
  308.   set s to getAt(L, 1)
  309.   set c to getAt(L, 2)
  310.   set the editableText of sprite s to 0
  311.   set the foreColor of cast c to getAt(L, 3)
  312.   set the backColor of cast c to getAt(L, 4)
  313.   set the ink of sprite s to 36
  314.   set gFieldInfo to []
  315.   set gOpenField to 0
  316. end
  317.