-
Notifications
You must be signed in to change notification settings - Fork 0
/
Toggle Subtitles.lua
54 lines (44 loc) · 1.62 KB
/
Toggle Subtitles.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--[[
>>> Simple event to toggle subtitles on and off. // AutisticLulu
Gonna make it more configurable in the near future, for now it's using the same positions and style as in VS FNaF 3!
(Requires the following code to be inside the lua for your stage or song:
#------------------------------------------------------------------------#
local function createSubtitles()
makeLuaText('SubtitleText', '', 1200, 50, 545)
setTextSize('SubtitleText', 45)
setTextFont('SubtitleText', 'YOURFONTNAME.ttf')
setObjectCamera('SubtitleText', 'camOther')
local subTextWidth = getTextWidth('SubtitleText')
makeLuaSprite('SubtitleTextBG', nil, 0, 535)
makeGraphic('SubtitleTextBG', subTextWidth, 72, '000000')
setObjectCamera('SubtitleTextBG', 'camOther')
setProperty('SubtitleTextBG.alpha', 0)
addLuaSprite('SubtitleTextBG', true)
addLuaText('SubtitleText')
end
function onCreate()
createSubtitles()
end
#------------------------------------------------------------------------#
Value 1:
Subtitle Text
(Example: "Hello, world!")
Leave value 1 empty to remove subtitles.
Value 2:
Colour [HEX]
(Example: 9DCFED)
If value 2 isn't specified, the color will default to white.
]]
function onEvent(name, value1, value2)
if name == 'Toggle Subtitles' then
if value1 == nil or value1 == '' or value1 == ' ' then
setTextString('SubtitleText', '')
setProperty('SubtitleTextBG.alpha', 0)
else
setProperty('SubtitleTextBG.alpha', 0.5)
setProperty('SubtitleText.alpha', 1)
setTextString('SubtitleText', value1)
setTextColor('SubtitleText', value2)
end
end
end