Dialogue box question

  • #10, by afrlmeTuesday, 23. February, 01:09 A month ago
    Only one instance of the textStarted & textStopped event handlers can exist per project. You will need to merge one script into the other, or alternatively manually call the functions inside of the event handler functions belonging to the speech bubble script. What I'm saying probably doesn't make a lot of sense & it's kind of difficult for me to explain what I mean in a few words.

    Imperator

    6949 Posts


  • #11, by jf-mFriday, 19. March, 13:37 A month ago
    Hi again!

    I was wondering if i can position my texte in the absolute.
    I mean: i have the dialog portrait script, the setTextPosHook function. It is working fine as long as my background is the same resolution than in my game's properties. If i use an larger background, the text is not in the right position. It is always in the VTextPosition i put in the script. I tried to modify those values, using %, but it didn't work.
    Is there a way to center the text in the current screen, not in the whole background?
    Thanks for any help!

    Newbie

    3 Posts

  • #12, by afrlmeFriday, 19. March, 13:53 A month ago
    Yeah, you need to take the current scroll position of the scene into account. Here's an example of the setTextPosition hook that also includes the scroll position:

    function setTxtPos(text)
    if text.Owner:getId().tableId == eCharacters then
    text.Position = {x = game.ScrollPosition.x + 100, y = game.ScrollPosition.y + 900}
    return true
    end
    return false
    end

    registerHookFunction("setTextPosition", "setTxtPos")
    1
    2
    3
    4
    5
    6
    7
    8
    9


    Change the 100 & 900 bits to wherever you want to offset the text to in the current viewport. If you want to horizontally center the text in the center of the screen then replace 100 with:
    (game.WindowResolution / 2)
    1


    Imperator

    6949 Posts

  • #13, by jf-mFriday, 19. March, 14:10 A month ago
    Thanks for your answer!

    I didn't succed in using (game.WindowResolution / 2), but it doed the work with your first code!

    You rock!! smile



    Newbie

    3 Posts

  • #14, by afrlmeFriday, 19. March, 18:59 A month ago
    Sorry, I made a typo.

    (game.WindowResolution.x / 2)
    1

    Imperator

    6949 Posts

Write post