View difference between Paste ID: DrZ3yT7B and DCCZLdk9
SHOW: | | - or go back to the newest paste.
1-
do
1+
do
2-
component = require("component")
2+
component = require("component")
3-
term = require("term")
3+
term = require("term")
4-
table = require("table")
4+
table = require("table")
5-
chestapi = require("ChestAPI")
5+
chestapi = require("ChestAPI")
6-
computer = component.computer
6+
computer = component.computer
7-
rs = component.redstone
7+
rs = component.redstone
8-
 
8+
 
9-
gpu = component.gpu
9+
gpu = component.gpu
10-
gpu.setResolution(80,25)
10+
gpu.setResolution(80,25)
11-
  
11+
  
12-
--made by StormWolf with help from chummy, for any non-profit use only
12+
--made by StormWolf with help from chummy, for any non-profit use only
13-
 
13+
 
14-
14+
15-
version=00.8
15+
version=00.8
16-
 
16+
 
17-
term.clear()
17+
term.clear()
18-
 
18+
 
19-
 
19+
 
20-
print("StormWolf's TeleNet selector client version "..tostring(version))
20+
print("StormWolf's TeleNet selector client version "..tostring(version))
21-
print("\n---------------------------------------------------------------------")
21+
print("\n---------------------------------------------------------------------")
22-
function client ()
22+
function client ()
23-
  do
23+
  do
24-
  
24+
  
25-
  initialize() 
25+
  initialize() 
26-
  inventory = { }
26+
  inventory = { }
27-
  inventory = inventoryScanner(0)
27+
  inventory = inventoryScanner(0)
28-
 
28+
 
29-
  --i is starting position for inventory scanner
29+
  --i is starting position for inventory scanner
30-
  i=1
30+
  i=1
31-
  while i<=15 do
31+
  while i<=15 do
32-
    term.setCursor(1,i+3)
32+
    term.setCursor(1,i+3)
33-
    term.clearLine()
33+
    term.clearLine()
34-
    if not inventory[i] then
34+
    if not inventory[i] then
35-
      io.write("["..i.."] - No input")
35+
      io.write("["..i.."] - No input")
36-
    else
36+
    else
37-
      io.write("["..i.."] - "..tostring(inventory[i]))
37+
      io.write("["..i.."] - "..tostring(inventory[i]))
38-
      end
38+
      end
39-
    i=i+1
39+
    i=i+1
40-
    end
40+
    end
41-
 
41+
 
42-
  j=1
42+
  j=1
43-
  while i<=30 do
43+
  while i<=30 do
44-
    term.setCursor(40,j+3)
44+
    term.setCursor(40,j+3)
45-
    if not inventory[i] then
45+
    if not inventory[i] then
46-
      io.write("["..i.."] - No input")
46+
      io.write("["..i.."] - No input")
47-
    else
47+
    else
48-
      io.write("["..i.."] - "..tostring(inventory[i]))
48+
      io.write("["..i.."] - "..tostring(inventory[i]))
49-
      end
49+
      end
50-
    i=i+1
50+
    i=i+1
51-
    j=j+1
51+
    j=j+1
52-
    end
52+
    end
53-
  print("\n-------------------------------------------------------------------")
53+
  print("\n-------------------------------------------------------------------")
54-
 
54+
 
55-
  cursorPosition=20
55+
  cursorPosition=20
56-
  prevlocation=1
56+
  prevlocation=1
57-
  while true do
57+
  while true do
58-
    term.setCursor(1,cursorPosition)
58+
    term.setCursor(1,cursorPosition)
59-
    print("Input number for desired location followed by enter")
59+
    print("Input number for desired location followed by enter")
60-
    term.clearLine()
60+
    term.clearLine()
61-
    io.write("or enter 0 to select last location: ")
61+
    io.write("or enter 0 to select last location: ")
62-
    location = io.read()
62+
    location = io.read()
63-
     
63+
     
64-
    if tonumber(location)>getMaxSize(1) then
64+
    if tonumber(location)>getMaxSize(1) then
65-
      term.clearLine()
65+
      term.clearLine()
66-
      print("Invalid option. Please try again.")
66+
      print("Invalid option. Please try again.")
67-
      client()
67+
      client()
68-
    elseif not tonumber(location) then
68+
    elseif not tonumber(location) then
69-
      client()    
69+
      client()    
70-
    elseif tonumber(location)==-1 then
70+
    elseif tonumber(location)==-1 then
71-
      term.clearLine()
71+
      term.clearLine()
72-
      print("Reloaded table.")
72+
      print("Reloaded table.")
73-
      client()
73+
      client()
74-
    elseif tonumber(location)<0 then
74+
    elseif tonumber(location)<0 then
75-
      term.clearLine()
75+
      term.clearLine()
76-
      print("Invalid option. Please try again.")
76+
      print("Invalid option. Please try again.")
77-
      client()
77+
      client()
78-
    elseif tonumber(location)==0 then
78+
    elseif tonumber(location)==0 then
79-
      location = prevlocation
79+
      location = prevlocation
80-
    elseif tonumber(location)>0 then
80+
    elseif tonumber(location)>0 then
81-
      location = tonumber(location)
81+
      location = tonumber(location)
82-
    else
82+
    else
83-
      term.clearLine()
83+
      term.clearLine()
84-
      print("Invalid option. Please try again.")
84+
      print("Invalid option. Please try again.")
85-
      client()
85+
      client()
86-
      end
86+
      end
87-
     
87+
     
88-
    --transfer item here
88+
    --transfer item here
89-
    transposer.transferItem(0, 1, 1, location, 1)
89+
    transposer.transferItem(0, 1, 1, location, 1)
90-
       
90+
       
91-
    i=0
91+
    i=0
92-
    while i<2 do
92+
    while i<2 do
93-
      term.setCursor(1,cursorPosition+2)
93+
      term.setCursor(1,cursorPosition+2)
94-
      term.clearLine()
94+
      term.clearLine()
95-
      io.write("Loading location... {}")
95+
      io.write("Loading location... {}")
96-
      os.sleep(0.5)
96+
      os.sleep(0.5)
97-
      term.setCursor(1,cursorPosition+2)
97+
      term.setCursor(1,cursorPosition+2)
98-
      io.write("Loading location... { }")
98+
      io.write("Loading location... { }")
99-
      computer.beep()
99+
      computer.beep()
100-
      os.sleep(0.5)
100+
      os.sleep(0.5)
101-
      term.clearLine()
101+
      term.clearLine()
102-
      i=i+1
102+
      i=i+1
103-
      term.setCursor(1,2)
103+
      term.setCursor(1,2)
104-
      term.clearLine()
104+
      term.clearLine()
105-
      if location then
105+
      if location then
106-
        io.write("Last location entered: "..inventory[location])
106+
        io.write("Last location entered: "..inventory[location])
107-
        end
107+
        end
108-
      end
108+
      end
109-
    term.setCursor(1,cursorPosition+1)
109+
    term.setCursor(1,cursorPosition+1)
110-
    term.clearLine()
110+
    term.clearLine()
111-
 
111+
 
112-
    term.setCursor(1,cursorPosition+3)
112+
    term.setCursor(1,cursorPosition+3)
113-
    io.write("Initializing teleportation!")
113+
    io.write("Initializing teleportation!")
114-
    computer.beep()
114+
    computer.beep()
115-
    rs.setOutput(0, 10)
115+
    rs.setOutput(0, 10)
116-
    rs.setOutput(0, 0)
116+
    rs.setOutput(0, 0)
117-
    os.sleep(2)
117+
    os.sleep(2)
118-
    term.clearLine()
118+
    term.clearLine()
119-
    prevlocation = location
119+
    prevlocation = location
120-
    end
120+
    end
121-
  end  
121+
  end  
122-
  end
122+
  end
123-
 
123+
 
124-
124+
125-
125+
126-
126+
127-
127+
128-
--Old functions - left here while code is being refactored to use ChestAPI
128+
--Old functions - left here while code is being refactored to use ChestAPI
129-
function inventoryScanner()
129+
function inventoryScanner()
130-
  local sides = require("sides")
130+
  local sides = require("sides")
131-
  size = chestAccess.getInventorySize(sides.top)
131+
  size = chestAccess.getInventorySize(sides.top)
132-
  i = 1
132+
  i = 1
133-
  while i<size do
133+
  while i<size do
134-
      item = chestAccess.getStackInSlot(sides.top, i)
134+
      item = chestAccess.getStackInSlot(sides.top, i)
135-
      if not item then break end
135+
      if not item then break end
136-
      inventory[i] = tostring(item.label)
136+
      inventory[i] = tostring(item.label)
137-
      i=i+1
137+
      i=i+1
138-
    end
138+
    end
139-
  return inventory
139+
  return inventory
140
end
141-
 
141+
 
142-
 
142+
 
143-
 
143+
 
144-
 
144+
 
145-
 
145+
 
146-
 
146+
 
147-
--actual shit thats executed at instant run:
147+
--actual shit thats executed at instant run:
148-
client()
148+
client()
149
end