Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("left")
- rednet.open("right")
- local RedPath = "ACS.Give."
- local Player1 = "Jensoo7"
- local Player2 = "Mariomarco"
- local TransID = 0
- local TransCount = 0
- local AllItemCount = 0
- local function CountAllItems()
- term.write("4")
- local Var1 = 1
- local Var2 = 0
- while Var1 <= 16 do
- Var2 = Var2 + turtle.getItemCount(Var1)
- Var1 = Var1 + 1
- end
- Var1 = 1
- AllItemCount = Var2
- end
- local function GiveItems()
- term.write("5")
- if TransID == 1 then
- local Var1 = 1
- while Var1 <= 16 do
- turtle.select(Var1)
- turtle.dropDown()
- Var1 = Var1 + 1
- end
- Var1 = 1
- elseif TransID == 2 then
- local Var1 = 1
- while Var1 <= 16 do
- turtle.select(Var1)
- turtle.drop()
- Var1 = Var1 + 1
- end
- Var1 = 1
- end
- end
- local function TransferAction()
- term.write("6")
- local SlotsItemCount
- turtle.select(1)
- turtle.suckUp()
- CountAllItems()
- while not(AllItemCount == TransCount) do
- CountAllItems()
- term.write(AllItemCount .. "|" .. TransCount)
- AllItemCount = tonumber(AllItemCount)
- TransCount = tonumber(TransCount)
- if AllItemCount > TransCount then
- turtle.select(1)
- turtle.transferTo(16, AllItemCount - TransCount)
- turtle.select(16)
- turtle.dropUp()
- elseif AllItemCount < TransCount then
- local oldItemC = AllItemCount
- turtle.suckUp()
- CountAllItems()
- if AllItemCount - oldItemC == 0 then
- AllItemCount = TransCount
- term.write("NEI")
- end
- end
- end
- GiveItems()
- end
- while redstone.getInput("back") == false do
- local SID, message, Dist = rednet.receive(12)
- if not(message == nil) then
- term.write(message)
- if not(string.match(message,RedPath .. Player1)== nil) then
- TransID = 1
- elseif not(string.match(message,RedPath .. Player2) == nil) then
- TransID = 2
- else
- TransID = 0
- end
- if not(TransID == 0) then
- term.write("1")
- if not(string.match(message, os.getComputerLabel()) == nil) then
- term.write("2")
- local I = 641
- while I > 0 do
- I = I -1
- if not(string.match(message, I) == nil) then
- TransCount = string.match(message, I)
- I = 0
- TransferAction()
- term.write("3")
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment