[SOLVED] Center text on one position regarding the current resolution and scroll

  • #1, by crankshaft87Friday, 09. October 2015, 16:11 5 years ago
    Hello everyone! I made a script (more noobish than professional, but working) to center text regarding resolution. Might come in handy for someone.

    In this example the text is always shown center top smile

    registerHookFunction('setTextPosition', 'setTextPosHook')

    function setTextPosHook(text)
    local owner = text:getLink(VTextOwner)
    if owner:getId().tableId == eCharacters and owner:getName() == 'HERO' then
    local pos = {x = game.ScrollPosition.x + (game.WindowResolution.x / 2), y = game.ScrollPosition.y + 50}
    text:setValue(VTextPosition, pos)
    return true
    end
    return false
    end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

    Newbie

    20 Posts


Write post