Timer with sound question
Posted: Fri Apr 29, 2011 12:58 pm
I am needing to play a sound file (alarm.mp3) after a specific time has passed. I have looked at other timers/counters in the forum and found this one, which is working for tracking the minutes and seconds. How/where would I implement a play command to play the sound file after X minutes/seconds have passed?
This script produces the sound, but it keeps repeating the first second of the sound file over and over...
I'm sure the problem is in the message order, but I am at a loss... could someone point me in the right direction?
Any input would be appreciated, as always
:Todd
This script produces the sound, but it keeps repeating the first second of the sound file over and over...
I'm sure the problem is in the message order, but I am at a loss... could someone point me in the right direction?
Any input would be appreciated, as always

:Todd
Code: Select all
global gWeight
local tMin1, tSec1, tCalories
on mouseUp
--start with graphic "Stand"
if the label of me is "Stand" then
--change graphic to "Sit"
set the label of me to "Sit"
set the icon of me to 1060
put 0 into tMin1
put 0 into tSec1
--update calories burned
send "CaloriesBurned" to me in 60 seconds
--start timer
send "Timer1" to me in 1 second
--sound alarm
send "soundAlarm" to me in 120 seconds
else if the label of me is "Sit" then
--change graphic to "Stand"
set the label of me to "Stand"
set the icon of me to 1059
put 0 into tMin1
put 0 into tSec1
put "00" into field "1Sec"
put "00" into field "1Min"
put 0 into tCalories
end if
end mouseUp
on Timer1
add 1 to tSec1
if tSec1 < 60 then
if tSec1 <= 9 then
put "0" & tSec1 into field "1Sec"
else
put tSec1 into field "1Sec"
end if
else
if tSec1 = 60 then
put "00" into field "1Sec"
end if
put 0 into tSec1
add 1 to tMin1
if tMin1 <= 9 then
put "0" & tMin1 into field "1Min"
else
put tMin1 into field "1Min"
end if
end if
if the label of me <> "Stand" then
send "Timer1" to me in 1 second
send "CaloriesBurned" to me in 60 seconds
end if
end Timer1
on CaloriesBurned
put the round of (gWeight * tMin1 * .009) into tCalories
put tCalories into field tCaloriesBurned
end CaloriesBurned
on soundAlarm
set the blendLevel of img "alarm_icon_retina.png" to 0
play specialFolderPath(engine) & "/assets/alarm.mp3"
end soundAlarm