This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
-- * function that listens out for text (display, narration) started * --
function txtStart(text)
local len = string.len(text.TextCurrentText)
-- + --
if len < 100 then
Fonts[text.TextFont].FontLineWidth = 200
elseif len > 100 and len < 200 then
Fonts[text.TextFont].FontLineWidth = 300
else
Fonts[text.TextFont].FontLineWidth = 400
end
end
registerEventHandler("textStarted", "txtStart") -- define event listener for handling text started
getObject("Characters[John]"):getLink(VCharacterFont("Fonts[Small_Font]"))
len = string.len(text.TextCurrentText)
--print(text.TextOwner:getName(), len, text.TextCurrentText)
if len < 50 then text.TextFont = Fonts["txt_default_(1)"]
elseif len > 100 then text.TextFont = Fonts["txt_default_(3)"]
else text.TextFont = Fonts["txt_default_(2)"] end
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")
This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.
New threadDeponia, The Whispered World and more than 160 other games were made with Visionaire Studio. The free version covers up to 25 scenes. For more scenes there is Visionaire Studio PRO from €75, and to sell your game the Indie Bundle for €99.
Through December 1: all licenses 30% off, for example the Indie Bundle for €69.30 instead of €99. Applied automatically at checkout.