home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazin 1997 March / Image.iso / wd.dxr / Name_12_NameLoop.ls < prev    next >
Encoding:
Text File  |  1996-10-28  |  2.9 KB  |  103 lines

  1. global gNamenAuswahlPos, gLastNamenAuswahlPos, gScrollWhichDir, glastname
  2.  
  3. on exitFrame
  4.   go(the frame)
  5.   if gNamenAuswahlPos > 1 then
  6.     SpriteCursor(9, "Finger")
  7.     set the visible of sprite 9 to 1
  8.   else
  9.     SpriteCursor(9, 0)
  10.     set the visible of sprite 9 to 0
  11.   end if
  12.   if (gNamenAuswahlPos + 6) < count(gPlayers) then
  13.     SpriteCursor(10, "Finger")
  14.     set the visible of sprite 10 to 1
  15.   else
  16.     SpriteCursor(10, 0)
  17.     set the visible of sprite 10 to 0
  18.   end if
  19.   if (glastname = field "NameField") and (gScrollWhichDir = #None) then
  20.     return 
  21.   end if
  22.   if field "NameField" <> EMPTY then
  23.     set the visible of sprite 5 to 1
  24.     SpriteCursor(5, "Finger")
  25.   else
  26.     set the visible of sprite 5 to 0
  27.     SpriteCursor(5, 0)
  28.   end if
  29.   if gScrollWhichDir <> #None then
  30.     set the visible of sprite 13 to 0
  31.   end if
  32.   case gScrollWhichDir of
  33.     #down:
  34.       set gNamenAuswahlPos to gNamenAuswahlPos + 1
  35.     #Up:
  36.       set gNamenAuswahlPos to gNamenAuswahlPos - 1
  37.     #OneDown:
  38.       set gNamenAuswahlPos to gNamenAuswahlPos + 1
  39.       set gScrollWhichDir to #None
  40.     #OneUp:
  41.       set gNamenAuswahlPos to gNamenAuswahlPos - 1
  42.       set gScrollWhichDir to #None
  43.   end case
  44.   if field "NameField" <> glastname then
  45.     set gNamePos to 0
  46.     repeat with i = 1 to count(gPlayers)
  47.       if getAt(getAt(gPlayers, i), 1) = field "NameField" then
  48.         set gNamePos to i
  49.         exit repeat
  50.       end if
  51.     end repeat
  52.     if gNamePos > 0 then
  53.       if (gNamePos < gNamenAuswahlPos) or (gNamePos > (gNamenAuswahlPos + 6)) then
  54.         set gNamenAuswahlPos to gNamePos
  55.       end if
  56.     end if
  57.   end if
  58.   if (gNamenAuswahlPos + 6) > count(gPlayers) then
  59.     set gScrollWhichDir to #None
  60.     set gNamenAuswahlPos to count(gPlayers) - 6
  61.   end if
  62.   if gNamenAuswahlPos < 1 then
  63.     set gScrollWhichDir to #None
  64.     set gNamenAuswahlPos to 1
  65.   end if
  66.   if gNamenAuswahlPos <> gLastNamenAuswahlPos then
  67.     set text to EMPTY
  68.     repeat with i = gNamenAuswahlPos to min(gNamenAuswahlPos + 6, count(gPlayers))
  69.       set text to text & getAt(getAt(gPlayers, i), 1) & RETURN
  70.     end repeat
  71.     put text into field "NamenAuswahl"
  72.     set the visible of sprite 13 to 0
  73.   end if
  74.   set the visible of sprite 13 to 0
  75.   if (gScrollWhichDir = #None) and (field "NameField" <> EMPTY) then
  76.     set pos to 0
  77.     repeat with i = 1 to 7
  78.       if field "NameField" = line i of field "NamenAuswahl" then
  79.         set pos to i
  80.         exit repeat
  81.       end if
  82.     end repeat
  83.     if pos > 0 then
  84.       updateStage()
  85.       put field "NameField" into field "HiliteNameText"
  86.       set the puppet of sprite 13 to 1
  87.       set the locH of sprite 13 to the locH of sprite 12
  88.       set the locV of sprite 13 to the locV of sprite 12 + ((pos - 1) * the height of cast "HiliteNameText")
  89.       set the visible of sprite 13 to 1
  90.       updateStage()
  91.     end if
  92.   end if
  93.   set glastname to field "NameField"
  94. end
  95.  
  96. on keyUp
  97.   DoNameKey(1)
  98. end
  99.  
  100. on keyDown
  101.   DoNameKey(0)
  102. end
  103.