Created
September 15, 2008 13:27
-
-
Save cho45/10851 to your computer and use it in GitHub Desktop.
エリン時間予告
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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "snarl" | |
def message(str) | |
Snarl.show_message("mabinogi", str, nil, 10) # 日本語で最後の1文字がおかしい。snarl sucks | |
end | |
message "エリン時間予告を起動しました。" | |
error = ARGV[0] || 10 | |
$stdout.sync = true | |
loop do | |
time = Time.now.to_f + ( error * 1.5 ) | |
min = time % (36 * 60) / 1.5 | |
hour, min = min.divmod(60) | |
time = "%02d:%02d" % [hour, min] | |
print "ET #{time}\r" | |
case time | |
when "05:40" | |
message "もうすぐイウェカが沈みます。変身し忘れていませんか?" | |
when "11:40" | |
message "もうすぐ12時です。" | |
when "23:40" | |
message "もうすぐ0時です。" | |
end | |
sleep 1.5 | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment