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

deleted thread

awesome, but you shouldn't care about users who will use invalid positions, script should not hide errors in this case ;)

I think this is enough:
Code:
function getRandomPositionFrom(fromPosition, toPosition)
	return {x = math.random(fromPosition.x, toPosition.x), y = math.random(fromPosition.y, toPosition.y), z = math.random(fromPosition.z, toPosition.z), stackpos = math.random(fromPosition.stackpos, toPosition.stackpos)}
end
 
awesome, but you shouldn't care about users who will use invalid positions, script should not hide errors in this case ;)
You've got a point here, but I think that theese two scripts should be in this theard. :)
 
Lua:
function postition(t)
    --Why use stackpos ?
    return (t.x ~= nil and t.y ~= nil and t.z ~= nil) and t or nil
end

function getRandomPositionFrom(fromPosition, toPosition)
    local defaultPos = {x = 100, y = 100, z = 7}
    return (postition(fromPosition) ~= nil and postition(toPosition) ~= nil) and {x = math.random(fromPosition.x, toPosition.x),y = math.random(fromPosition.y, toPosition.y), z = math.random(fromPosition.z, toPosition.z)} or defaultPos
end

no one needs a random stackpos =S
 
Lua:
function postition(t)
    --Why use stackpos ?
    return (t.x ~= nil and t.y ~= nil and t.z ~= nil) and t or nil
end

function getRandomPositionFrom(fromPosition, toPosition)
    local defaultPos = {x = 100, y = 100, z = 7}
    return (postition(fromPosition) ~= nil and postition(toPosition) ~= nil) and {x = math.random(fromPosition.x, toPosition.x),y = math.random(fromPosition.y, toPosition.y), z = math.random(fromPosition.z, toPosition.z)} or defaultPos
end

no one needs a random stackpos =S

Anyway, I think that someone (including me) will need a stackpos too. :)
 
why anyone could need a random stackpos ? =S to get a item from pos? will sure get a error if no item in tile
 
why anyone could need a random stackpos ? =S to get a item from pos? will sure get a error if no item in tile

Sure he will, but with creation of items, transforming them and so on he won't. If you don't need them it doesn't means that either I don't.
 
Back
Top