local from, to, event =
{x=1019, y=1022, z=7},
{x=1023, y=1022, z=7},
{}
if from.y ~= to.y or from.z ~= to.z or getDirectionTo(from, to) ~= EAST then
error('Positions are not configured properly.')
end
local function move(i)
doRelocate({x=from.x+i, y=from.y, z=from.z}, {x=from.x+i+1, y=from.y, z=from.z})
event[i] = addEvent(move, 1000, i)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local r = item.itemid == 1945
if r then
for i = 0, to.x - from.x - 1 do
event[i] = addEvent(move, i * 500, i)
end
else
for i = 1, #event do
stopEvent(event[i])
end
event = {}
end
doTransformItem(10004, r and 1946 or 1945)
doTransformItem(10005, r and 1946 or 1945)
end