Welcome to TalkGraphics.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2000
    Location
    ON, CAN
    Posts
    4

    Default

    Hi,

    I'm stuck in a loop and not sure what the problem is. I have code that is called from a button press and drag over and in this code is a loop with a counter. I am trying to get it to loop 3 times then exit the loop but so far it seems the counter is not working. At the start, the count variable is set to one but in the output window in testing, output shows count=1 a few hundred times until it reaches the end of the scroll then it outputs "= " and it equals nothing at all. On screen, clicking once on the button that calls this loop makes it scroll continuously until it reaches the end. But, it's only supposed to scroll 3 increments (hence the loop) and then stop unless the user is still pressing the scroll arrow.

    So the variable is set to 1 but then it never changes. So my count is not working?

    It looks like a straight forward loop to me. But I'm new so what do I know. =)

    The code being called is:

    Play
    Set Variable: "count" = 1
    Trace ("count="&count)
    Loop While (count <= 3)
    Trace ("count="&count)
    Begin Tell Target ("/mc1/mc2/mc3")
    Go to Next Frame
    End Tell Target
    Begin Tell Target ("/mca/mcb")
    Go to Previous Frame
    End Tell Target
    Set Variable: count = count + 1
    Trace ("count="&count)
    End Loop

    Thanks,
    J
    IP

  2. #2
    Join Date
    Aug 2000
    Location
    ON, CAN
    Posts
    4

    Default

    Hi,

    I'm stuck in a loop and not sure what the problem is. I have code that is called from a button press and drag over and in this code is a loop with a counter. I am trying to get it to loop 3 times then exit the loop but so far it seems the counter is not working. At the start, the count variable is set to one but in the output window in testing, output shows count=1 a few hundred times until it reaches the end of the scroll then it outputs "= " and it equals nothing at all. On screen, clicking once on the button that calls this loop makes it scroll continuously until it reaches the end. But, it's only supposed to scroll 3 increments (hence the loop) and then stop unless the user is still pressing the scroll arrow.

    So the variable is set to 1 but then it never changes. So my count is not working?

    It looks like a straight forward loop to me. But I'm new so what do I know. =)

    The code being called is:

    Play
    Set Variable: "count" = 1
    Trace ("count="&count)
    Loop While (count <= 3)
    Trace ("count="&count)
    Begin Tell Target ("/mc1/mc2/mc3")
    Go to Next Frame
    End Tell Target
    Begin Tell Target ("/mca/mcb")
    Go to Previous Frame
    End Tell Target
    Set Variable: count = count + 1
    Trace ("count="&count)
    End Loop

    Thanks,
    J
    IP

  3. #3
    Join Date
    Aug 2000
    Location
    ON, CAN
    Posts
    4

    Default

    I found the answer to the problem so I'll post it for everyone's benefit. Watch syntax because it got me this time!

    My counter is not increasing because the command should be:

    Set Variable: "count" = count + 1

    not

    Set Variable: count = count + 1

    -J
    IP

  4. #4
    Join Date
    Aug 2000
    Location
    ON, CAN
    Posts
    4

    Default

    By the way, I'd like to thank erlenmeyer71 for the answer. Thanks!!
    IP

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •