1. Check out our companion app, Forums for Android! Download from Google Play

need help with a profile timer w/ countdown

Discussion in 'Android Apps & Games' started by dcooterfrog, Jan 28, 2013.

  1. dcooterfrog

    dcooterfrog Well-Known Member
    Thread Starter

    Dec 20, 2010
    ARGH purpose of the profile
    start when a programs in a list are started.
    count down the time with flashed every x minutes
    warn at completion
    do something disruptive
    alert or alarm or close the app or lock the screen or just bounce to home
    I am having trouble with flow control with the subroutines.

    the closestop subroutine starts before the countdown is complete.

    i had a simpler countdown that woud simply wait and then go to the top. if not enough time had passed. i thought the problem might be the wait so I wrote it like this.

    actually its just some parts of the close that dont wait for completion.
    the home key or a pop up or a notify.
    flash seems to wait but its not disruptive enough

    Main (3)
    A1: Perform Task [ Name:Init Stop:Off Priority:8 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]
    A2: Flash [ Text:Timer Starting
    %TimeAllowed Minutes Left Long:Off ]
    A3: Perform Task [ Name:CountDown Stop:Off Priority:9 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable:%finished ]
    <wait for completion>
    A4: Wait Until [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ] If [ %finished = 1 ]
    A5: Flash [ Text:Time is up!
    %finished Long:Off ]
    A6: Perform Task [ Name:Close Stop:Off Priority:8 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]
    A7: Flash [ Text:Back to main Long:Off ]

    Init (4)
    A1: Variable Set [ Name:%TimeAllowed To:10 Do Maths:Off Append:Off ]
    A2: Variable Set [ Name:%TimeRemaining To:%TimeAllowed Do Maths:Off Append:Off ]

    CountDown (5)
    A1: Variable Subtract [ Name:%TimeRemaining Value:2 ]
    A2: Variable Set [ Name:%waitstart To:%TIMES Do Maths:Off Append:Off ]
    A3: Variable Set [ Name:%waitend To:%waitstart +10 Do Maths:On Append:Off ]
    A4: Anchor
    A5: Flash [ Text:%TimeRemaining
    %waitend Long:Off ]
    A6: Variable Subtract [ Name:%TimeRemaining Value:1 ]
    A7: Variable Add [ Name:%waitstart Value:1 Wrap Around:0 ]
    A8: Goto [ Type:Action Label Number:1 Label:Donewaiting ] If [ %waitend > %waitstart ]
    <finished = 1>
    A9: Return [ Value:1 Stop:On ]

    Close (6)
    A1: Flash [ Text:Closeing now Long:Off ]
    A2: Go Home [ Page:0 ]



  2. userloser

    userloser Active Member

    Jan 15, 2013
    check if the "enforce task order" option in the profile properties (long tap profile) helps.

Share This Page