Displayed Text

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 16:16, 22 March 2014 by David Stoffel (talk)

Displayed text is the text spoken by a character or narration text which is not spoken by a character & can be positioned wherever you like on the screen.


Let's have a look at the "Display text" action part first which is found inside of the "Character" action part area. By default character spoken text appears above the text owner (character who the displayed text is linked to) & is aligned via the "text alignment" drop down menu found inside of the "game" properties tab. Having said that we can in fact set a custom position (absolute) via Lua Script with the "VTextPosition" data structure command & the registerHookFunction; see further down the page for an example.


The "Display speaker text" action part however is more geared towards narration & can be positioned on the screen wherever you like.


Example: pause/delay methods for controlling time displayed text should be displayed for...

Wait until left mouse button is clicked to continue <p>
Continue after 2500 milliseconds (ms) <p2500ms>
Continue after 2.5 seconds (s) <p2.5s> or <p2.5>
Wait until linked speech file has finished playing <pa>

--[[
!important: You need to be careful that when you are using the first example <p> that you do not hide the mouse cursor 
beforehand as hide cursor action part disables all key input & commands until the cursor is shown; thus
your game will end up stuck on the displayed text!
--]]


Example: Displaying "string" & integer (number) values inside of a displayed text...

I have $<v=money> in my wallet. <p2> -- displays integer value of the linked Value
My name is <vs=protagonist_name>. <p2.5> -- displays "string" value of the linked value

-- the value name is case sensitive.


Example: Using Lua to control the position of currently displayed text...

-- let's create the function which sets the position of displayed text
function setTextPosHook(text)
 -- if text owner is a character then...
 if text:getLink(VTextOwner):getId().tableId == eCharacters then
  text:setValue(VTextPosition, {x=960, y=100})
  return true
 end
end

-- let's create the event listener for handling position of displayed text
registerHookFunction("setTextPosition", "setTextPosHook")