Announcement

Collapse
No announcement yet.

how to break script process and continue ?

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

  • webultra
    replied
    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.

    Leave a comment:


  • webultra
    replied
    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.

    Leave a comment:


  • karn009
    replied
    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

    Leave a comment:


  • RizlaUK
    replied
    a loop is not practical for what you want to do, use a "Page Timer" instead :yes

    Leave a comment:


  • karn009
    replied
    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

    Leave a comment:


  • Shrek
    replied
    Pages -> Page1 -> On Key

    Anything put there happens whenever a key is pressed:



    I think thats what you want.

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


  • karn009
    started a topic how to break script process and continue ?

    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
Working...
X