At the moment i have made it work to the point i wanted to add a text color inversion system (it would invert the text color to a set inverse of the bar color)
I did this using a table and term.setTextColor, when i went to execute the program it flashed Window:48 (or Window:88, couldn't tell as it flashed on for only a second), then proceeded to shut down and reboot and give me "Window:150 bad argument, string expected, got nil" and prompted to press any key to continue (which i did) however this just caused the terminal to reboot and prompt the same message. The only lines changed from the last working rendition of the code are [1-18 & 51].
Code:
local inverse = {
["white"] = colors.black,
["orange"] = colors.red,
["magenta"] = colors.cyan,
["lightBlue"] = colors.black,
["yellow"] = colors.blue,
["lime"] = colors.black,
["pink"] = colors.yellow,
["gray"] = colors.white,
["lightGray"] = colors.black,
["cyan"] = colors.black,
["purple"] = colors.black,
["blue"] = colors.yellow,
["brown"] = colors.white,
["green"] = colors.black,
["red"] = colors.black,
["black"] = colors.white
}
local function Cl()
term.clear()
term.setCursorPos(1, 1)
end
local function Cp(text)
local x2,y2 = term.getCursorPos()
local x,y = term.getSize()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
local function Pr(x, y, z, w)
Cl()
startx = 4
endx = 48
ypos = 7
boxcolor = y
barcolor = x
stime = z
bckcolor = w
term.setBackgroundColor(colors[bckcolor])
paintutils.drawBox( 1, 1, 51, 19, colors[boxcolor])
for i=startx, endx do
paintutils.drawPixel(i, ypos, colors[barcolor])
sleep(stime)
end
end
term.setTextColor( inverse[barcolor] )
Pr("blue", "lime", .2, "grey")
Cp("Done!")
sleep(2)