View difference between Paste ID: ASa2uiTC and uqAUaxd0
SHOW: | | - or go back to the newest paste.
1
rednet.open("back")
2
term.clear()
3
term.setCursorPos(1, 1)
4
version = 1.2
5
6-
	local command = read()
6+
 function startupClear()
7-
	return command
7+
    f = fs.open("startup", "w")
8
    f.write("shell.run('pastebin run ASa2uiTC')")
9
    f.close()
10
                end
11
12
local function readCommand()
13
        local command = read()
14
        return command
15
end
16
17-
		print("/door -- Opens/Closes Castle Door")
17+
function autoMode()
18
sender, message = rednet.receive()
19
	
20
	if message == "running" then
21
		term.setTextColor(colors.red)
22-
else if command:lower() == "/door" then
22+
		print("UberMiner : AutoMode, is already running somewhere else")
23-
rednet.broadcast("door")
23+
24-
print("Door Command executed")
24+
	else if message == true then
25
		term.setTextColor(colors.lime)
26
		print("UberMiner : AutoMode, now online!")
27
		
28
	else
29-
	end
29+
30
		print("UberMiner : AutoMode, now offline.")
31
		end
32
end
33
sleep(2)
34
end
35
36
local function processCommand(command)
37-
	print("Command: (ex: /help)")
37+
38
		term.clear()
39
		term.setCursorPos(1, 1)
40
		term.setTextColor(colors.red)
41
		print("List o' Commands:")
42
		term.setTextColor(colors.cyan)
43-
pocketCommands()
43+
		print("/wither | /w -- Spawns and Kills a Wither!")
44
		print("/autoMode | /am -- Puts UberMiner on/off AutoMode")
45
		print("/forward | /f -- UberMiner Forward!")
46
		print("/reboot | /r -- Reboot the computer to refresh the program")
47
		print("/help -- List o' Commands (Obviously)")
48
		term.setTextColor(colors.red)
49
		print("Press any key to return to prompt")
50
		os.pullEvent("key")
51
52
	else if command:lower() == "/reboot" or command:lower() == "/r" then
53
		term.setTextColor(colors.blue)
54
		print("Rebooting...")
55
		sleep(0.2)
56
		os.reboot()
57
		
58
	else if command:lower() == "/wither" or command:lower() == "/w" then
59
		rednet.broadcast("wither")
60
		term.setTextColor(colors.cyan)
61
		print("Wither Command executed")
62
		sleep(2)
63
64
	else if command:lower() == "/autoMode" or command:lower() == "/am" then
65
		rednet.broadcast("autoMode")
66
		term.setTextColor(colors.cyan)
67
		autoMode()
68
		print("Auto Command executed")
69
70
	else if command:lower() == "/forward" or command:lower() == "/f" then
71
		rednet.broadcast("forward")
72
		term.setTextColor(colors.cyan)
73
		print("Forward Command executed")
74
		sleep(2)
75
	else 
76
		rednet.broadcast(command)
77
		term.setTextColor(colors.red)
78
		print("Invalid command.")
79
		sleep(.2)
80
		os.reboot()
81
end
82
end
83
end
84
end
85
end
86
end
87
88
startupClear()
89
90
91
function commandReceiver()
92
	term.clear()
93
	term.setCursorPos(1, 1)
94
	term.setTextColor(colors.red)
95
	print("Command: (ex: /help) v"..version)
96
	write("> ")
97
	local command = readCommand()
98
	processCommand(command)
99
end
100
101
102
while true do
103
	commandReceiver()
104
		end