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

[TFS 1.2] Simple Crafting System.

I give you the tip how to do it,

Now if you search you find itemType:getDescription, this one obtains Description from an item:
Lua:
int LuaScriptInterface::luaItemTypeGetDescription(lua_State* L)
{
    // itemType:getDescription()
    const ItemType* itemType = getUserdata<const ItemType>(L, 1);
    if (itemType) {
        pushString(L, itemType->description);
    } else {
        lua_pushnil(L);
    }
    return 1;
}

So now you know you can do it something like this:
Code:
local itemId = config.system[lastChoice].items[choice.id].itemID
local itemType = ItemType(itemId)

if itemType then
    local attributeValue = itemType:getDescription()
    if attributeValue then
        details = details .."\n- Description:" .. attributeValue
    end
end
I would like to know if it's possible here as well to display the description of each item, as you mentioned it requires something in the source code, right? And will this code be compatible with my modal craft? See here what I'm using.
 
I would like to know if it's possible here as well to display the description of each item, as you mentioned it requires something in the source code, right? And will this code be compatible with my modal craft? See here what I'm using.

If you are using TFS 1.X should get the itemType:getDescription() already on sources.

Just use the same code, to your modal windows in order to show description inside the 'details/recipe' when looking.
On this script is 'details' name in order to call and show description text on the modal, replace details by the same function to show description on your modal.

On case is str = str, on the craft system you are using, call itemType:getDescription() to show the description of the item.
 
I give you the tip how to do it,

Now if you search you find itemType:getDescription, this one obtains Description from an item:
Lua:
int LuaScriptInterface::luaItemTypeGetDescription(lua_State* L)
{
    // itemType:getDescription()
    const ItemType* itemType = getUserdata<const ItemType>(L, 1);
    if (itemType) {
        pushString(L, itemType->description);
    } else {
        lua_pushnil(L);
    }
    return 1;
}

So now you know you can do it something like this:
Code:
local itemId = config.system[lastChoice].items[choice.id].itemID
local itemType = ItemType(itemId)

if itemType then
    local attributeValue = itemType:getDescription()
    if attributeValue then
        details = details .."\n- Description:" .. attributeValue
    end
end
Thank you.
Sorry I guess I misread the last post :)
 
Back
Top