Announcement

Collapse
No announcement yet.

how to break script process and continue ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to break script process and continue ?

    for n=1, 100 do
    Label.SetText("Label1", n);
    if System.IsKeyDown(33) then
    break
    end
    if System.IsKeyDown(34) then
    ** disable break and continue loop (if break = 50 will continue loop = 51 to 100
    end
    Application.Sleep(1)
    end

    I have problem about Break and continue Script Process How to Break then continue

  • #2
    break ends the loop so you cant continue that loop as you ended it but you could run another one.

    Comment


    • #3
      Thank. Shrek this Reply..
      If case Break not work then how to pause script process and play to continue script Help me Please !!

      Comment


      • #4
        Pages -> Page1 -> On Key

        Anything put there happens whenever a key is pressed:

        http://www.indigorose.com/webhelp/am...nts.htm#On_Key

        I think thats what you want.

        Comment


        • #5
          Thank Shrek
          have sample code for pause and play script page process

          sample onclick button in page1 I have code

          for n=1, 100 do
          Label.SetText("Label1", n);
          Application.Sleep(1)
          end

          I want Pause Loop = 50 a few minute.
          then play continue = 51 to 100

          Comment


          • #6
            a loop is not practical for what you want to do, use a "Page Timer" instead :yes
            Embrace change in your life, you never know, it could all work out for the best

            Comment


            • #7
              Originally posted by RizlaUK View Post
              a loop is not practical for what you want to do, use a "Page Timer" instead :yes
              sample. i make simulation for startup powerplant 5 step begin process step 1 to step 5 close loop. I want pause any time on page running and can continue it.
              thank RizluUK

              Comment


              • #8
                Use a coroutine:

                PHP Code:
                myCoroutineFunction()
                  for 
                n=1100 do
                    if(
                System.IsKeyDown(33)) then
                      coroutine
                .yield();
                    
                end
                  end
                end
                co 
                coroutine.create(myCoroutineFunction)

                --
                somewhere else
                coroutine.resume(co);
                if(
                Sistem.IsKeyDown(34)) then
                  
                if(coroutine.status(co) == 'suspended'then
                    coroutine
                .resume(co);
                  else
                    
                Dialog.Message('Process is'..coroutine.status(co))
                  
                end
                end 
                Something like that. This is untested code as I haven't write a lua line in a few months.

                Comment


                • #9
                  BTW, I wouldn't use a for loop with the Application.sleep function inside because it will block the entire application. Use a page time like rizla said. I wrote a couple of coroutines examples in spanish at my blog (webultra.blogspot.com) on sept-'12 or '11 lol.

                  Comment

                  Working...
                  X