A little hack of the tutorial system to display nice (small) messages ingame :
This exemple hacks the TUTORIAL_TYPE_HUD_INFO_BOX tuto type, but you can also do the same with the dialog aswell. Just look the code!
Lua Code:
-- Love Lilith!
local MYADDON_FAKE_TUTO_INDEX = 666
local original_GetTutorialInfo = GetTutorialInfo
GetTutorialInfo = function(tutorialIndex)
if tutorialIndex == MYADDON_FAKE_TUTO_INDEX then
-- My code, MUST return 2 strings & 1 integer : title and description, can contain colors, keycodes, and icons. last value is integer (priority of tutorial, 0 = high priority).
end
return original_GetTutorialInfo(tutorialIndex)
end
local original_GetTutorialType = GetTutorialType
GetTutorialType = function(tutorialIndex)
if tutorialIndex == MYADDON_FAKE_TUTO_INDEX then
return TUTORIAL_TYPE_HUD_INFO_BOX
end
return original_GetTutorialType(tutorialIndex)
end
local function aFunctinCalledWhenYouWantToDisplayAMessage()
local title, desc = GetTutorialInfo(MYADDON_FAKE_TUTO_INDEX)
if title ~= "" then
-- Hack tutorial timer to adapt to short / small descriptions
TUTORIAL_SYSTEM.tutorialHandlers[TUTORIAL_TYPE_HUD_INFO_BOX].currentlyDisplayedTutorialTimeLeft = math.floor(string.len(desc) / 20) * 1000 -- You can also change the duration.
-- Display it
TUTORIAL_SYSTEM:DisplayOrQueueTutorial(MYADDON_FAKE_TUTO_INDEX, 0)
end
end