昼か夜かを調べる gameplay.isDaylightTime
ひとことで言うと
今の時間帯が、指定した時間帯(昼・夜など)かどうかを調べて、真(true)か偽(false)を返すブロックです。
ブロックとコード
現在の時間帯が昼
ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。
gameplay.isDaylightTime(DAY)gameplay.is_daylight_time(DAY)引数(ひきすう)
引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。
| 名前 | 選べる値 | 意味 |
|---|---|---|
| query | DayTime | 取得する時刻の種類 |
使用例
Give a chat message saying whether the current time is during the day or not.
JavaScript
if (gameplay.isDaylightTime(DAY)) {
player.say("It's day.")
} else {
player.say("It's not day.")
}Python
if gameplay.is_daylight_time(DAY):
player.say("It's day.")
else:
player.say("It's not day.")