How to set cursor position in MM console window

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

How to set cursor position in MM console window

#1 Post by d003232 » Sun Nov 16, 2014 5:36 am

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?
The RoM Bot Online Wiki needs your help!

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: How to set cursor position in MM console window

#2 Post by rock5 » Sun Nov 16, 2014 8:19 am

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
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: How to set cursor position in MM console window

#3 Post by d003232 » Sun Nov 16, 2014 8:24 am

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?
The RoM Bot Online Wiki needs your help!

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: How to set cursor position in MM console window

#4 Post by rock5 » Sun Nov 16, 2014 9:43 am

Escape characters such as \r, \n, \t etc. can be used in many languages, so no, it's not an lua thing.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: How to set cursor position in MM console window

#5 Post by Administrator » Sun Nov 16, 2014 11:53 am

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().

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests