AutoSplice Lua
AutoSplice Lua
--SpliceMachine
LogToConsole("Started")
maxPlayerCount = 1 -- if u set this to 1 this script will not run for 10 seconds if
theres more than 1 person in the world. it will continue if conditions are met.
function getPlayerCount()
count = 0
for _, player in pairs(GetPlayerList()) do
count = count+1
end
return count
end
function getItemAmount(itemid)
for _, item in pairs(GetInventory()) do
if item.id == itemid then
return item.amount
end
end
return 0
end
function getPlacedAmount(id)
count = 0
for _, tile in pairs(GetTiles()) do
if tile.fg == id then -- and GetTiles(math.floor(obj.posX/32),
math.floor(obj.posY/32)).flag == 0
count = count + 1
end
end
return count
end
end
return false
end
function hasPlantableSpot()
for _, tile in pairs(GetTiles()) do
if (tile.fg == 0 and GetTiles(tile.x, tile.y+1).flag == 1 or tile.fg ==
0 and GetTiles(tile.x, tile.y+1).flag == 2) then
return true
elseif tile.fg == seed1 and GetTiles(tile.x, tile.y+1).flag == 1 or
tile.fg == seed1 and GetTiles(tile.x, tile.y+1).flag == 2 then
return true
elseif tile.fg == seed2 and GetTiles(tile.x, tile.y+1).flag == 1 or
tile.fg == seed2 and GetTiles(tile.x, tile.y+1).flag == 2 then
return true
end
end
return false
end
-------------------------------------
splicemode = true
--gather seed1
if getItemAmount(seedID1) == 0 and getFloatingItemAmount(seedID1)
> 0 then
LogToConsole("PathFinding to Seed1")
while (getItemAmount(seedID1) < 200 and
getFloatingItemAmount(seedID1) > 0 ) and getPlayerCount() <= maxPlayerCount do
PathFindToObj(seedID1, 1)
Sleep(1000)
end
end
--gather seed2
if getItemAmount(seedID2) == 0 and getFloatingItemAmount(seedID2)
> 0 then
LogToConsole("PathFinding to Seed2")
while (getItemAmount(seedID2) < 200 and
getFloatingItemAmount(seedID2) > 0 ) and getPlayerCount() <= maxPlayerCount do
PathFindToObj(seedID2, 1)
Sleep(1000)
end
end
else
splicemode = false
end
else
SendPacket(2, "action|respawn")
Sleep(5000)
while getPlayerCount() > maxPlayerCount do
Sleep(10000)
end
end
end
Sleep(2000)
LogToConsole("Script Ended")