Created
April 18, 2019 15:41
-
-
Save jmfergeau/f6d7a319ae2169f802666fe5a1ac2daa to your computer and use it in GitHub Desktop.
This will emits a sound for each hour, like your average town clock or anything...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CLOCK BELL SCRIPT | |
// ORIGINAL AUTHOR: Beverly Larkin | |
// Edited by buttbadger Mirabeau | |
// Like | |
// Put below the bell sound name or UUID: | |
string bell = "bab03683-516a-22a3-a9ec-4a357dbdc587"; | |
// Or some junk | |
integer H; //Hours | |
integer M; //Minutes | |
string AP; //AM or PM | |
integer i; | |
integer actualH; | |
GetHour() | |
{ | |
integer T = (integer)llGetWallclock(); // Get time PST | |
if (T > 43200) //If it's after noon | |
{ | |
T = T - 43200; //Subtract 12 hours | |
AP = "PM"; //set to PM | |
H = T / 3600; //get hours | |
M = (T - (H * 3600)) / 60; //get minutes | |
if(H == 0) //if the hour is 0 | |
{ | |
H = 12; // make the hour 12 | |
} | |
} | |
else | |
{ | |
AP = "AM"; //set to AM | |
H = T / 3600; //get the hour | |
M = (T - (H * 3600)) / 60; //get minutes | |
if(H == 0) //if the hour is 0 | |
{ | |
H = 12; // make the hour 12 | |
} | |
} | |
} | |
default | |
{ | |
state_entry() | |
{ | |
llPreloadSound(bell); | |
llSetTimerEvent(30.0); | |
} | |
timer() | |
{ | |
GetHour(); | |
if (actualH != H) | |
{ | |
for (i = 0; i < H; ++i) | |
{ | |
llPlaySound(bell, 1.0); | |
llPlaySound(bell, 1.0); | |
llPlaySound(bell, 1.0); | |
llSleep(3.5); | |
} | |
actualH = H; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment