Skip to content

Instantly share code, notes, and snippets.

Created December 1, 2014 04:33
Show Gist options
  • Save anonymous/ca9057cfe353f69b4048 to your computer and use it in GitHub Desktop.
Save anonymous/ca9057cfe353f69b4048 to your computer and use it in GitHub Desktop.
Progress!
function alehounds_clock_hour() {
return alehounds_clock_hour.state++;
}
alehounds_clock_hour.state = 0;
function alehounds_clock_minute() {
return alehounds_clock_hour.state++;
}
alehounds_clock_minute.state = 0;
function alehounds_clock_second() {
return alehounds_clock_hour.state++;
}
alehounds_clock_second.state = 0;
on("chat:message", function(msg) {
//set the hour of day
if(msg.type == "api" && msg.content.indexOf("!ttsethour ") !== -1) {
alehounds_clock_hour.state = msg.content.replace("!ttsethour ", "")
sendChat(msg.who, "/w gm The hour " + alehounds_clock_hour.state + " has been set");
}
//set the minute of the hour
if(msg.type == "api" && msg.content.indexOf("!ttsetmin ") !== -1) {
alehounds_clock_minute.state = msg.content.replace("!ttsetmin ", "")
sendChat(msg.who, "/w gm The minute " + alehounds_clock_minute.state + " has been set");
}
//set the second of the minute
if(msg.type == "api" && msg.content.indexOf("!ttsetsec ") !== -1) {
alehounds_clock_second.state = msg.content.replace("!ttsetsec ", "")
sendChat(msg.who, "/w gm The second " + alehounds_clock_second.state + " has been set");
}
//Show the in-game time by using !time
if(msg.type == "api" && msg.content.indexOf("!time") !== -1) {
sendChat(msg.who, "/w gm Time: " + alehounds_clock_hour.state + ":" + alehounds_clock_minute.state + ":" + alehounds_clock_second.state + ".");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment