自訂延遲

首先我們要用上系統(遊戲)時間,

用到的API有 game.now(),

假設我要每5秒說一次"歡迎挑戰AI-TwilightGo( ・ω・)(・ω・ )"

if timecount == nil then
    timecount = 0 --宣告 timecount=0( timecount為目標時間,)
end

if game.now ==  timecount then --如果目前 為目標 時間

me.talk(" 歡迎挑戰AI-TwilightGo( ・ω・)(・ω・ )") --說出AI的名字

timecount =   timecount+5000 --把 目標 時間延後/增加5秒

end