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

Some variables go in the right place and others dont, using the same code

Started by SuperUnitato, 14 March 2016 - 01:17 AM
SuperUnitato #1
Posted 14 March 2016 - 02:17 AM
Ok so this is complicated to explain so I would just run it ingame. Unless you can see the problem right away. When I run the program, it works fine the first time. The when I run it again, instead of starting on another line it replaces all the varibles printed out with the new ones the user entered, except for the X value and they all use the same code, just in different functions. Im sure it's something small but I can't figure it out, just need fresh eyes on it.

http://pastebin.com/rNK4pGrz
Bomb Bloke #2
Posted 14 March 2016 - 04:38 AM
Line 12 is moving the monitor's cursor back up to the top line.
ry00000 #3
Posted 14 March 2016 - 01:44 PM
Line 12 is moving the monitor's cursor back up to the top line.
Delete a line? That's it?
Dog #4
Posted 14 March 2016 - 02:50 PM
Where did you get the impression that BB said to delete a line? The line should be fixed, not deleted.
Dragon53535 #5
Posted 14 March 2016 - 03:01 PM
Your issue is line 12 as he said, setCursorPos arguments goes for x then y, you're setting at y then x


monitor.setCursorPos(y+2,1) --# This is wrong
monitor.setCursorPos(1,y+2) --# This is right.

Oh, and capitalization matters, so 'monitor' and 'Monitor' are two different variables.
Edited on 14 March 2016 - 02:02 PM
SuperUnitato #6
Posted 14 March 2016 - 05:19 PM
Your issue is line 12 as he said, setCursorPos arguments goes for x then y, you're setting at y then x


monitor.setCursorPos(y+2,1) --# This is wrong
monitor.setCursorPos(1,y+2) --# This is right.

Oh, and capitalization matters, so 'monitor' and 'Monitor' are two different variables.

I wasnt trying to start a new line with that function, only move it to the side. I did figure it out though,

monitor.setCursorPos(y+2,_)
worked the way i wanted
Dragon53535 #7
Posted 14 March 2016 - 07:33 PM
Yeah ,that would do it. My fault for not reading the getCursorPos call earlier had x set as variable y. That's what confused me there with your intentions for that line.
Edited on 14 March 2016 - 06:34 PM