mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
implement remove event lua function
This commit is contained in:
@@ -18,6 +18,7 @@ local messageTypes = {
|
||||
{ type = 'MessageBlue', color = '#3264C8', showOnConsole = true, showOnWindow = false },
|
||||
{ type = 'MessageRed', color = '#C83200', showOnConsole = true, showOnWindow = false }
|
||||
}
|
||||
local hideEvent
|
||||
|
||||
-- public functions
|
||||
function TextMessage.create()
|
||||
@@ -47,11 +48,11 @@ function Game.onTextMessage(type, message)
|
||||
label:setVisible(true)
|
||||
label:setForegroundColor(messageType.color)
|
||||
label:setText(message)
|
||||
|
||||
label:setStyle(messageType.windowLocation)
|
||||
|
||||
time = #message * 75
|
||||
scheduleEvent(function()
|
||||
removeEvent(hideEvent)
|
||||
hideEvent = scheduleEvent(function()
|
||||
label:setVisible(false)
|
||||
end, time)
|
||||
end
|
||||
|
Reference in New Issue
Block a user