i hated every alarm clock i ever bought, so i made my own
the are 6 different actual 'alarms' to run
to set the alarm you have to go to "alarm 1 set" or "alarm 2 set", then you have to arm the alarms
when you set the alarm it arms it, but each time the alarm goes off you have to set it again
all of the times are in 24 hour clock
to use the buttons just click the text, the buttons may be a little of center though
Turing: |
var year, month, dayOfWeek, day, hour, minute, second : int %the variables that wil hold the times
var sechand, minhand, hourhand : int %the variables that will run the clock
var alarmHour1, alarmHour2, alarmMin1, alarmMin2 : int := - 1 %the variables that will hold the times for the alarms
var alarm1sound, alarm2sound : int := 1 %the variabels that will hold the variables for the alarm sounds
var xmouse, ymouse, button : int %the varaibels that will hold teh mouse movements
var theTime : string %the variable that will hold the date and time string
var tim : int %the variable for number of seconds since 1970:00:00:00:00
var font : int %the variable that will hold the font used
var counttime : int %the variable that will be used to coutn time
var alarm1Arm, alarm2Arm : boolean := false %is used to see if the alarm should be run
var a1Set, a2Set : boolean := false %sees if the alarms are set
font := Font.New ("Times:12:bold,italic")
procedure scifi
cls %clears the screen
Font.Draw ("Awake", 100, 100, font, brightred) %puts the word awake to the screen
drawfillbox (150, 150, 160, 160, red) %draws the awake clickbox
loop %loops to run the alarm
Mouse.Where (xmouse, ymouse, button ) %sees where the mouse is
if xmouse > 150 and xmouse < 160 and ymouse > 150 and ymouse < 160 and button = 1 then %sees if the player clicked
exit %exits the alarm loop
end if
sound (20000, 200)
sound (10000, 200)
sound (5000, 200)
sound (1250, 200)
sound (750, 200)
sound (300, 200)
end loop
end scifi
procedure lowbeeping
cls %clears the screen
Font.Draw ("Awake", 100, 100, font, brightred) %puts the word awake to the screen
drawfillbox (150, 150, 160, 160, red) %draws the awake clickbox
loop %loops to run the alarm
Mouse.Where (xmouse, ymouse, button ) %sees where the mouse is
if xmouse > 150 and xmouse < 160 and ymouse > 150 and ymouse < 160 and button = 1 then %sees if the player clicked
exit %exits the alarm loop
end if
sound (50, 200)
sound (70, 200)
end loop
end lowbeeping
procedure mediumbeeping
cls %clears the screen
Font.Draw ("Awake", 100, 100, font, brightred) %puts the word awake to the screen
drawfillbox (150, 150, 160, 160, red) %draws the awake clickbox
loop %loops to run the alarm
Mouse.Where (xmouse, ymouse, button ) %sees where the mouse is
if xmouse > 150 and xmouse < 160 and ymouse > 150 and ymouse < 160 and button = 1 then %sees if the player clicked
exit %exits the alarm loop
end if
sound (440, 200)
sound (200, 200)
end loop
end mediumbeeping
procedure highbeeping
cls %clears the screen
Font.Draw ("Awake", 100, 100, font, brightred) %puts the word awake to the screen
drawfillbox (150, 150, 160, 160, red) %draws the awake clickbox
loop %loops to run the alarm
Mouse.Where (xmouse, ymouse, button ) %sees where the mouse is
if xmouse > 150 and xmouse < 160 and ymouse > 150 and ymouse < 160 and button = 1 then %sees if the player clicked
exit %exits the alarm loop
end if
sound (4000, 200)
sound (2000, 200)
end loop
end highbeeping
procedure bass
cls %clears the screen
Font.Draw ("Awake", 100, 100, font, brightred) %puts the word awake to the screen
drawfillbox (150, 150, 160, 160, red) %draws the awake clickbox
loop %loops to run the alarm
Mouse.Where (xmouse, ymouse, button ) %sees where the mouse is
if xmouse > 150 and xmouse < 160 and ymouse > 150 and ymouse < 160 and button = 1 then %sees if the player clicked
exit %exits the alarm loop
end if
for count : 40 .. 100
sound (count, 100)
end for
for decreasing count : 100 .. 40
sound (count, 100)
end for
end loop
end bass
procedure helicopter
cls %clears the screen
Font.Draw ("Awake", 100, 100, font, brightred) %puts the word awake to the screen
drawfillbox (150, 150, 160, 160, red) %draws the awake clickbox
loop %loops to run the alarm
Mouse.Where (xmouse, ymouse, button ) %sees where the mouse is
if xmouse > 150 and xmouse < 160 and ymouse > 150 and ymouse < 160 and button = 1 then %sees if the player clicked
exit %exits the alarm loop
end if
for count : 40 .. 500
sound (count, 50)
end for
for decreasing count : 500 .. 40
sound (count, 50)
end for
end loop
end helicopter
procedure alarm1set
cls
put "Which time would you like to set the first alarm for? (hour, minute)"
get alarmHour1, alarmMin1
put "Which sound would you like the alarm to play?"
Font.Draw ("1:Sci-fi", 0, 200, font, brightred)
Font.Draw ("2:Low Beeping", 50, 200, font, brightred)
Font.Draw ("3:Medium Beeping", 160, 200, font, brightred)
Font.Draw ("4:High Beeping", 290, 200, font, brightred)
Font.Draw ("5:Bass", 400, 200, font, brightred)
Font.Draw ("6:Helicopter", 450, 200, font, brightred)
get alarm1sound
alarm1Arm := true
a1Set := true
end alarm1set
procedure alarm2set
cls
put "Which time would you like to set the second alarm for? (hour, minute)"
get alarmHour2, alarmMin2
put "Which sound would you like the alarm to play?"
Font.Draw ("1:Sci-fi", 0, 200, font, brightred)
Font.Draw ("2:Low Beeping", 50, 200, font, brightred)
Font.Draw ("3:Medium Beeping", 160, 200, font, brightred)
Font.Draw ("4:High Beeping", 290, 200, font, brightred)
Font.Draw ("5:Bass", 400, 200, font, brightred)
Font.Draw ("6:Helicopter", 450, 200, font, brightred)
get alarm2sound
alarm2Arm := true
a2Set := true
end alarm2set
procedure getTime
tim := Time.Sec
Time.SecParts (Time.Sec, year, month, day, dayOfWeek, hour, minute, second )
theTime := Time.Date
end getTime
%MAIN CODE
loop
cls %clears the screen
Font.Draw ("Alarm 1 Set", 10, 10, font, brightred)
Font.Draw ("Alarm 2 Set", 100, 10, font, brightred)
Font.Draw ("Arm Alarm 1", 210, 10, font, brightred)
Font.Draw ("Arm Alarm 2", 310, 10, font, brightred)
Font.Draw ("Alarm 1:", 10, 300, font, brightred)
Font.Draw ("Set:", 50, 280, font, brightred)
Font.Draw ("Armed:", 50, 260, font, brightred)
Font.Draw ("Alarm 2:", 200, 300, font, brightred)
Font.Draw ("Set:", 250, 280, font, brightred)
Font.Draw ("Armed:", 250, 260, font, brightred)
if a1Set = true then %sees if the alarm 1 is set
drawfillarc (90, 284, 5, 5, 0, 360, green)
else
drawfillarc (90, 284, 5, 5, 0, 360, red)
end if
if a2Set = true then %sees if the alarm 1 is set
drawfillarc (290, 284, 5, 5, 0, 360, green)
else
drawfillarc (290, 284, 5, 5, 0, 360, red)
end if
if alarm1Arm = true then %sees if the alarm 1 is set
drawfillarc (110, 264, 5, 5, 0, 360, green)
else
drawfillarc (110, 264, 5, 5, 0, 360, red)
end if
if alarm2Arm = true then %sees if the alarm 1 is set
drawfillarc (310, 264, 5, 5, 0, 360, green)
else
drawfillarc (310, 264, 5, 5, 0, 360, red)
end if
loop
getTime %gets the time
locate (1, 1) %locates top of screen
put theTime %puts the time
Mouse.Where (xmouse, ymouse, button ) %sees where the mouse is
if xmouse > 10 and xmouse < 90 and ymouse > 10 and ymouse < 20 and button = 1 then %sees if the user wants to set the alarm times
alarm1set
exit
end if
if xmouse > 100 and xmouse < 190 and ymouse > 10 and ymouse < 20 and button = 1 then %sees if the user wants to set the alarm times
alarm2set
exit
end if
if xmouse > 210 and xmouse < 300 and ymouse > 10 and ymouse < 20 and button = 1 then %sees if the user wants to arm the 1 alarm
alarm1Arm := true
drawfillarc (110, 264, 5, 5, 0, 360, green)
end if
if xmouse > 310 and xmouse < 400 and ymouse > 10 and ymouse < 20 and button = 1 then %sees if the user wants to arm the 2 alarm
alarm2Arm := true
drawfillarc (310, 264, 5, 5, 0, 360, green)
end if
%sees if the first alarm should sound
if alarm1Arm = true then %sees if the alarm is armed
if alarmHour1 = hour and alarmMin1 = minute then %sees if it is the right time to run the alarm
if alarm1sound = 1 then
scifi %accesses the alarm
alarm1Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
if alarm1sound = 2 then
lowbeeping %accesses the alarm
alarm1Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
if alarm1sound = 3 then
mediumbeeping %accesses the alarm
alarm1Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
if alarm1sound = 4 then
highbeeping %accesses the alarm
alarm1Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
if alarm1sound = 5 then
bass %accesses the alarm
alarm1Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
if alarm1sound = 6 then
helicopter %accesses the alarm
alarm1Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
end if
end if
if alarm2Arm = true then %sees if the alarm is armed
%sees if the second alarm should sound
if alarmHour2 = hour and alarmMin2 = minute then %sees if it is the right time to run the alarm
if alarm2sound = 1 then
scifi %accesses the alarm
alarm2Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
if alarm2sound = 2 then
lowbeeping %accesses the alarm
alarm2Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
if alarm2sound = 3 then
mediumbeeping %accesses the alarm
alarm2Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
if alarm2sound = 4 then
highbeeping %accesses the alarm
alarm2Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
if alarm2sound = 5 then
bass %accesses the alarm
alarm2Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
if alarm2sound = 6 then
helicopter %accesses the alarm
alarm2Arm := false %sets the alarm to un-armed
Music.SoundOff %quits all music
exit %exits the loop to run the alarm
end if
end if
end if
end loop
end loop
|
[Mod Edit: Please use syntax tags, [syntax="Turing"]Code here[/syntax]] |