What boredom does...
This script sends each letter or word (configurable) of a text in all or one color (configurable)
This script sends each letter or word (configurable) of a text in all or one color (configurable)
XML:
<talkaction words="happy christmas" filter="word-spaced" event="script" value="xmas.lua"/>
LUA:
-- //coded by Darkhaos
local config =
{
text = "Happy Christmas OTLAND", --Use array to send by word, ex: {"Happy", "Christmas", "OTLAND"}
color = {1, 255}, --Use array to create random between colors, use integer to send only one color
start = "start", --Use "start" to send text from first letter to last letter, "end" to send from end to first.
interval = 200 --Interval between each letter/word
}
h = 0
f, t = 1, 1
len = (type(config.text) == "string" and string.len(config.text) or 1)
s = {}
function onSay(cid, words, param, channel)
pos = getCreaturePosition(cid)
if config.start == "start" then
if type(config.text) == "string" then
for i = 1, len do
table.insert(s, string.sub(config.text, f, t))
f = f + 1
t = t + 1
if i == len then
f = 1
t = 1
end
end
elseif type(config.text) == "table" then
for i = 1, table.maxn(config.text) do
table.insert(s, config.text[i])
end
end
elseif config.start == "end" then
if type(config.text) == "string" then
f, t = len, len
for i = 1, len do
table.insert(s, string.sub(config.text, f, t))
f = f - 1
t = t - 1
if i == len then
f = 1
t = 1
end
end
elseif type(config.text) == "table" then
p = table.maxn(config.text)
for i = 1, table.maxn(config.text) do
table.insert(s, config.text[p])
p = p - 1
end
end
end
for i = 1, table.maxn(s) do
c = (type(config.color) == "table" and math.random(config.color[1], config.color[2]) or type(config.color) == "number" and config.color or 255)
addEvent(doSendAnimatedText, h, pos, s[i], c)
h = h + config.interval
if i == table.maxn(s) then
f, t, h, s = 1, 1, 0, {}
end
end
return true
end
Last edited: