-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsauronfg.lua
28 lines (24 loc) · 953 Bytes
/
sauronfg.lua
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
modem = peripheral.find("modem", rednet.open);
print("\nWireless modem found. Opening...")
exit = false;
repeat
local recID, message = rednet.receive(protocol, 1);
--default message structure: "type-programname.lua-message-time sent-"
if (recID ~= nil) then
message = string.gsub(message, '-', " Turtle (running \"", 1);
message = string.gsub(message, '-', "\"): ", 1);
message = string.gsub(message, '-', " (Sent ", 1);
message = string.gsub(message, '-', ")", 1);
message = "(ID " .. recID .. ") " .. message;
monitor.setCursorPos(marginW, (marginH+1))
monitor.clearLine()
monitor.write(message)
print(message)
if (string.match(message, "sauronmine.lua")) then
rednet.broadcast(message, "mining")
end
end
monitor.setCursorPos(1,1)
monitor.clearLine()
monitor.write(textutils.formatTime(os.time()))
until (exit);