Simple Timer (countdown)

729 views
Skip to first unread message

Mr Fit

unread,
Oct 2, 2016, 2:30:37 PM10/2/16
to DroidScript
Hello
can somebody send me a script how to create a simple time.
Also an text, with setIntervall

regards
Lukas

Steve Garman

unread,
Oct 2, 2016, 3:18:03 PM10/2/16
to androi...@googlegroups.com

var endTime, intvl;
function OnStart()
{
  lay
= app.CreateLayout( "linear", "VCenter,FillXY" );  
  txt
= app.CreateText( "");
  txt
.SetTextSize( 32 );
  lay
.AddChild( txt );
 
  app
.AddLayout( lay );
 
var seconds = 10
  endTime
= Date.now()+1000 * seconds;
  showTime
();
  intvl
= setInterval(showTime, 300);
}
function showTime()
{
 
var tim = Date.now();
 
var diff = Math.round((endTime - tim)/1000);
 
if(diff < 1)
 
{
    diff
=0;
    clearInterval
(intvl);
 
}
  txt
.SetText( diff );
}

Lukas,
We are happy to help but you are not completely new to DroidScript.
You really should try these things yourself then post any difficulties you are having.

Did you try searching the group before posting?

Mr Fit

unread,
Oct 2, 2016, 3:38:25 PM10/2/16
to DroidScript
Thank you for your help.

I know, I'm using about 1 and an half year the DroidScript.
I've got bad Interet Connection, so I cant seach at the Forum.
I dont know how to code this because, I never need that before.

Best regards
Lukas

Netpower8

unread,
Oct 2, 2016, 8:10:41 PM10/2/16
to DroidScript
I have an excellent timer / stop watch personal plugin. I shared this. You can get the plugin here.

https://plugins.justplayer.de/

It also has an excellent sample program.

Plugin can also uninstall itself if not needed anymore.

Reply all
Reply to author
Forward
0 new messages