• 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!

[REQUEST] Fix Animated Text Lua Function from evil hero

Exedion

Active Member
Joined
Jun 11, 2007
Messages
628
Reaction score
30
Hi! i get this function from @Evil Hero in another thread but dont work, here is the error in the tfs console

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/custom/animatedtest.lua:onUse
attempt to index a nil value
stack traceback:
  [C]: at 0x7ff7a1d6bf90
  [C]: in function 'addPosition'
  data/global.lua:106: in function <data/global.lua:103>

and here is the function

Code:
function sendAnimatedText(pos, text, color)
animatedText = NetworkMessage()
animatedText:addByte(0x84)
animatedText: addPosition (heading)
animatedText:addString(text)
animatedText: addByte (color)
local list = Game.getSpectators(pos, false, true)
for _, player in pairs(list) do
if player:getClient().os >= CLIENTOS_OTCLIENT_LINUX then
animatedText:sendToPlayer(player)
else
print("cannot send animated text to player: ".. player:getName() .." due to the fact that he does not use OTClient.")
end
end
animatedText:reset()
end

i use otclient, thanks in advanced
 
Code:
function sendAnimatedText(pos, text, color)
animatedText = NetworkMessage()
animatedText:addByte(0x84)
animatedText:addPosition(pos)
animatedText:addString(text)
animatedText:addByte(color)
local list = Game.getSpectators(pos, false, true)
for _, player in pairs(list) do
if player:getClient().os >= CLIENTOS_OTCLIENT_LINUX then
animatedText:sendToPlayer(player)
else
print("cannot send animated text to player: ".. player:getName() .." due to the fact that he does not use OTClient.")
end
end
animatedText:reset()
end

how to use:
Code:
sendAnimatedText((100,100,7), "test123456", TEXTCOLOR_RED)
 
tested?

last resquest: how i can enable animated text in otclient for all protocols? i do it in the past but i not remember
 
Code:
function sendAnimatedText(pos, text, color)
animatedText = NetworkMessage()
animatedText:addByte(0x84)
animatedText:addPosition(pos)
animatedText:addString(text)
animatedText:addByte(color)
local list = Game.getSpectators(pos, false, true)
for _, player in pairs(list) do
if player:getClient().os >= CLIENTOS_OTCLIENT_LINUX then
animatedText:sendToPlayer(player)
else
print("cannot send animated text to player: ".. player:getName() .." due to the fact that he does not use OTClient.")
end
end
animatedText:reset()
end

how to use:
Code:
sendAnimatedText((100,100,7), "test123456", TEXTCOLOR_RED)

is it working?
 
Back
Top