Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local w, h = term.getSize()
- for i,v in pairs(colors) do
- if tonumber(v) then
- loadstring(i .. "=" .. v)()
- end
- end
- function uWords(string, x, y, txtcol, bakcol)
- string = string or ""
- txtcol = txtcol or colors.white
- bakcol = bakcol or colors.black
- if not tonumber(x) then
- x = x:gsub(" ", "")
- if x:sub(1, 1) == "l" then
- if x:find("+") then
- offset = tonumber(x:sub(x:find("+") + 1))
- term.setCursorPos(1 + offset, y)
- else
- term.setCursorPos(1, y)
- end
- elseif x:sub(1, 1) == "c" then
- if x:find("+") then
- offset = tonumber(x:sub(x:find("+") + 1))
- term.setCursorPos(w/2 - #string/2 + 1 + offset, y)
- elseif x:find("-") then
- offset = tonumber(x:sub(x:find("-") + 1))
- term.setCursorPos(w/2 - #string/2 + 1 - offset, y)
- else
- term.setCursorPos(w/2 - #string/2 + 1, y)
- end
- elseif x:sub(1, 1) == "r" then
- if x:find("-") then
- offset = tonumber(x:sub(x:find("-") + 1))
- term.setCursorPos(w - #string + 1 - offset, y)
- else
- term.setCursorPos(w - #string + 1, y)
- end
- end
- else
- term.setCursorPos(x, y)
- end
- term.setBackgroundColor(bakcol)
- term.setTextColor(txtcol)
- term.write(string)
- end
- local function draw(string, xPos, yPos, txtcol, bakcol)
- local string = string or ""
- local txtcol = txtcol or colors.white
- local bakcol = bakcol or colors.black
- term.setCursorPos(xPos, yPos)
- term.setBackgroundColor(bakcol)
- term.setTextColor(txtcol)
- term.write(string)
- end
- function colorScreen(color)
- local color = color or colors.black
- term.setBackgroundColor(color)
- term.clear()
- end
- function colorLine(line, color)
- local color = color or colors.black
- if line then term.setCursorPos(1, line) end
- term.setBackgroundColor(color)
- term.clearLine()
- end
- local oTemp = fs.open("console", "w")
- function log(string)
- oTemp.writeLine(string)
- oTemp.flush()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement