Problems with "Set text position" and "Kill background text" skripts

  • #1, by visnewbieMonday, 14. December 2015, 16:41 5 years ago
    Hi everyone, I´m fairly new to visionaire and now I´m kind of stuck. I use a skript that allows me to set the character text position, something like this:
    ----------------------------------------------

    function setTextPosHook(text, game)
    local owner = text:getLink(VTextOwner)
    if owner:getId().tableId == eCharacters and owner:getName() == 'Hero' then
    local pos1 = {x=1015, y=13}
    text:setValue(VTextPosition, pos1)
    return true
    end
    if owner:getId().tableId == eCharacters and owner:getName() == 'Heroine' then
    local pos2 = {x=1015, y=13}
    text:setValue(VTextPosition, pos2)
    return true
    end

    --------------------------
    The skript alone works fine, but in some scenes i need to stop some background text with AFRLme´s "Kill Background text" skrpt:
    -----------------------------------------
    --[[
    Kill background text (multiple options) [v3] (30/02/2014)
    Written by AFRLme [Lee Clarke]
    -- + --
    alternatingfrequencies@hotmail.com | skype @ AFRLme
    -- + --
    This script is donation optional. In game credit is non-negotiable.
    You are free to: ¹ use it in your game(s). ² modify the script.
    Do not remove - or edit - this comment block.
    --]]

    -- * tables * --
    txt = {} -- create table
    txt["_temporary_"] = "" -- set table as temporary

    -- * function which kills active background text (1 = all, 2 = all characters, 3 = current character) * --
    function killText(val)
    for i = table.maxn(txt), 1, -1 do
    if val == 1 and txt:getBool(VTextActive) then txt:setValue(VTextActive, false) -- all background text
    elseif val == 2 and txt:getBool(VTextActive) and txt:getLink(VTextOwner):getId().tableId == eCharacters then txt:setValue(VTextActive, false) -- all character background text
    elseif val == 3 and txt:getBool(VTextActive) and txt:getLink(VTextOwner):getName() == game:getLink(VGameCurrentCharacter):getName() then txt:setValue(VTextActive, false); break -- current character background text
    end
    end
    end

    -- * on text display function * --
    function hText(text)
    if text:getBool(VTextBackground) then table.insert(txt, text) end
    -- * --
    return false -- prevent text from being repositioned
    end

    -- * function for text finished * --
    function eText(text)
    for i = table.maxn(txt), 1, -1 do if not txt:getBool(VTextActive) then table.remove(txt, i) end end -- if text is inactive, remove from txt table
    end

    -- * event handlers * --
    registerHookFunction("setTextPosition", "hText") -- event handler for displayed text
    registerEventHandler("textStopped", "eText") -- event handler for finished text

    -----------------------------------------
    The problem is, both skripts use the "setTextPosition" Hooks, so they can´t work simultaneously. Can someone help me fugire out a way to get both skripts working together? Or an alternate way to kill background-narrator text?

    Newbie

    2 Posts


  • #2, by sebastianMonday, 14. December 2015, 18:12 5 years ago
    Hmmm... I guess you have to edit/create a backgroundtext/script which deletes texts from specific characters...

    Thread Captain

    2337 Posts

  • #3, by afrlmeMonday, 14. December 2015, 21:25 5 years ago
    I'm not sure the script is valid anymore? I wrote it a while ago. Some of the text related stuff in the data structure were changed for Visionaire Studio 4.x.

    * Ah... you could swap the hook version in my script for a registerEventHandler("textStarted", "txtStart") event handler instead or simply copy the line of code from the function in my script into your hook function & then delete the function & registerhookfunction part from the skip background text script.

    As for the text position stuff... there's no reason to code the position of each individual character. If you want the text to be in the same position for all characters &/or even for narration texts then it should be possible with a single if query.

    Imperator

    6842 Posts

  • #4, by visnewbieFriday, 18. December 2015, 10:39 5 years ago
    Thanks, that seeems to have solved the problem! Now I´m happy. Thank you!

    Newbie

    2 Posts

Write post