This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
gametechish's profile picture

The Text in my program is made out of blocks

Started by gametechish, 27 June 2014 - 07:08 AM
gametechish #1
Posted 27 June 2014 - 09:08 AM
Ok all of the text in my startup file if entirely made out of blocks
here is a screenshot(It is supposed to say "Welcome To SYS-OS""[User]")

and here is the code

term.clear()
term.setCursorPos(1,1)
if term.isColor() == true then
  term.setTextColor(colors.lime)
  print("COMPUTER IS ADVANCED   [ OK ]")
else
  print("ERROR: NOT ADVANCED COMPUTER	[ ERROR ]")
  print("Please reinstall on advanced computer!")
  print("Shutting Down...")
  sleep(3)
  os.shutdown()
end
if os.loadAPI("APIS/boot") == true then
  term.setTextColor(colors.lime)
  print("Boot API loaded successfully	[ OK ]")
  sleep(.25)
else
  term.setTextColor(colors.red)
  print("ERROR: COULD NOT LOAD BOOT API  [ ERROR ]")
  sleep(1)
  os.reboot()
end
if os.loadAPI("APIS/text") == true then
  term.setTextColor(colors.lime)
  print("Text API loaded successfully	[ OK ]")
  sleep(.25)
else
  term.setTextColor(colors.red)
  print("ERROR: COULD NOT LOAD TEXT API  [ ERROR ]")
  sleep(1)
  os.reboot()
end
if os.loadAPI("APIS/gameutils") == true then
  term.setTextColor(colors.lime)
  print("GameUtils API loaded successfully   [ OK ]")
  sleep(1)
else
  term.setTextColor(colors.red)
  print("ERROR: COULD NOT LOAD GAMEUTILS API	[ ERROR ]")
  sleep(1)
  os.reboot()
end
if os.loadAPI("APIS/sha") == true then
  term.setTextColor(colors.lime)
  print("SHA API loaded successfully   [ OK ]")
  sleep(1)
else
  term.setTextColor(colors.red)
  print("ERROR: COULD NOT LOAD SHA API	[ ERROR ]")
  sleep(1)
  os.reboot()
end
if os.loadAPI("APIS/login") == true then
  term.setTextColor(colors.lime)
  print("Login API loaded successfully   [ OK ]")
  sleep(1)
else
  term.setTextColor(colors.red)
  print("ERROR: COULD NOT LOAD LOGIN API	[ ERROR ]")
  sleep(1)
  os.reboot()
end
if os.loadAPI("APIS/ccconfig") == true then
  term.setTextColor(colors.lime)
  print("CC-Config API loaded successfully	[ OK ]")
  sleep(.25)
else
  term.setTextColor(colors.red)
  print("ERROR: COULD NOT LOAD CC-CONFIG API  [ ERROR ]")
  sleep(1)
  os.reboot()
end
if os.loadAPI("APIS/screensaver") == true then
  term.setTextColor(colors.lime)
  print("Screensaver API loaded successfully	[ OK ]")
  sleep(.25)
else
  term.setTextColor(colors.red)
  print("ERROR: COULD NOT LOAD SCREENSAVER API  [ ERROR ]")
  sleep(1)
  os.reboot()
end
term.clear()
boot.bootImg()
boot.bootText()
sleep(2)
function login()
  text.clearBlue()
  lbground=paintutils.loadImage("img/login.nfp")
  paintutils.drawImage(lbground, 1, 1)
  term.setCursorPos(2,2)
  print("Welcome To SYS-OS")
  term.setCursorPos(2,3)
  print("[User]")
  local username=read()
if fs.exists("Home/"..username.."/"..username..".acc") then
  local u=fs.open("Home/"..username.."/"..username..".acc","r")
  local privelege=u.readLine()
  local pass=u.readLine()
  u.close()
  term.setCursorPos(2,5)
  print("[Password]")
  local password=read("*")
  local pass2=sha.sha256(password)
  if pass==pass2 then
	if privelege=="true" then
	  root=true
	else
	  root=false
	end
  user=username
  shell.run("system/main.sys")
	else term.setBackgroundColor(colors.red)
	  term.clear()
	  term.setCursorPos(1,1)
	  text.centerPrint("WRONG PASSWORD")
	  sleep(5)
	  os.reboot()
	end
	else term.setBackgroundColor(colors.red)
	  term.clear()
	  term.setCursorPos(1,1)
	  text.centerPrint("WRONG USERNAME")
	  sleep(5)
	  os.reboot()
	end
  end

  local ok, err=pcall(login)
  if not ok then
	
	  text.clearBlue()
	  term.setBackgroundColor(colors.lime)
	  term.clear()
	  term.setCursorPos(1,1)
	  text.centerPrint("SYS-OS has crashed!")
	  text.centerPrint("SYS-OS has crashed and was forced to shutdown.")
	  text.centerPrint("")
	  text.centerPrint("If you haven't edited any system")
	  text.centerPrint("files then please contact Glass Systems or")
	  text.centerPrint("Black Whole Software on the ComputerCraft forums")
	  text.centerPrint("")
	  text.centerPrint("If you have edited system files")
	  text.centerPrint("then reinstall SYS-OS, or ask the forums")
	  text.centerPrint("")
	  text.centerPrint("[ERROR]")
	  text.centerPrint("?"..err)
	  text.centerPrint("")
	  text.centerPrint("")
	  text.centerPrint("Press any key to continue...")
	while true do
	local sEvent=os.pullEvent()
	if sEvent=="key" then
	  os.reboot()
	end
  end
end
i did not steal the code from Glass UI or Glass OS I am working with glass Systems on SYS-OS if you need anything ask me
Edited on 27 June 2014 - 07:10 AM
Bomb Bloke #2
Posted 27 June 2014 - 09:24 AM
You login function goes like this:

function login()
  text.clearBlue()
  lbground=paintutils.loadImage("img/login.nfp")
  paintutils.drawImage(lbground, 1, 1)
  term.setCursorPos(2,2)
  print("Welcome To SYS-OS")
  .
  .
  .

It looks like when it goes to print, your text background colour has been set as equal to the foreground colour (by your call to paintutils.drawImage()).

Try expanding it out to something like this:

function login()
  text.clearBlue()
  lbground=paintutils.loadImage("img/login.nfp")
  paintutils.drawImage(lbground, 1, 1)
  term.setCursorPos(2,2)
  term.setBackgroundColour(colours.lime)
  print("Welcome To SYS-OS")
  .
  .
  .
Edited on 28 June 2014 - 12:08 AM
gametechish #3
Posted 27 June 2014 - 09:40 AM
I dont exactly know what you mean
theoriginalbit #4
Posted 27 June 2014 - 09:50 AM
the last colour the terminal was set to was the blue from the "OS" in the image. because of this it means that your text you write directly after drawing the image will have the blue background. as such you need to set the background to colors.lime before printing your text (as Bomb Bloke showed).
gametechish #5
Posted 27 June 2014 - 08:08 PM
thank you it works now but where did it change the background to blue
Bomb Bloke #6
Posted 28 June 2014 - 02:07 AM
When you called paintutils.drawImage().

That function works by printing lots of spaces, each with a different background colour set.