--[[
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[i]:getBool(VTextActive) then txt[i]:setValue(VTextActive, false) -- all background text
elseif val == 2 and txt[i]:getBool(VTextActive) and txt[i]:getLink(VTextOwner):getId().tableId == eCharacters then txt[i]:setValue(VTextActive, false) -- all character background text
elseif val == 3 and txt[i]:getBool(VTextActive) and txt[i]:getLink(VTextOwner):getName() == game:getLink(VGameCurrentCharacter):getName() then txt[i]: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[i]: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
elseif val == 4 and txt[i]:getBool(VTextActive) and txt[i]:getLink(VTextOwner) == nil then txt[i]:setValue(VTextActive, false) -- kill texts with no owner/narration
--[[
Kill background text (multiple options) [v4] (15/04/2017)
Written by AFRLme [Lee Clarke]
-- + --
https://de.tail.studio | afrlme@outlook.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, 4 = narration texts) * --
function killText(val)
for i = #txt, 1, -1 do
if val == 1 and txt[i].TextActive then txt[i].TextActive = false -- all background text (both character & narration)
elseif val == 2 and txt[i].TextActive and txt[i].TextOwner:getId().tableId == eCharacters then txt[i].TextActive = false -- all character background text
elseif val == 3 and txt[i].TextActive and txt[i].TextOwner:getName() == game.CurrentCharacter:getName() then txt[i].TextActive = false -- current character background text
elseif val == 4 and txt[i].TextActive and txt[i].TextOwner:isEmpty() then txt[i].TextActive = false -- narration background text
end
end
end
-- * on text display function * --
function sText(text)
if text.TextBackground then table.insert(txt, text) end
end
-- * function for text finished * --
function eText(text)
for i = #txt, 1, -1 do if not txt[i].TextActive then table.remove(txt, i) end end -- if text is inactive, remove from txt table
end
-- * event handlers * --
registerEventHandler("textStarted", "sText") -- event handler for begin text
registerEventHandler("textStopped", "eText") -- event handler for end text
oh :-) thank you.haha, yeah... I should have probably mentioned that it's not automatic. Any definition scripts that contain functions usually require you to the execute a function from another script or from an execute a script action part, so in the case of this script...
killText(1)
killText(2)
killText(3)
killText(4)