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

Problem with function

Started by AlkamlBan, 16 May 2014 - 02:24 PM
AlkamlBan #1
Posted 16 May 2014 - 04:24 PM
Hello, I have been recently trying to create an OS. In this OS I want the background to be in a function in order to call it whenever I want, but when I do this it never gives me the desired result. Here is the code:

local icon1 = paintutils.loadImage("Back1")
function Background()

term.setBackgroundColor(colors.lightGray)
term.clear()
paintutils.drawImage(icon1, 1, 1)
term.setCursorPos(1, 20)
term.setBackgroundColor(colours.lime)
term.setTextColor(colours.cyan)
print("Begin")
term.setBackgroundColor(colours.gray)
term.clearLine()

end

Background()

The problem is that when I do this it gets the background right but at the bottom where I want the bar with the begin to be it prints nothing + makes it completely lime + crashes the computer(in minecraft not mine ;)/> )

If you could help I would really apreciate it.
MKlegoman357 #2
Posted 16 May 2014 - 05:53 PM
What: Computer, Turtle or PDA, are you using? Computer's screen height is 19 so…

To get the width and height of the screen you should use term.getSize.
Edited on 16 May 2014 - 03:57 PM