• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction A funny talk action (The idea is for Happy Christmas and Happy New Year) xP!

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
What boredom does...

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:
Back
Top