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

doSendAnimatedText ¿Deprecated function?

Xapuur

New Member
Joined
Sep 15, 2009
Messages
157
Reaction score
0
Location
Chile
I don't understand why in the console appears that doSendAnimatedText is a deprecated function when in LUA_FUNCTIONS appear:
Code:
	doSendAnimatedText(pos, text, color)

This command is giving an headache..

What i should do?

EDIT: I use TFS 0.2.11.2 :) (9.31)
 
Last edited:
Most of the DOC is outdated.
As you can see in the error, doSendAnimatedText is a deprecated function.
 
Old doPlayerSendTextMessage:
Code:
	//doPlayerSendTextMessage(cid, MessageClasses, message)
	lua_register(m_luaState, "doPlayerSendTextMessage", LuaInterface::luaDoPlayerSendTextMessage);

The new one, made to replace doSendAnimatedText:
Code:
	//doPlayerSendTextMessage(cid, MessageClasses, message[, value[, color[, position]]])
	lua_register(m_luaState, "doPlayerSendTextMessage", LuaInterface::luaDoPlayerSendTextMessage);

If you know how to read C++, here I give you the code of the function:
Code:
int32_t LuaInterface::luaDoPlayerSendTextMessage(lua_State* L)
{
	//doPlayerSendTextMessage(cid, MessageClasses, message[, value[, color[, position]]])
	int32_t args = lua_gettop(L), value = 0, color = COLOR_WHITE;
	PositionEx position;
	if(args > 5)
		popPosition(L, position);

	if(args > 4)
		color = popNumber(L);

	if(args > 3)
		value = popNumber(L);

	std::string text = popString(L);
	uint32_t messageClass = popNumber(L);

	ScriptEnviroment* env = getEnv();
	Player* player = env->getPlayerByUID(popNumber(L));
	if(!player)
	{
		errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
		lua_pushboolean(L, false);
		return 1;
	}

	if(args > 3)
	{
		if(!position.x || !position.y)
			position = player->getPosition();

		MessageDetails* details = new MessageDetails(value, (Color_t)color);
		player->sendStatsMessage((MessageClasses)messageClass, text, position, details);
		delete details;
	}
	else
		player->sendTextMessage((MessageClasses)messageClass, text);

	lua_pushboolean(L, true);
	return 1;
}
 
Back
Top