Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Touchzone(sX,sY,eX,eY,event,key)
- e,p1,p2,p3,p4 = os.pullEvent()
- if e == event and p1 == key and p2 >= sX and eX >= p2 and p3 >= sY and eY >= p3 then
- return true
- else
- return false
- end
- end
- function Touchzone_raw(x,y,e,key,sX,sY,eX,eY,event,k)
- if event == e and key == k and x >= sX and eX >= x and y >= sY and eY >= y then
- return true
- else
- return false
- end
- end
- function Button(x,y,text,col,col2)
- term.setBackgroundColor(col)
- term.setTextColor(col2)
- size = #text+1
- paintutils.drawLine(x,y,x+size,y,col)
- term.setCursorPos(x+1,y)
- write(text)
- term.setCursorPos(1,1)
- e,p1,p2,p3,p4 = os.pullEvent()
- if e == "mouse_click" and p1 == 1 and p2 >= x and x+size >= p2 and p3 == y then
- return true
- else
- return false
- end
- end
- function Draw_button(x,y,text,col,col2)
- term.setBackgroundColor(col)
- term.setTextColor(col2)
- term.setCursorPos(x,y)
- write(" "..text.." ")
- end
- function ClearScr(color)
- paintutils.drawPixel(1,1,color)
- term.clear()
- end
- function Text(x,y,text,color,color2)
- term.setTextColor(color)
- term.setBackgroundColor(color2)
- term.setCursorPos(x,y)
- print(text)
- end
- function setCol(col1,col2)
- term.setBackgroundColor(col1)
- term.setTextColor(col2)
- end
- function getSysInfo()
- id = os.getComputerID()
- label = os.getComputerLabel()
- return id,label
- end
- function FindPeri(find)
- list = peripheral.getNames()
- for i=1,#list do
- if peripheral.getType(list[i]) == find then
- return list[i]
- end
- end
- end
- function LoadConfig(path,line)
- file = fs.open(path,"r")
- for i=1,line-1 do
- file.readLine()
- end
- string = file.readLine()
- num = string.find(string,"=")
- if num ~= nil then
- string = string.sub(string,num+1)
- return string
- end
- end
- function WriteConfig(path,name,line,data)
- file = fs.open(path,"w")
- for i=1,line-1 do
- file.writeLine()
- end
- if data ~= nil then
- file.writeLine(name.."="..data)
- file.close()
- end
- end
- function EditLine(path,line,text)
- file = fs.open(path,"w")
- for i = 1,line-1 do
- file.writeLine()
- end
- file.writeLine(text)
- file.close()
- end
- function ReadLine(path,line)
- file = fs.open(path,"r")
- for i = 1,line-1 do
- file.readLine()
- end
- return file.readLine()
- end
- function centText(y,text)
- iX,iY = term.getSize()
- x = iX/2
- x = x-#text/2
- term.setCursorPos(x,y)
- print(text)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement