Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently January 9th, 2025, 9:27 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Time as a variable
PostPosted: January 16th, 2008, 12:10 am 
Offline

Joined: May 17th, 2007, 9:26 am
Posts: 35
Hello again, I apologise I feel that I am monopolising this board at the moment. :(

An activity in my pub is timed and I have got the timer working quite nicely, and can display the time taken.

I would now like to offer feedback dependant on how long the task has taken, but can't work out how to get the time variable in [mm]:[ss]:[ff] format to be recognised by the If, Else or Select programming actions.

I have tried various ways to express the time, and also tried the Format command to change the mm:ss into a mm.ss string, but with no luck.

Is there any way to get the programming actions to recognise the time properly?

I have done a long search of these forums but either no one has been troubled by this before or I am looking for the wrong thing :(

Once again many thank sfor all help offered.

RB


For this message R. Bullets has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 16th, 2008, 7:22 pm 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
Have a look here. It should be some help

viewtopic.php?t=2894&highlight=hundredths


Sandy

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 17th, 2008, 1:55 am 
Offline

Joined: May 17th, 2007, 9:26 am
Posts: 35
Thanks for the help Sandy,

I had a look but I'm not sure it helps. I can create a time variable, and can display it, but I can't work out how to use the variable in any programming actions (more than, less than etc.)

I do appreciate the time you have taken to look :)

RB


For this message R. Bullets has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 21st, 2008, 4:05 pm 
Offline

Joined: May 17th, 2007, 9:26 am
Posts: 35
I'm still trying to do this. I can compare to the clock if it is just in seconds [ss] but not if it is in minutes and seconds [mm]:[ss].

As the posts about version have been partly aimed at me I have now added a signature in the hope that this may attract more assistance.

I have also trawled at length throug the Opus help files and through the search function of this site. I have learned many helpful things, but sadly not the answer to this question.

RB

_________________
Opus Professional v8.03;
Windows 7 64-Bit Home Premium; CPU: Intel i5 750; 12GB RAM; ATI Radeon HD 5800 running triple monitor setup


For this message R. Bullets has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 22nd, 2008, 3:05 am 
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
RB,

I don't have the patience to use standard triggers and actions for 'calculations'. So I just do not have experience solving time and counters that way.

A couple thoughts that may help. You've no doubt set up numeric page or pub variables to hold your minutes and seconds values. So check that you have, or are 'getting to', numbers to be used in your calculations.

You could mix standard triggers/actions with a small amount of Opus script commands... typically in the Actions >>> Programming tab >>> Variables >>> Set Variable to Expression. In Opus Script Help, you can find commands under Index >>> Date ...
There you might try setTime() for a start time, and use getTime for an end time. Then do the subtraction and formatting on that.

Lastly, have you checked this post?
viewtopic.php?t=173&highlight=elapsed

You have to be logged into the forum to see the Attachments.
good luck.

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


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 22nd, 2008, 8:45 am 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
Sorry RB,
For some reason, I didn't get notified of your replies.
I don't have the time to give you a full explanation just now, but the link I directed you to is missing the bit of information which is vital to what you are doing

The code was

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



this shows the tenths and hundredths, but same applies for minutes and seconds. You have to extract the minute and second figures and operate on them individually. You can't operate on mm:ss because it's a formatted number and you have to extract the real numbers.

If you were trying to find out the user had done a task within 1 minute and 30 seconds. You have to convert your clock variable to two variables...say myMins and mySecs, then I would simply convert to seconds----makes the logic of comparing the time much easier.

If you use minutes and seconds--the logic gets more awkward.


what I haven't tried---if you set up the clock format only in seconds----does it count in seconds---ie 120 for two minutes, or does it just keep clocking 0 to 60????


sorry for the rushed reply
my porridge is ready!!!!! :-)

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Time in seconds
PostPosted: January 22nd, 2008, 6:51 pm 
Offline

Joined: November 3rd, 2004, 6:44 pm
Posts: 59
Location: Ipswich, UK
I am working with time at the moment and have found that when using a seconds counter it counts up to 60 then starts again at 1. It would be good to just be able to find the elapsed time in seconds as you say. However, with the nature of Opus, I am certain than someone is going to come back and say this is indeed possible!

I guess it is possible to get the time in minutes, multiply by 60 and add the number of seconds on, but I have not tried it.

Regards

Clive Cartmel

_________________
Opus Headstart Pro 6
Opus Pro 6


For this message Clive Cartmel has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 23rd, 2008, 12:20 am 
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
RB, Clive,

I got interested in the topic and created a sample Pub. I thought I'd put it over in the Tutorials area as it's a more general example of some Time manipulation, and not a direct solution for what's asked here.
viewtopic.php?p=12836#12836

Others in the forum have created some excellent Timers and have used much more direct approach to countdowns. I found great 'hints' by Searching here for 'timer' 'elapsed' 'counter' 'countdown' 'time format'... variously.

Cheers,
Larry

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


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 23rd, 2008, 11:57 am 
Offline

Joined: May 17th, 2007, 9:26 am
Posts: 35
Thanks guys, this is brilliant, I'll look into these answers. I have not fully understood on first read through, but I'll persevere and come back if I still have any problems.

I need to find a way to convert my clock [mm]:[ss]:[ff] by first losing the [ff] number as it is irrelevant, then changing the [mm] and [ss] parts to 2 new variables. Then multiplying the [mm] new variable by 60 and adding it to the [ss] variable and then (whew) I'll have a number that I can compare to offer feedback.

I have still avoided scripting so far, and will be trying not to start now!

Thanks again for all the help so far.

:)

RB

_________________
Opus Professional v8.03;
Windows 7 64-Bit Home Premium; CPU: Intel i5 750; 12GB RAM; ATI Radeon HD 5800 running triple monitor setup


For this message R. Bullets has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 23rd, 2008, 1:40 pm 
Offline

Joined: May 17th, 2007, 9:26 am
Posts: 35
Woohoo, thanks to all the help given here I have achieved what I set out to.

I ended up using three separate clocks, one for each mins secs and tenths. The result is something I can hopefully drop straight into my pub.

I have attached the final solution that I have created.

I do have one final (I hope) question, that is aesthetic only.

When the page is first viewed the timer shows as 0:: before it is started. Is there any way to show this as 00:00:00?

Once again many thanks for all the help that has got me this far :)

RB


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

_________________
Opus Professional v8.03;
Windows 7 64-Bit Home Premium; CPU: Intel i5 750; 12GB RAM; ATI Radeon HD 5800 running triple monitor setup


For this message R. Bullets has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 23rd, 2008, 8:07 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Not quite, but nearly there.

I got an "Undefined Identifier " error message in the script console that pops up. That means that Opus didn't know what "testclockmin", "testclocksec", "testclockfrac" and "sec" meant when it tried to use them for the first time.

I've added a page script that gives these variables an initial value of 0, and some code to give an initial output of 00:00:00.

Page scripts run when a page opens and are useful to set things up the page needs.

Paul


For this message Paul has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 27th, 2008, 10:20 pm 
Offline

Joined: May 17th, 2007, 9:26 am
Posts: 35
That is very kind Paul, many thanks

RB

_________________
Opus Professional v8.03;
Windows 7 64-Bit Home Premium; CPU: Intel i5 750; 12GB RAM; ATI Radeon HD 5800 running triple monitor setup


For this message R. Bullets has been thanked by : mackavi


Top
 Profile  
 
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 79 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