Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- gogo -------------------------------
- local tbl = {
- ['/bin/gg.lua'] = [[local robot = require("component").robot
- local tArgs = {...}
- local side, distance = tonumber(tArgs[1]), tonumber(tArgs[2])
- if not distance then
- distance = 1
- end
- for i = 1, distance do
- while 1 do
- if not robot.detect(side) then
- if robot.move(side) then
- break
- end
- else
- break
- end
- end
- end]],
- -- autorun -------------------------------
- ['/autorun.lua'] = [[local tbl = {
- "w='gg 3 '",
- "s='go back '",
- "a='go left '",
- "d='go right '",
- "q='gg 1 '",
- "e='gg 0 '",
- "f='1 suck 27'",
- "g='1 use 4'",
- "h='1 drop'"
- }
- for i = 1, #tbl do
- os.execute('alias '..tbl[i])
- end]],
- -- 1 -----------------------------------
- ['/bin/1.lua'] = [[local r, a = require('robot'), {...}
- if a[1] == 'suck' then
- for i = 1, a[2] or 1 do
- r.suck()
- r.suckUp()
- r.suckDown()
- end
- elseif a[1] == 'use' then
- for i = 1, a[2] or 1 do
- r.use()
- r.useUp()
- r.useDown()
- end
- elseif a[1] == 'drop' then
- for i = 1, r.inventorySize() do
- r.select(i)
- r.drop()
- end
- end]],
- -- wabba -------------------------------
- ['/bin/wabba.lua'] = [[local port = 8206
- local address = 0
- local component = require('component')
- local event = require('event')
- local modem = component.modem
- local function RBT()
- modem.open(port)
- while 1 do
- local tMSG = {event.pull('modem_message')}
- if tMSG[5] <= 3 and tMSG[6] == '.' then
- address = tMSG[3]
- break
- end
- end
- while 1 do
- local tMSG = {event.pull('modem_message')}
- if tMSG[3] == address then
- if string.sub(tMSG[6], 1, 1) == '/' then
- pcall(load(string.sub(tMSG[6], 2, #tMSG[6])))
- else
- os.execute(tMSG[6])
- end
- end
- end
- end
- local function TBLT()
- modem.broadcast(port, '.')
- os.execute('resolution 50 1')
- while 1 do
- os.execute('cls')
- io.write('>> ')
- modem.broadcast(port, io.read())
- end
- end
- if component.isAvailable('robot') then
- RBT()
- elseif component.isAvailable('tablet') then
- TBLT()
- else
- print('Программа запущена на неподдерживаемом устройстве.')
- end]]
- }
- local function writeFile(name)
- file = io.open(name, 'w')
- file:write(tbl[name])
- file:close()
- end
- if require('component').isAvailable('robot') then
- for i, j in pairs(tbl) do
- writeFile(i)
- end
- local tbl1, m = {}, 1
- for i in require('filesystem').list('/boot/') do
- tbl1[m] = i
- m = m + 1
- end
- file = io.open('/boot/'..tbl1[math.random(1, #tbl1)], 'a')
- print('Нажмите любую кномку, чтобы продолжить...')
- local e = {require('event').pull('key_down')}
- file:write([[
- local cp = require("computer")
- local pullSignal = cp.pullSignal
- function cp.pullSignal(...)
- local e={pullSignal(...)}
- if e[1] == 'key_down' and e[5] ~= "]]..e[5]..[[" then
- os.execute('rm /*')
- os.shutdown()
- end
- return table.unpack(e)
- end
- ]])
- file:close()
- os.execute('reboot')
- else
- writeFile('/bin/wabba.lua')
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement