License from €75 Log in
DE EN FR ES IT CZ

Questions to text output

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 12 years ago
    I have two questions about the beautification of the text output:

    a) It is possible to define a text padding of some pixels? At the moment the text starts at the edge of the screen if the character is near the image border. That looks not balanced...
    b) How I can define the vertical distance/offset between text and character? I suspect the distance is related to the sprite height? I need some space on top of my character for some animations (much more space than my scribbled test character on the screenshot) and now the text output is to high. Maybe there is a simple offset parameter I 've overlooked?

    https://dl.dropboxusercontent.com/u/13472834/visionaire/textoutput.png
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license.

    See licenses Try it for free
  3. · 12 years ago
    Well no, but you can use the hook function "textPosition" to offset or position the text anywhere you like.

    http://wiki.visionaire-tracker.net/wiki/RegisterHookFunction

    In VS 4.x you could modify example 1 by getting the sprite position of the character instead of the characters position & then subtracting x pixels from the y value, which would allow you to control offset above the characters head.

    If you want more control I do recommend fixing the displayed texts into a bounding box / section at the top or bottom of the screen instead as it's much neater & often easier to read than text floating above characters heads.
  4. · 12 years ago
    OK. Thank you.

    But the distance between text and characters head should be a simple to edit parameter inside the character definition: "Y-Offset of text output" or like that. I think many users would change/customize this. Maybe one day it will added to the editor....
  5. · 12 years ago
    Aye maybe. I guess Simon might add some more display text options at some point. He said he wants to overhaul it, but he wasn't sure exactly how, or in what way, yet.
  6. · 12 years ago
    To modify the text position via lua script I need the size (width and height) of the text box with the current text and the character height. How I get it?
  7. · 12 years ago
    no idea about the text box. I believe you can return the position of the top left pixel of the sprite with the new getPosition() function. See here for more information & an example of getPosition() in use.
  8. · 12 years ago
    Then it is impossible to write a function that generates a margin around the text... and it is impossible to modify the y-position of spoken text only. If I overwrite the "setTextPosition" function, I can not only modify the y-position like the example in the wiki. With that example I destroy the automatic x-position correction at the edges of the screen. For that correction I need informations about the width (and height) of the text output.

    Here the code from the wiki:
    function adaptedTextPosition(text)
      -- show texts of character Hero 10 pixel below character position
      local owner = text:getLink(VTextOwner)
      if owner:getId().tableId == eCharacters and owner:getName() == 'Hero' then
        local pos = owner:getPoint(VCharacterPosition)
        pos.y = pos.y + 10
        text:setValue(VTextPosition, pos)
        return true
      end
      return false
    end
     
    registerHookFunction("setTextPosition", "adaptedTextPosition")
    
  9. · 12 years ago
    Well I'm not sure you can return the width / height of the text itself. Why I recommend forcing all text into the center of a bounding box at the bottom or top of the screen, as it's much cleaner.

    I think your game would probably look nice with speech bubbles (based on the artwork in the screenshot you provided). You could do them manually by creating each displayed text as an image or by wrapping the max-width of the text via it's properties tab & then using Lua script to place the required speech bubble image behind the text; although the latter is certainly the most complicated approach to this.
  10. · 12 years ago
    “
    by wrapping the max-width of the text via it's properties tab
    „

    That is what I asked. I need the width of the current text. And if I don't get this value, speech bubbles are also impossible to handle.... to write a parametric speech bubble routine, I need the width and the height (or number of lines) of the printed text as well
  11. · 12 years ago
    http://wiki.visionaire-tracker.net/wiki/Data_Structure#Activ...
    http://wiki.visionaire-tracker.net/wiki/Data_Structure#Font

    As you can see there are no fields returning the current width of the displayed text. You can force all text being displayed by a specific font to only allowed to be x width in pixels before it automatically generates line breaks, other than that I have no idea what to tell you.

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?