![見出し画像](https://assets.st-note.com/production/uploads/images/82210751/rectangle_large_type_2_8de6476bb0ed45803db3faf4e70adc2d.png?width=1200)
【ティラノビルダー】時間帯によって、あいさつを変更する方法
変数hourと変数time_zoneを追加してください。
![無題](https://assets.st-note.com/production/uploads/images/57496845/picture_pc_42f29e0c919746b539f7863dfb703a09.png?width=1200)
iscriptコンポーネントにコピーしてください。
var date = new Date();
f.hour = date.getHours();
if( f.hour >= 19 || f.hour <= 5 ){
f.time_zone = "night";
}else if( f.hour >= 6 && f.hour <= 11 ){
f.time_zone = "morning";
}else if( f.hour >= 12 && f.hour <= 15 ){
f.time_zone = "afternoon";
}else if( f.hour >= 16 && f.hour <= 18 ){
f.time_zone = "evening";
}
ティラノスクリプトコンポーネントにコピーしてください。
[if exp=" f.time_zone == 'morning' "]
おはようございます[p]
[elsif exp=" f.time_zone == 'afternoon' "]
こんにちは[p]
[elsif exp=" f.time_zone == 'evening' "]
こんばんは[p]
[elsif exp=" f.time_zone == 'night' "]
おやすみなさい[p]
[endif]
参考サイト
よなき@制作日記 様
https://www.fanbox.cc/@yo7key