Loading ...
Sorry, an error occurred while loading the content.

23965Re: [Clip] Simple loop question

Expand Messages
  • Celtics2000
    Aug 29, 2013
    • 0 Attachment
      Thank you very much!! I was definitely trying to do it the wrong way.

      ^!SetDebug On
      ^!Set %Sum%=1
      ^!Set %Sum%=(Calc(%Sum%+^?{}$))$

      :Loop
      ^!If ^%Sum% = 0 ^!Goto True
      WRITE HELLO WORLD NUMBER ^%Sum%
      ^!Set %Sum%=(Calc(%Sum%-1))$
      ^!Goto Loop



      -------------------



      --- In ntb-clips@yahoogroups.com, loro <tabbie@...> wrote:
      >
      > At 21:36 2013-08-27, you wrote:
      > >How do I create a simple loop that can be repeated by a variable number input?
      > >
      > >For example I want to create a clip that can write "Hello World" and
      > >I want to input how many times I want it repeated?
      >
      > Like this?
      >
      > ^!Set %repeat%=^?{How many times?}
      >
      > ^!Set %cntr%=0
      > :loop
      > ^!Inc %cntr%
      > ^!If ^%cntr% > ^%repeat% end
      > ^!InsertText Hello world^P
      > ^!Goto loop
      >
      >
      > That is you need a label (I called it 'loop', but you can call it
      > anything). At the end of the clip you need to tell it to go to this
      > label so the loop starts over.
      > You need a counter (the variable called 'cntr') to keep track of how
      > many times the loop has run. You do that by increasing it with 1 for each loop.
      > You need a conditional to check if the loop has run as many times as
      > you want and if it has kill the clip (the ^!If line).
      >
      > Lotta
      >
    • Show all 6 messages in this topic