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

Compiling making a TFS 0.3.6 function useable in avesta 7.6

Raiden

Developer
Joined
Sep 16, 2008
Messages
486
Reaction score
32
Location
Venezuela
Hello... Okay lets start... i got a function from the sources of 0.3.6TFS Crying damson.. it exactly are doSetItemAttribute, and i want to put it on my 7.6 server, but ofc there is a problem, when i try to compile it i get this error:

Code:
  In static member function 'static int32_t LuaScriptInterface::luaDoItemSetAttribute(lua_State*)': 
1916 C:\sourceOriginal\luascript.cpp 'any' is not a member of 'boost' 
1916 C:\sourceOriginal\luascript.cpp expected ';' before 'value' 
1921 C:\sourceOriginal\luascript.cpp 'value' was not declared in this scope 
1923 C:\sourceOriginal\luascript.cpp 'value' was not declared in this scope 
1926 C:\sourceOriginal\luascript.cpp 'value' was not declared in this scope 
1926 C:\sourceOriginal\luascript.cpp 'popBoolean' was not declared in this scope 
1928 C:\sourceOriginal\luascript.cpp 'value' was not declared in this scope 
1932 C:\sourceOriginal\luascript.cpp 'errorEx' was not declared in this scope 
1939 C:\sourceOriginal\luascript.cpp 'getEnv' was not declared in this scope 
1944 C:\sourceOriginal\luascript.cpp 'getError' was not declared in this scope 
1949 C:\sourceOriginal\luascript.cpp 'value' was not declared in this scope 
1949 C:\sourceOriginal\luascript.cpp 'value' was not declared in this scope 
1953 C:\sourceOriginal\luascript.cpp expected primary-expression before '>' token 
1956 C:\sourceOriginal\luascript.cpp 'errorEx' was not declared in this scope 
1964 C:\sourceOriginal\luascript.cpp 'any_cast' is not a member of 'boost' 
1964 C:\sourceOriginal\luascript.cpp expected primary-expression before '>' token 
1966 C:\sourceOriginal\luascript.cpp 'class Item' has no member named 'setAttribute' 
1966 C:\sourceOriginal\luascript.cpp 'any_cast' is not a member of 'boost' 
1966 C:\sourceOriginal\luascript.cpp expected primary-expression before '>' token 
1969 C:\sourceOriginal\luascript.cpp 'class Item' has no member named 'setAttribute' 
1969 C:\sourceOriginal\luascript.cpp *** [obj/luascript.o] Error 1

PLEASE READ CAREFULLY, I ALREADY COMPILE MY SERVER BY MYSELF WITH MY SOURCES, I THINK THAT TFS SOURCES ARE NOT COMPATIBLE WITH AVESTA... check the function:

In luascript.cpp
Code:
int32_t LuaScriptInterface::luaDoItemSetAttribute(lua_State* L)
{
	//doItemSetAttribute(uid, key, value)
	boost::any value;
	if(lua_isnumber(L, -1))
	{
		float tmp = popFloatNumber(L);
		if(std::floor(tmp) < tmp)
			value = tmp;
		else
			value = (int32_t)tmp;
	}
	else if(lua_isboolean(L, -1))
		value = popBoolean(L);
	else if(lua_isstring(L, -1))
		value = popString(L);
	else
	{
		lua_pop(L, 1);
		errorEx("Invalid data type");

		lua_pushboolean(L, false);
		return 1;
	}

	std::string key = popString(L);
	ScriptEnviroment* env = getEnv();

	Item* item = env->getItemByUID(popNumber(L));
	if(!item)
	{
		errorEx(getError(LUA_ERROR_ITEM_NOT_FOUND));
		lua_pushboolean(L, false);
		return 1;
	}

	if(value.type() == typeid(int32_t))
	{
		if(key == "uid")
		{
			int32_t tmp = boost::any_cast<int32_t>(value);
			if(tmp < 1000 || tmp > 0xFFFF)
			{
				errorEx("Value for protected key \"uid\" must be in range of 1000 to 65535");
				lua_pushboolean(L, false);
				return 1;
			}

			item->setUniqueId(tmp);
		}		
		else if(key == "aid")
			item->setActionId(boost::any_cast<int32_t>(value));
		else
			item->setAttribute(key, boost::any_cast<int32_t>(value));
	}
	else
		item->setAttribute(key, value);

	lua_pushboolean(L, true);
	return 1;
}

Code:
	//doItemSetAttribute(uid, key, value)
	lua_register(m_luaState, "doItemSetAttribute", LuaScriptInterface::luaDoItemSetAttribute);

In luascript.h
Code:
static int32_t luaDoItemSetAttribute(lua_State* L);

aI can't put both files, they are too big... can you help me with this information?
 
boost::any value;

it is reading that as boost::any (missing a ; )
WHY IS THERE VALUE HERE? WHAT THE HECK IS VALUE?

Hopefully you get the idea, I wont go beyond that haha. I should note that I am ridiculously bad at everything to do with C++. The fact that i could figure that out and you cant is a sign you may be working outside your scope.
 
OKay mate, i don't get it fine, but i deleted the "value" and i get this now

Code:
7342 C:\sourceOriginal\luascript.cpp 'any' is not a member of 'boost'
....

I'm the best in C++, i'm poor, but that error appears plus the anothers ones, i don't know whatyou mean with "working outside my scope" can be more specific?

Thank you for answer
 
Back
Top