Page 1 of 1
How to set cursor position in MM console window
Posted: Sun Nov 16, 2014 5:36 am
by d003232
I thougt to remember that in RoM bot in the console was a output that just modified the last printed line without scrolling. I want that to do too. I want to update the last output line in the console window. How can I do that. I have tried to experiment with the cli.getAttributes() but without success.
Any other way to set back the cursor for one line? Or to reprint the whole content of the console window and modify the last line?
Re: How to set cursor position in MM console window
Posted: Sun Nov 16, 2014 8:19 am
by rock5
You can't go beck a line but you can go to the beginning of the current line using \r, eg.
Code: Select all
for i = 1, 10 do
print("\r"..i)
yrest(1000)
end
Re: How to set cursor position in MM console window
Posted: Sun Nov 16, 2014 8:24 am
by d003232
rock5 wrote:You can't go beck a line but you can go to the beginning of the current line using \r, eg.
Code: Select all
for i = 1, 10 do
print("\r"..i)
yrest(1000)
end
You are my king! Where do you find that special codes? Is it lua knowledge?
Re: How to set cursor position in MM console window
Posted: Sun Nov 16, 2014 9:43 am
by rock5
Escape characters such as \r, \n, \t etc. can be used in many languages, so no, it's not an lua thing.
Re: How to set cursor position in MM console window
Posted: Sun Nov 16, 2014 11:53 am
by Administrator
If you are using Ncurses mode, you can use ncurses.move() to move the (virtual) cursor within a 'window' to change the position of output. Just set it wherever you need and overwrite the line with a new ncurses.print().