For example i have a chest with 4 slots, i only wanna loop through slot 2 and 4 and skip slots 1 and 3, how would i go about doing that?
Trying to think of a way so i don't have to add if statements for each slot
for i=2,4,2 do -- Start at 2, then go up to 4 in increments of 2.
-- do slot stuff
end
!**!**!*!
!**!**!*!
!**!**!*!
!**!**!*!
!**!**!*!
1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18
19 20 21 22 23 24 25 26 27
28 29 30 31 32 33 34 35 36
37 38 39 40 41 41 43 44 45
46 47 48 49 50 51 52 53 54
(spaced top line a bit so they line up)local counter, incCounter, increments = 1, 1, {3,3,2,1}
while counter < 55 do
-- Do slot management stuff here.
counter = counter + increments[incCounter]
incCounter = incCounter + 1
if incCounter > #increments then incCounter = 1 end
end
local reactorLzh = peripheral.wrap("front")
while true do
for chest = 1 , 27 do
end
for turTle = 1 , 16 do
end
--for lzh = 1 , 4 , 7 , 9 , 10 , 13 , 16 , 18 , 19 , 22 , 25 , 27 , 28 , 31 , 34 , 36 , 37 , 40 , 43 , 45 , 46 , 49 , 52 , 54 do
--end
local aS = reactorLzh.getStackInSlot(lzh)
term.clear()
term.setCursorPos(1,1)
if aS ~= nil then
if turTle ~= nil then
if aS.name == "ic2.reactorCondensatorLap" then
if aS.dmg == 3807 then
print("Moving Slot :"..lzh)
rs.setOutput("front",false)
reactorLzh.pushItemIntoSlot("north", lzh, 1, chest)
reactorLzh.pullItemIntoSlot("west", lzh, 1, turTle)
--pullItemIntoSlot(direction, slot, maxAmount, intoSlot)
--pushItemIntoSlot(direction, slot, maxAmount, intoSlot)
end
end
end
end
end
by the looks of it, it looks like i can use counter
counter = 1
incCounter = 1
increments[1] = 3
increments[2] = 3
increments[3] = 2
increments[4] = 1
startup:17: Parmeter "slotNumber' has null value, but is not marked as nullable
local reactorLzh = peripheral.wrap("front")
for turTle = 1 , 16 do
end
for chest = 1, 27 do
end
for reactor = 1, 54 do
end
while true do
local aS = reactorLzh.getStackInSlot(reactor) --line 17
term.clear()
term.setCursorPos(1,1)
print(reactor)
if turTle ~= nil then
if aS.id ~= nil then
if aS.name == "ic2.reactorCondensatorLap" then
if aS.dmg == 3807 then
print("Moving Slot :"..reactor)
rs.setOutput("front",false)
reactorLzh.pushItemIntoSlot("north", reactor, 1, chest)
reactorLzh.pullItemIntoSlot("west", reactor, 1, turTle)
--pullItemIntoSlot(direction, slot, maxAmount, intoSlot)
--pushItemIntoSlot(direction, slot, maxAmount, intoSlot)
end
end
end
end
sleep(0)
end
if turTle ~= nil then
if aS.id ~= nil then
if aS.name == "ic2.reactorCondensatorLap" then
if aS.dmg == 3807 then
.
.
.
end
end
end
end
if turTle ~= nil and aS.id ~= nil and aS.name == "ic2.reactorCondensatorLap" and aS.dmg == 3807 then
.
.
.
end
for r = 1,54 do
for t = 1,16 do
for c = 1,27 do
local reactor = reactorLzh.getStackInSlot(r)
term.clear()
term.setCursorPos(1,1)
print("R: "..r)
print("T: "..t)
print("C: "..c)
if t ~= nil and reactor ~= nil and reactor.id == 30083 and reactor.dmg == 3807 then
print("Moving Slot :"..r)
rs.setOutput("front",false)
reactorLzh.pushItemIntoSlot("north", r, 1, c)
--pullItemIntoSlot(direction, slot, maxAmount, intoSlot)
--pushItemIntoSlot(direction, slot, maxAmount, intoSlot)
reactorLzh.pullItemIntoSlot("west", t, 1, r)
end
end
end
end
What code looks like on my endit seems to loop trough one then when it gets to the end the other loop goes up, i was hoping they would all loop at the same time.
local t, c = 1, 1
for r = 1,54 do
local reactor = reactorLzh.getStackInSlot(r)
term.clear()
term.setCursorPos(1,1)
print("R: "..r)
print("T: "..t)
print("C: "..c)
if t ~= nil and reactor ~= nil and reactor.id == 30083 and reactor.dmg == 3807 then
print("Moving Slot :"..r)
rs.setOutput("front",false)
reactorLzh.pushItemIntoSlot("north", r, 1, c)
--pullItemIntoSlot(direction, slot, maxAmount, intoSlot)
--pushItemIntoSlot(direction, slot, maxAmount, intoSlot)
reactorLzh.pullItemIntoSlot("west", t, 1, r)
end
t = t + 1
c = c + 1
if t > 16 then t = 1 end
if c > 27 then c = 1 end
end
My code is indented, it just looses intendtation when i paste and or post it
function mon1Day()
local day = os.day()
mon1.setCursorPos(1,10)
mon1.clearLine()
centerMon1("MC Day: "..day)
end