-- 次に落下するタライ番号 local _TaraiNum = 1 --たらい / タライ というコメントで発火 function onMessage(sender, name, message) --コメント内容 print(sender["name"].."「"..message.."」") --「たらい」or「タライ」を含むコメントであればtrue local tarai = false if string.find(message,"たらい") ~= nil then tarai = true end if string.find(message,"タライ") ~= nil then tarai = true end if tarai == true then print("たらいを落とします") local pos = Vector3.__new(0, 5, 0) TraraiFire(pos) end end vci.message.On('comment', onMessage) --posの位置にタライを落とす function TraraiFire(pos) local tarai = "T"..tostring(_TaraiNum) _TaraiNum = _TaraiNum + 1 if _TaraiNum > 16 then _TaraiNum = 1 end pos.y = pos.y + 0.5 * _TaraiNum vci.assets.GetTransform(tarai).SetLocalPosition(pos) vci.assets.GetTransform(tarai).SetLocalScale(Vector3.one) print("タライの落下位置 : "..tostring(pos)) end -- デバッグ用 function onGrab(targe) if targe == "DebugSwitch" then print("デバッグ用スイッチ") local pos = Vector3.__new(0, 5, 0) TraraiFire(pos) end end