[go: up one dir, main page]

Menu

[r9]: / trunk / tfReceiver.lua  Maximize  Restore  History

Download this file

43 lines (37 with data), 1.4 kB

 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
42
43
term.clear()
term.setCursorPos( 1,1 )
write("What side is your monitor?")
term.setCursorPos( 1,2 )
monSide = read()
term.setCursorPos( 1,4 )
write("What side is your modem?")
term.setCursorPos( 1,5 )
modemSide = read()
while peripheral.isPresent(string.lower(monSide)) == false do
print("There is nothing on that side!! Please try again!")
monSide = read()
end
while peripheral.isPresent(string.lower(modemSide)) == false do
print("There is nothing on that side!! Please try again!")
modemSide = read()
end
term.clear()
term.setCursorPos( 1,1 )
rednet.open(modemSide)
monitorMsg = peripheral.wrap(monSide)
print("Great! Now listening for messages from the loggers.")
lineNum = 1
scrollNum = 1
while true do
event, p1, p2, p3 = os.pullEvent()
if event == "rednet_message" and string.sub(p2,1,9) == "X90Logger" then
monitorMsg.setCursorPos(1, lineNum)
monitorMsg.write("."..p2)
term.setCursorPos(1, lineNum)
term.write("."..p2)
lineNum = lineNum + 1
if lineNum > 10 and string.len(p2) > 1 then
monitorMsg.scroll(scrollNum)
end
end
end