02-24-2011 08:25 PM - edited 03-14-2019 07:28 AM
Does anyone have a useful script that can convert seconds into minutes? Any help would be greatly appreciated.
02-24-2011 10:38 PM
set seconds = 320
set minutes = seconds / 60
set seconds = seconds % 60
That will take 320 seconds, store 5 as the minute value, and then overwrite your 320 with 20 seconds, giving you:
minutes = 5
seconds = 20
02-25-2011 07:03 AM
I was able to create a script to convert the seconds to minutes, after giving it some thought, but my problem now is how to create a generated prompt to take the variable "min" and play it back to the user (ie. 5 mins, less than 1 min, etc.). I looked at the constructor types under the Create Generated Prompt step, but nothing is there for mins only. I can do time, but I need hours and mins. I went ahead and calculated the hours too, but all I get is "12:01AM" for the prompt, because the hour variable is set to 0 and the sec variable is set to 1.
In doing some reading on using the time constructor type, it says that if the value is over 2359, then the system treats it as millisecs. Do I need to convert the min variable to millisecs to get the proper generated prompt?
02-27-2011 09:05 AM
This would work:
/* if minutes = 5; "Five minutes" */ play prompt(--triggering contact--, n[minutes] + sp[gen/time/minutes])
Explanation:
n[] = Number prompt. This will say the number in the variable; e.g., 16 = Sixteen, 77 = seventy-seven
+ = Prompt concatenation operator. Combines two or more prompts together.
sp[] = System prompt. Plays a system prompt in the locale of the contacts language. (Usually the trigger's language [Usually the system's langauge])
Question: Would the above work if minutes < 2? If not, how could you improve the script, so that it would?
02-28-2011 05:29 PM
The system prompts!! Uhh, I forgot about those!! Thanks a lot!!
As for the script, here's what I was doing. Would this not work?
sec = 130
min = 1
03-01-2011 10:02 PM
Well, I don't see any errors, but, it's certainly not a full solution. Do you need help with something specific in your script now, or are you on your way to success? If success, please do not forget to rate each helpful post! Thanks.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide