[SOLVED] Change position of text

  • #1, z rauleMonday, 05. August 2013, 20:45 hodinky 12 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

    Bažant

    53 Posts


  • #2, z BigStansThursday, 08. August 2013, 01:55 hodinky 12 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

    Čestný člen

    361 Posts

  • #3, z rauleThursday, 08. August 2013, 10:48 hodinky 12 years ago
    Awesome!!
    thx dude!

    Bažant

    53 Posts

  • #4, z rauleThursday, 08. August 2013, 11:25 hodinky 12 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!

    Bažant

    53 Posts

  • #5, z rauleThursday, 08. August 2013, 13:06 hodinky 12 years ago
    okay got it !

    thank you!

    Bažant

    53 Posts

  • #6, z afrlmeThursday, 08. August 2013, 14:02 hodinky 12 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.

    Imperátor

    7285 Posts

  • #7, z rauleThursday, 08. August 2013, 15:38 hodinky 12 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

    Bažant

    53 Posts

  • #8, z afrlmeThursday, 08. August 2013, 16:27 hodinky 12 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)
    


    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)
    


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

    Imperátor

    7285 Posts

  • #9, z rauleThursday, 08. August 2013, 19:31 hodinky 12 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
    


    maybe you could help.

    im new with lua, sorry

    thanks for your help!

    Bažant

    53 Posts

  • #10, z afrlmeThursday, 08. August 2013, 21:13 hodinky 12 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.

    Imperátor

    7285 Posts

  • #11, z brut69Sunday, 11. August 2013, 00:05 hodinky 12 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

    Čestný člen

    266 Posts