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

Lua "Calculating weight for more than 100 items!"

okurde

New Member
Joined
Jan 28, 2009
Messages
134
Reaction score
1
Hello, sometimes I have this error in console:
Code:
[Warning] getItemWeightById
Calculating weight for more than 100 items!

Code that returns this error - 050-function.lua:
Code:
function getItemWeightById(itemid, count, precision)
    local item, count, precision = getItemInfo(itemid), count or 1, precision or false
    if(not item) then
        return false
    end

    if(count > 100) then
        -- print a warning, as its impossible to have more than 100 stackable items without "cheating" the count
        print('[Warning] getItemWeightById', 'Calculating weight for more than 100 items!')
    end

    local weight = item.weight * count
    return precission and weight or math.round(weight, 2)
end


But I have no idea what have to be done that player can have more than 100 items (is it possible?). Does anyone have any idea?
 
Code:
if(count > 100) then
    -- print a warning, as its impossible to have more than 100 stackable items without "cheating" the count
    print('[Warning] getItemWeightById', 'Calculating weight for more than 100 items!')
end
Shouldn't be possible to have more than 100 items in one count.

If you still need more than 100 items in a count simply alter the if statement.
 
calculate the individual item weight times count
Repeat adding items with stack 100 until the count is less than 100 and then give the rest.
 
Back
Top