How to prevent newline in console? - Script Writing - CHDK Forum

How to prevent newline in console?

  • 4 Replies
  • 4125 Views
How to prevent newline in console?
« on: 16 / February / 2008, 14:26:17 »
Advertisements
I'm trying to print a countdown in the console without having each digit in the countdown go to the new line. In other words, I want it to say something like 3-2-1 with each new number overwriting the last.

Is this possible?

In some consoles it's \r followed by a comma for example.

Anything like that here?

Thanks for any help.


*

Offline jetzt

  • ****
  • 316
  • [A710IS,(SD200)]
Re: How to prevent newline in console?
« Reply #1 on: 16 / February / 2008, 14:48:41 »
Why don't you clear console each time a new digit is printed?
You have to print everything else, too, that's clear, but it's a workaround.

Re: How to prevent newline in console?
« Reply #2 on: 16 / February / 2008, 14:58:34 »
Good point, I could do that, but there's info I'd like to keep on the screen if possible.

Definitely no big deal, as you say I can redraw the whole console easily enough.
« Last Edit: 16 / February / 2008, 15:03:35 by wrybread »

Re: How to prevent newline in console?
« Reply #3 on: 16 / February / 2008, 15:15:40 »
After some more experimentation I found a small problem with using CLS to clear the whole console and then reprint everything: cls makes the title and stats (if showing) blink...

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: How to prevent newline in console?
« Reply #4 on: 17 / February / 2008, 04:26:12 »
The current implementation of 'print' command does not support any special (escaped) characters and always outputs a new line.
CHDK Developer.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal