At 02:49 PM 4/25/02 +0100, Kevin McCarthy wrote:

>Hi, If you see the script below I'm tying to stop cycling through the
>cast when it gets to a certain number or even name if that's easier,
>does anyone know how ?
>
>-KEV-
>
>
>on exitFrame me
>   if keypressed("a") then
>     sprite(1).membernum=sprite(1).membernum+1
>   end if


Well, here, where you have the line:

   sprite(1).membernum =sprite(1).membernum

You're just setting it to itself.

Do you want to reset it to 1, or go somewhere else, or... ?

>   if sprite(1).membernum=413 then
>     sprite(1).membernum=sprite(1).membernum
>     go to the frame
>   end if
>end


I think you're misinterpreting how the sprite(1).membernum + 1 works.

Basically, the first time through, it's member is, say, 400.

The line:
   sprite(1).membernum=sprite(1).membernum+1
is evaluated on the right side first, then the result is stored in the 
left.  So on the right, sprite(1).membernum =400.  Add 1 to it, you get 
401, and that's stored in the variable to the left of the equal 
sign.  Since that variable is sprite(1).membernum itself, it has the effect 
of incrementing sprite(1).membernum, so its values are, successively, 400, 
then 401 next time through, then 402, etc.

Finally, you get to where it's 413.  What do you want to do with it 
now?  Do you want to set it back to the original number, 400?  Do you want 
to just leave it at 413?  (If so, no need to assign it to itself, just do 
the 'go to the frame').  It won't change until you change it.

- Tab

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/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