[SOLVED] Change position of text

  • #1, by rauleMonday, 05. August 2013, 20:45 7 years ago
    hi,

    is ist possible to change the character display text position (similar to action part "display speaker text")?
    right now it always appears at the top of the characters graphic.

    thanks for any answer!

    best

    raul

    Newbie

    53 Posts


  • #2, by BigStansThursday, 08. August 2013, 01:55 7 years ago
    Hi Raul,

    yes. wink
    Try something with the setTextPosition hook:
    http://wiki.visionaire-tracker.net/wiki/RegisterHookFunction

    Alex has made an example here:
    http://www.visionaire-studio.net/forum/thread/character3939s...

    David

    Great Poster

    361 Posts

  • #3, by rauleThursday, 08. August 2013, 10:48 7 years ago
    Awesome!!
    thx dude!

    Newbie

    53 Posts

  • #4, by rauleThursday, 08. August 2013, 11:25 7 years ago
    ok, there is a another little thing.
    its working fine for one character if i use the "Hero" script mentioned in the thread by alex.
    is it also possible to do it for another character (in the same script)?

    i never scripted before, sorry for the stupid question wink

    thx for any answer!

    Newbie

    53 Posts

  • #5, by rauleThursday, 08. August 2013, 13:06 7 years ago
    okay got it !

    thank you!

    Newbie

    53 Posts

  • #6, by afrlmeThursday, 08. August 2013, 14:02 7 years ago
    cheers for the second link David wink

    I never got around to providing an example for the registerHookFunction in the new wiki for the exclusive VS player commands.

    now I've got an example I can base it on.

    Imperator

    6804 Posts

  • #7, by rauleThursday, 08. August 2013, 15:38 7 years ago
    is there a possibility to change the align as well?
    i've looked in the lua docu but couldn't find anything.
    thx

    Newbie

    53 Posts

  • #8, by afrlmeThursday, 08. August 2013, 16:27 7 years ago
    GameSpeakerTextAlignment - t_int:

    Defines alignment of speaker text:
    '0' (eAlignLeft): Align left.
    '1' (eAlignRight): Align right.
    '2' (eAlignCentered): Centered.
    '3' (eAlignLeftWithCenterPos): Align left (use center position).
    '4' (eAlignRightWithCenterPos): Align right (use center position).
    '5' (eAlignCenteredWithLeftPos): Centered (use left position).
    game:setValue(VGameSpeakerTextAlignment, integer value)
    1
    2


    GameTextAlignment - t_int:

    Defines alignment of spoken text:
    '0' (eAlignLeft): Align left.
    '1' (eAlignRight): Align right.
    '2' (eAlignCentered): Centered.
    '3' (eAlignLeftWithCenterPos): Align left (use center position).
    '4' (eAlignRightWithCenterPos): Align right (use center position).
    '5' (eAlignCenteredWithLeftPos): Centered (use left position).
    game:setValue(VGameTextAlignment, integer value)
    1
    2


    you can change these values in the game options setup tab also!

    Imperator

    6804 Posts

  • #9, by rauleThursday, 08. August 2013, 19:31 7 years ago
    hi
    thank you. havent seen because i looked under "text".

    the option VGameTextAlignment does something with my text but not what i want whatever value im choosing.

    this is my code
    registerHookFunction('setTextPosition', 'setTextPosHook')

    function setTextPosHook(text, game)
    local owner = text:getLink(VTextOwner)
    if owner:getId().tableId == eCharacters and owner:getName() == 'Charakter1' then
    local pos1 = {x=50, y=80}
    text:setValue(VTextPosition, pos1)
    return true
    end
    if owner:getId().tableId == eCharacters and owner:getName() == 'Charakter2' then
    local pos2 = {x=500, y=80}
    text:setValue(VTextPosition, pos2)
    return true
    end
    if owner:getId().tableId == eCharacters and owner:getName() == 'Charakter3' then
    local pos3 = {x=400, y=600}
    text:setValue(VTextPosition, pos3)
    [b]game:setValue(VGameTextAlignment, 1)[/b]
    return true

    end
    end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23


    maybe you could help.

    im new with lua, sorry

    thanks for your help!

    Newbie

    53 Posts

  • #10, by afrlmeThursday, 08. August 2013, 21:13 7 years ago
    what's up with the bbcode tags on line 18?

    you could simplify this script a lot more than this...

    is the text being displayed above the characters heads or is it being placed somewhere else on screen?
    what is happening when you use "VGameTextAlignment"?
    & why have you added "game" to the function variable after text?

    before I write up a script, can you please give me some details on exactly what you are wanting to do...
    are you planning on using this script for every character in the game?
    do you want the text to be displayed above the characters head or manually positioned somewhere on the screen; in a box/image of some kind?

    this could determine if you could use a more global script to achieve what you want to do or if it would be better to use tables or create multiple if elseif queries etc.

    Imperator

    6804 Posts

  • #11, by brut69Sunday, 11. August 2013, 00:05 7 years ago
    There is a much MUCH easier way. Just create an "empty" character. Create an object and set it where you want the text to appear (empty object). Set that newly created character to have the starting point of the new object you just created.

    Then just have the empty character talk when ever you want the text to be in another location.
    Thats how I do it 100's of times

    Great Poster

    261 Posts

Write post