function setTextPosHook(text)
local Bubble1 = getObject("Interfaces[Bubble_Large]")
local Bubble2 = getObject("Interfaces[Bubble_Medium]")
local Bubble3 = getObject("Interfaces[Bubble_Small]")
local Character = getObject("Characters[Seb]")
local Characterposition = Character:getPoint(VCharacterPosition)
local CounterText = string.len(text.TextCurrentText)
--[[
Update Characterposition to prevent the bubbles and texts from going outside of the screen in 1280x720
]]--
if Characterposition.x < 235 then Characterposition.x = 235 end
if Characterposition.x > 1100 then Characterposition.x = 1100 end
if Characterposition.y < 460 then Characterposition.y = 460 end
if text:getLink(VTextOwner):getId().tableId == eCharacters and text:getLink(VTextOwner):getName() == "Seb"
then
if CounterText<40 --if text as less than 40 characters, use small bubble interface.
then
[b]--Here I need to set the font with small width value--[/b]
Bubble3:setValue(VInterfaceVisible, true)
Bubble3:setValue(VInterfaceOffset,{x=Characterposition.x-40, y=Characterposition.y-380}) --position of small bubble
setValue(VTextPosition, {x=Characterposition.x-18, y=Characterposition.y-350}) --position of text in bubble
return true
else
if CounterText<100 --if text as less than 100 characters, use medium bubble interface.
then
[b]--Here I need to set the font with medium width value--[/b]
Bubble2:setValue(VInterfaceVisible, true)
Bubble2:setValue(VInterfaceOffset,{x=Characterposition.x-185, y=Characterposition.y-440}) --position of medium bubble
text:setValue(VTextPosition, {x=Characterposition.x-156, y=Characterposition.y-415}) --position of text in bubble
return true
else --if text as more than 100 characters, use large bubble interface.
[b]--Here I need to set the font with large width value--[/b]
Bubble1:setValue(VInterfaceVisible, true)
Bubble1:setValue(VInterfaceOffset,{x=Characterposition.x-250, y=Characterposition.y-470}) --position of large bubble
text:setValue(VTextPosition, {x=Characterposition.x-218, y=Characterposition.y-440}) --position of text in bubble
return true
end
end
end
end --function end
function OnStopText(text) --hide interfaces
getObject("Interfaces[Bubble_Large]"):setValue(VInterfaceVisible, false)
getObject("Interfaces[Bubble_Medium]"):setValue(VInterfaceVisible, false)
getObject("Interfaces[Bubble_Small]"):setValue(VInterfaceVisible, false)
end
registerHookFunction("setTextPosition", "setTextPosHook")
registerEventHandler("textStopped","OnStopText")