Reply to:   RE: <lingo-l> List Functions (newbie help)
I'll treat this in parts & try & be brief

>So the only one I'm missing is the one which sets the properties of #setred
>and
>#setgrey, which I know go on the sprites on sprite channel 2 to 48.

The short answer to your question  is probably to create a new behavior with 'on 
setred' & 'on setgrey' handlers that do your castmember switching (or whatever it is 
you're doing) and attach this behavior to the sprites in channels 2 thru 48

But you can be a lot smarter with this by getting familiar with behaviors and letting 
each sprite worry about itself and nothing else.  This way you can do with out the 
movie handlers altogether and make your scripts easier to understand

To do this with some simple behaviors I would create 2 behaviors - one for the 
keyboard graphic as and one for all the others.  This is meant as a guide.  Most of 
this stuff is basic behavior scripting so it's good to learn it insideout

**untested**
------------------------------

THE KEYBOARD GRAPHIC
--this replaces the keyUp & keyDown movie handlers.  it could be in a movie script but 
hits is more contained
------------------------------

property pOldKeyUp, pOldKeyDown
on beginSprite me
  pOldKeyUp = the keyUpScript    --store original values   pOldKeyDown = the 
keyDownScript
  the keyDownScript = "sendAllSprites(#setRed, the key)"   --broadcasts the key 
pressed to all sprites with a  'setRed' handler
  the keyUpScript = "sendAllSprites(#setGrey)"     --tell all sprites with a 'setGrey' 
to reset
end

on endSprite me   --restore original values
  the keyDownScript = pOldKeyDown
  the keyUpScript = pOldKeyUp
end
-------------------------------

THE INDIVIDUAL KEYS
-------------------------------

property pMySprite, pMyMember, pMyLetter

on beginSprite me
  pMySprite = sprite(me.spriteNum)  --store the sprite channel in a variable
  pMyMember = pMySprite.member  --store the sprite's member in a variable
  pMyLetter = pMyMember.name  --get the letter to react to from the  cast member name  
(eventually, look at getPropertyDescriptionList)
end

on setRed me, theKey      if theKey = pMyLetter then  compare the passed the key 
variable from the keyUpScript with the letter stored in the behavior property
    --custom lingo eg pSprite.member = redmember
    end if
end

on setGrey me
  if pSprite.member <> pMyMember then
      pSprite.member  = pMyMember  --restore the original member
  end if
end


Anyway, out of time now, hopefully this makes sense to you & I haven't left out 
anything critical and you can use it to build your own.

johnAq









[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to