Jump to content




[OS][Clock issue?]Cursor moving from desired point


  • You cannot reply to this topic
2 replies to this topic

#1 Kryptanyte

  • Members
  • 95 posts
  • LocationNew Zealand

Posted 11 February 2013 - 10:05 PM

Okay, so I have been developing a basic control system for a facility with a lock etc. I have been having a sort of bug with the login part however, when you are on the login screen, the cursor will move from the area it is supposed to be, to a point on the right margin a few lines above the text, it seems to just be a display bug as when you continue typing it will resume its current position. I think is has something to do with the 'timeDisplay()' function that is displaying the time. Now the code is a bit messy and it might be a little random, I know I have random ass things where not needed but its basically a BETA version. Anyway, any help would be appreciated, thanks!

PS. Theres two login users for debugging; login:pass and test:testing

Spoiler


#2 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 11 February 2013 - 10:30 PM

Try adding x,y = term.getCursorPos() before printing then set it to that after printin

function timeDisplay()
while true do
if running == false then
xMax, yMax = term.getSize()
local getTime = os.time()
printTime = textutils.formatTime(getTime, false)
Local x, y = term.getCursorPos()
term.setCursorPos(xMax - 1 - #printTime, 2)
term.write(printTime)
term.setCursorPos(x,y)
sleep(3)
else

end
end
end


#3 Kryptanyte

  • Members
  • 95 posts
  • LocationNew Zealand

Posted 11 February 2013 - 10:59 PM

Ahh, thank you. I didn't spot that error. Must have put that in when I was messing with it before I made the ugly GUI xD

Okay quick edit, for anyone who is using the time function on this code, after the 'else' statement, make sure you put a sleep(number) there, otherwise the while loop doesn't know what to and will run to long without yeilding.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users