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

.temp:3: attempt to call nil

Started by FoxtrotJeff, 29 April 2017 - 08:04 PM
FoxtrotJeff #1
Posted 29 April 2017 - 10:04 PM
I am very confused on how the code is incorrect, I am new to ComputerCraft, currently using version ComputerCraft1.74.
Here is the code used:

monitor = peripheral.wrap("top")

monitor.setTextScale(2)
monitor.setBackgroundColor(colors.white)
monitor.clear()

monitor.setCursorPos(11,1)
monitor.setTextColor(colors.purple)
monitor.write("Welcome!")
Bomb Bloke #2
Posted 30 April 2017 - 04:30 AM
Assuming your third line is:

monitor.setTextScale(2)

… then the error is telling you that you were successfully able to wrap a peripheral located above your computer, but it's not a monitor and hence doesn't have a "setTextScale" function to offer you.

For example, you might've placed a wired modem above your computer, which leads to a monitor. In that case, you'd be wrapping the modem instead of the display - "activating" the other modem attached to the monitor itself (by right clicking it) will give you its "network name", and you should be wrapping that instead of "top".
FoxtrotJeff #3
Posted 30 April 2017 - 05:05 PM
Thank you, I didn't know you had to use the network name of the monitor.