Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pcid = os.getComputerID()
- mon = peripheral.wrap("back")
- gx,gy = mon.getSize()
- dbcol = colors.black
- dtcol = colors.lime
- machines = peripheral.getNames()
- com = ""
- for v, k in pairs(machines) do
- if string.find(k,"drive") ~= nil then
- drive = peripheral.wrap(k)
- driveAPI = k
- methods = peripheral.getMethods(k)
- break
- end
- end
- function readDisk()
- diskR = fs.open("disk/akw.lua","r")
- reading = diskR.readAll()
- print(reading)
- diskR.close()
- return reading
- end
- function saveDisk(text)
- disk = fs.open("disk/akw.lua","w")
- disk.write(text)
- disk.close()
- end
- function mbut(cx,cy,text,bcol,tcol)
- if bcol == nil then
- bcol = dbcol
- end
- if tcol == nil then
- tcol = dtcol
- end
- mon.setCursorPos(cx,cy)
- mon.setBackgroundColor(bcol)
- mon.setTextColor(tcol)
- mon.write(text)
- mon.setBackgroundColor(dbcol)
- mon.setTextColor(dtcol)
- end
- while true do
- evt = {os.pullEvent("monitor_touch")}
- x = evt[3]
- y = evt[4]
- mbut(4,gy," ")
- mbut(4,gy,"X: " .. x .. " Y: " .. y)
- if x == 13 and y == 2 then
- state = readDisk()
- print(state)
- if state == "false" or state == nil then
- state = true
- saveDisk(state)
- else
- state = false
- saveDisk(state)
- end
- end
- mbut(gx-8,gy," ")
- mbut(gx-8,gy,tostring(state))
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement