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

[LUA] term.setCursorPos() problems

Started by Gutawer, 16 December 2012 - 12:25 AM
Gutawer #1
Posted 16 December 2012 - 01:25 AM
Hey guys. So I'm making a program called DiaryOS which is a diary for your computer. Everything is working except 1 thing. I am trying to make it so that every time a new line of text is typed, the monitor will move the cursor down one line. But however, I cannot seem to do this. Could anyone give me a line of code that will always move the cursor one down wherever the cursor is?

Thanks if you can help.
Boss Nomad #2
Posted 16 December 2012 - 01:39 AM
term.setCursorPos(1,1)

1,1 is for example. They are coordinates for cursor position.
theoriginalbit #3
Posted 16 December 2012 - 02:10 AM
something like this should do the job :)/>

currX, currY = term.getCursorPos()
term.setCursorPos(1, currY + 1)
Gutawer #4
Posted 16 December 2012 - 04:48 AM
Thanks a lot. It really helps.
theoriginalbit #5
Posted 16 December 2012 - 04:52 AM
no probs :)/>