スクリプト/時刻関連(履歴ID:264)

最終投稿者:Zararu128x128 mini dycoon 更新:2012/05/28 22:30:12
時刻関連のスクリプトの例です。
現在の時刻などを表示しています。

def timeString(v)
  if v < 10
    return "0" + toString(v)
  else
    return toString(v)
  end

end

def milliTimeString(v)
  if v < 10
    return "00" + toString(v)
  elsif v < 100
    return "0" + toString(v)
  else
    return toString(v)
  end
end

tm = getLocalCurrentDate()

speak("getLocalCurrentDate\n" + 
  "date -> "  + toString(tm[0]) + "/" + timeString(tm[1] + 1) + "/" + timeString(tm[2]) + " " + 
  timeString(tm[3]) + ":" + timeString(tm[4]) + ":" + timeString(tm[5]) + " " + milliTimeString(tm[6]))

tm = getLocalCurrentTimeMillisecond()

speak("getLocalCurrentTimeMillisecond\n" + toString(tm))


tm = getServerGameStartDate()

speak("getServerGameStartDate()\n" + 
  "date -> "  + toString(tm[0]) + "/" + timeString(tm[1] + 1) + "/" + timeString(tm[2]) + " " + 
  timeString(tm[3]) + ":" + timeString(tm[4]) + ":" + timeString(tm[5]) + " " + milliTimeString(tm[6])) + " " +
  "時差:" + toString(tm[7]) + " 夏時間:" + toString(tm[8]))


tm = getServerCurrentDate()

speak("getServerCurrentDate()\n" + 
  "date -> "  + toString(tm[0]) + "/" + timeString(tm[1] + 1) + "/" + timeString(tm[2]) + " " + 
  timeString(tm[3]) + ":" + timeString(tm[4]) + ":" + timeString(tm[5]) + " " + milliTimeString(tm[6])) + " " +
  "時差:" + toString(tm[7]) + " 夏時間:" + toString(tm[8]))