Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- com = {"forward","back","left","right","up","down"}
- side = "cen"
- m = peripheral.wrap("back")
- if fs.exists("GUI") then
- print("loading 1Ridav's GUI lib")
- os.loadAPI("GUI")
- else
- shell.run("pastebin","get","XcbJj1n4","GUI")
- print("loading 1Ridav's GUI lib")
- os.loadAPI("GUI")
- end
- if fs.exists("AF") then
- print("loading Zer0Galaxy festel crypt lib")
- os.loadAPI("AF")
- key = AF.getkey("123456789")
- else
- shell.run("pastebin","get","KC7uE6ZP","AF")
- print("loading Zer0Galaxy festel crypt lib")
- os.loadAPI("AF")
- key = AF.getkey("123456789")
- end
- write("enter channel(number, from 1 to 65000)")
- inp = read()
- act ={}
- if type(tonumber(inp)) == "number" then
- m.open(tonumber(inp))
- else
- error("not value")
- end
- function fw()
- if recc then
- table.insert(act,com[1])
- else
- m.transmit(200,200,com[1])
- end
- end
- function bc()
- if recc then
- table.insert(act,com[2])
- else
- m.transmit(200,200,com[2])
- end
- end
- function rh()
- if recc then
- table.insert(act,com[4])
- else
- m.transmit(200,200,com[4])
- end
- end
- function lt()
- if recc then
- table.insert(act,com[3])
- else
- m.transmit(200,200,com[3])
- end
- end
- function up()
- if recc then
- table.insert(act,com[5])
- else
- m.transmit(200,200,com[5])
- --side = "cen"
- end
- end
- function down()
- if recc then
- table.insert(act,com[6])
- else
- m.transmit(200,200,com[6])
- end
- end
- function dig()
- if side == "up" then
- if recc then
- table.insert(act,"digUP")
- else
- m.transmit(200,200,"digUP")
- end
- elseif side == "down" then
- if recc then
- table.insert(act,"digDN")
- else
- m.transmit(200,200,"digDN")
- end
- elseif side == "cen" then
- if recc then
- table.insert(act,"dig")
- else
- m.transmit(200,200,"dig")
- end
- end
- end
- function place()
- if side == "up" then
- if recc then
- table.insert(act,"placeUP")
- else
- m.transmit(200,200,"placeUP")
- end
- elseif side == "down" then
- if recc then
- table.insert(act,"placeDN")
- else
- m.transmit(200,200,"placeDN")
- end
- elseif side == "cen" then
- if recc then
- table.insert(act,"place")
- else
- m.transmit(200,200,"place")
- end
- end
- end
- function upp(s)
- s.check = true
- DOWNM.check = false
- CENM.check = false
- GUI.MainPanel:draw()
- if side == "up" then
- --s.check = true
- side = "cen"
- s.check = false
- DOWNM.check = false
- CENM.check = false
- GUI.MainPanel:draw()
- elseif side == "down" then
- side = "up"
- elseif side == "cen" then
- side = "up"
- end
- end
- function downn(s)
- s.check = true
- UPM.check = false
- CENM.check = false
- GUI.MainPanel:draw()
- if side == "down" then
- side = "cen"
- s.check = false
- UPM.check = false
- GUI.MainPanel:draw()
- elseif side == "up" then
- side = "down"
- elseif side == "cen" then
- side = "down"
- end
- end
- function cen(s)
- s.check = true
- UPM.check = false
- DOWNM.check = false
- GUI.MainPanel:draw()
- if side == "up" then
- side = "cen"
- elseif side == "down" then
- side = "cen"
- elseif side == "cen" then
- side = "cen"
- end
- end
- function record(s)
- if s.check then
- recc = true
- else
- recc = false
- end
- end
- function execute()
- if type(act) == "table" then
- for i=1,#act do
- if type(act[i]) == "string" then
- m.transmit(200,200,act[i])
- elseif type(act[i]) == "table" then
- tab = act[i]
- for o=1,tab[#tab] do
- for j=1,#tab-1 do
- m.transmit(200,200,tab[j])
- end
- end
- end
- sleep(0.5)
- end
- end
- end
- function clear()
- act = {}
- end
- term.clear()
- term.setCursorPos(1,1)
- FB = GUI.NewButton(nil, 8, 4, 8, 3, "FORWARD", fw)
- BB = GUI.NewButton(nil, 8, 14, 8, 3, "BACK", bc)
- LB = GUI.NewButton(nil, 4, 8, 3, 5, "LEFT", lt)
- RB = GUI.NewButton(nil, 17, 8, 3, 5, "RIGHT", rh)
- UB = GUI.NewButton(nil, 8, 8, 8, 2, "UP", up,colors.red)
- DB = GUI.NewButton(nil, 8, 11, 8, 2, "DOWN",down,colors.red)
- DIGB = GUI.NewButton(nil, 4, 4 ,3,3,"DIG",dig,colors.green)
- PLACEB = GUI.NewButton(nil ,17 ,4 , 3,3, "PLACE",place,colors.green)
- UPM = GUI.NewCheckBox(nil, 23, 4,2,1,nil,upp,colors.green)
- DOWNM = GUI.NewCheckBox(nil,23,6 ,2,1,nil,downn,colors.green)
- CENM = GUI.NewCheckBox(nil, 23 , 5 ,2 ,1 ,nil ,cen , colors.red)
- REC = GUI.NewCheckBox(nil, 23 , 8 ,2 ,1 ,nil ,record , colors.orange)
- EXECUTE = GUI.NewButton(nil, 1, 17, 8, 1, "EXECUTE",execute,colors.red)
- CLEAR = GUI.NewButton(nil, 2, 17, 8, 1, "CLEAR",clear,colors.green)
- CENM.check = true
- GUI.MainPanel:addCHILD(FB,BB,UB,DB,LB,RB,DIGB,PLACEB,UPM,DOWNM,CENM,REC,EXECUTE,CLEAR)
- GUI.MainPanel:draw()
Advertisement
Add Comment
Please, Sign In to add comment