#1, by visnewbieMonday, 14. December 2015, 16:41 9 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?