Kill Background Text (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 01:34, 26 March 2014 by AFRLme (talk) (Created page with "''''' * late now - will finish this page the morrow - might even create a global kill background text version * ''''' == Main Script == <syntaxhighlight> --[[ Kill background...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

* late now - will finish this page the morrow - might even create a global kill background text version *

Main Script

--[[
Kill background text (current character) [v1] (25/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
txt["state"] = 0 -- default state of text (0 = normal, 1 = background text)

-- * on text displayed function * --
function hText(text)
 if text:getLink(VTextOwner):getId().tableId == eCharacters and text:getLink(VTextOwner):getName() == game:getLink(VGameCurrentCharacter):getName() and text:getBool(VTextBackground) then
  txt["state"] = 1 -- text is now background text
  txt["text"] = text --store the current text
 end
 return false -- prevent text from being repositioned
end

-- * on text end function * --
function eText(text)
 if text:getLink(VTextOwner):getId().tableId == eCharacters and text:getLink(VTextOwner):getName() == game:getLink(VGameCurrentCharacter):getName() and text:getBool(VTextBackground) then
  txt["state"] = 0 -- set state back to default value
  txt["text"] = nil -- clear text
 end
end

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