ServerScript
--AddTimeEvent로 호출할 함수에요.
local function PrintMessage()
print("Call PrintMessage!") --메시지를 로그창에 출력해요.
end
--문자열("PrintMessage~")로 이벤트 이름과 PrintMessage 함수를 연결해서 호출해요.
--이벤트 이름을 다르게하면 여러개도 호출할 수 있어요.
Game:AddTimeEvent("PrintMessage1", 2, PrintMessage)
Game:AddTimeEvent("PrintMessage2", 2, PrintMessage)
이벤트
AddTimeEvent(String EventName, float Time, LuaScriptFunction EventFuunction)
일정 시간뒤에 연결 함수가 호출되는 이벤트를 추가해요. (추가할 이벤트 이름, 시간, 연결 함수)
샘플
ClientScript
Game:AddTimeEvent("PrintMessage3", 5, PrintMessage)
Game:DeleteTimeEvent("PrintMessage3") --AddTimeEvent로 등록한 함수를 삭제해서 호출되지 않게 할 수도 있어요.
이벤트
DeleteTimeEvent(String EventName)
등록된 시간 이벤트를 삭제해요. (삭제할 이벤트 이름)
샘플
Script Log

Game:DeleteTimeEvent 로 인해 3개 출력이 아닌 2개 출력
'LuaScript' 카테고리의 다른 글
[디토랜드] 단순 색상 변경 :SetBackgroundColor() :SetTextColor() (0) | 2022.01.10 |
---|---|
[디토랜드] Phase (0) | 2021.12.23 |
[디토랜드] AddReplicateValue (0) | 2021.12.23 |
[디토랜드] Create&Destroy (0) | 2021.12.23 |
[디토랜드] CheckType (Is) (0) | 2021.12.23 |