Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 7:50 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: hundreds of seconds on screen in stopwatch
PostPosted: March 9th, 2009, 10:28 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
I have to make a count up and count down clock with 1/100 seconds display.
I often use a script that i found on this forum to set the correct format 00:00:00 / hour:minute:seconds but how do i get the last 2 or 3 digits depending on the precision.

In the example i use the sconds display to count 1/100, but thats wrong.
Now i hope someone knows more about it.

Kind regards,

Ad


You do not have the required permissions to view the files attached to this post.

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 9th, 2009, 10:16 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Opus has several ways to get the milliseconds. You simply keep things in decimal terms rather than making them hours:minutes... 60 based. So you just use that plus math.round or math.ceil etc. on the milliseconds part. You can also specify a formatting mask "5.2" to show something like 03.45 sec.

There are several sample .IMP files posted already on the forum with countdown timers, quiz clocks, etc. that have done this work.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 10th, 2009, 12:25 am 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
This is copied from an old post. It may help.........


""""I had noticed that the Clock Action has the option to display time down to hundredths of a second and I wondered if the Script Clock has the same capability....which it does


myClock = CreateClock("ScriptClock","clock_var","[hh],[mm],[ss],[ff]")
myClock.Start()


This will give you a script clock with hundredth of a second resolution BUT.....there is no 'myClock.GetTenths()' operation, however the tenths and hundredths can be extracted from the clock_var variable by using the following constant expressions in insert variable.




(clock_var.toString()).charAt(9)-------for tenths of a second
(clock_var.toString()).charAt(10)------for hundredths of a second.""""

I use this in many applications and it looks good and it runs very smoothly.



Sandy

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 10th, 2009, 7:33 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Stupid me, i did not look at the standard clock function that also has the tenth and hundreds function [ff]
But now the count down with tenth and hundreds, how do you do that in a script?


Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 10th, 2009, 9:30 am 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
Here is an extract of code I used to create a countdown timer, but only to tenths resolution. You will have to play around with the code and char positions to get it working for your application.


Code:
Mins=String.number((clock_var.toString()).charAt(4))
Tens=String.number((clock_var.toString()).charAt(6))
Secs=String.number((clock_var.toString()).charAt(7))
ClockSecs=Mins*60+Tens*10+Secs

Remaining1=TimePeriod-ClockSecs



Where 'TimePeriod' is the countdown time in seconds.
I convert the clock to seconds to do calculations, then convery back (Remaining1) to hexagesimal to display.

Remember, Opus is even driven, You need to create an event (trigger)
to initiate the code above. I use a half second ticker, so it performs the calculations every half second, for display purposes...it is OK.
It is not possible to get real 'calibrated' accuracy to hundredths of a second from a clock like this. If you use a button press to stop the timer, you can not be sure of the time it will take between the trigger being recieved and the program doing anything about it. It depends on what the PC is doing in the background. Tickers are not 100% accurate.

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 10th, 2009, 11:29 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Thanks for your reaction and script. I'm gonne try it right away.

Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 10th, 2009, 12:20 pm 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
Sorry I didn't have time to put an imp together for you, but it's better to learn for yourself :-)
There are chunks of script available to convert from seconds to Min/sec with the correct format.
what is your timer for?

Sandy

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 10th, 2009, 2:39 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Hi Sandy,

My timer is for several applications. One is for an icehockey scorboard. Therfor i don't need the milisecond option. The other application is for a new TV show i produce. To give it more pro look on TV i need the miliseconds.

I tried to get the script work. So far... i need more practice.
If you have a simple IMP example of the countdown let me know.

kind regards,


Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 10th, 2009, 3:19 pm 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
It would be easier to correct what you have. (I think) can you post your IMP? My clock is embedded in a dual deck MP3 player and difficult to extract the script.

Sandy

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 14th, 2009, 10:16 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
I don't have an page yet. It must be a countdown with miliseconds. The player in the TV show will get money if he gives the right answer. The reason we need the tenth and hundreds of seconds is that he can win or loose it he can stop the counter on an exact number.
What i need to display is a counter full screen on an HD lcd tv 1920x1080.
One button to start, and one button to stop the count down time.

Kind regards,

Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 15th, 2009, 11:15 pm 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
here is a very basic countdown timer. It is not fully error trapped, but it shows one way of doing it. hopefully it will be some help to you. I was going to make it an up/down counter, but didn't have time :-)


You do not have the required permissions to view the files attached to this post.

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 16th, 2009, 8:58 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Thanks, looks like it's just what i need.
If the page for the pilot TV episode is ready i will post it.


Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 42 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group