Hey All
I'm working on a game on PD. Part of which is a timer set out minutes:seconds. However, when the seconds variable is below 10 it's displaying as a single digit. So most of the time this looks right (e.g. 2:56), but at the start of each minute it looks a little unusual (0:1). I'm displaying this using [text3d].
Any ideas how I can fix this?
Andrew
_________________________________________________________________
http://clk.atdmt.com/UKM/go/195013117/direct/01/
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
Hi Andrew,
On Mon, Apr 05, 2010 at 02:53:24PM +0100, Andrew Faraday wrote:
I'm working on a game on PD. Part of which is a timer set out minutes:seconds. However, when the seconds variable is below 10 it's displaying as a single digit. So most of the time this looks right (e.g. 2:56), but at the start of each minute it looks a little unusual (0:1). I'm displaying this using [text3d]. Any ideas how I can fix this?
[makefilename %02d] or [makefilename %.2d] pads your number with zeros so it has two digits.
Frank Barknecht Do You RjDj.me? _ ______footils.org__
cheers, this solved my problem
Date: Mon, 5 Apr 2010 16:51:46 +0200 From: fbar@footils.org To: pd-list@iem.at Subject: Re: [PD] Displaying as two digits
Hi Andrew,
On Mon, Apr 05, 2010 at 02:53:24PM +0100, Andrew Faraday wrote:
I'm working on a game on PD. Part of which is a timer set out minutes:seconds. However, when the seconds variable is below 10 it's displaying as a single digit. So most of the time this looks right (e.g. 2:56), but at the start of each minute it looks a little unusual (0:1). I'm displaying this using [text3d]. Any ideas how I can fix this?
[makefilename %02d] or [makefilename %.2d] pads your number with zeros so it has two digits.
Ciao
Frank Barknecht Do You RjDj.me? _ ______footils.org__
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
http://clk.atdmt.com/UKM/go/195013117/direct/01/ We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
--- On Mon, 4/5/10, Frank Barknecht fbar@footils.org wrote:
From: Frank Barknecht fbar@footils.org Subject: Re: [PD] Displaying as two digits To: pd-list@iem.at Date: Monday, April 5, 2010, 4:51 PM Hi Andrew,
On Mon, Apr 05, 2010 at 02:53:24PM +0100, Andrew Faraday wrote:
I'm working on a game on PD. Part of which is a timer
set out
minutes:seconds. However, when the seconds variable is
below 10 it's
displaying as a single digit. So most of the time this
looks right (e.g.
2:56), but at the start of each minute it looks a
little unusual (0:1). I'm
displaying this using [text3d]. Any ideas how I
can fix this?
[makefilename %02d] or [makefilename %.2d] pads your number with zeros so it has two digits.
Hi Frank, Nice solution. Is this behavior documented anywhere?
-Jonathan
Hi,
On Mon, Apr 05, 2010 at 10:23:08AM -0700, Jonathan Wilkes wrote:
[makefilename %02d] or [makefilename %.2d]
Nice solution. Is this behavior documented anywhere?
makefilename supports the format specifiers of the printf function in C. A nicely written overview of this lot is in http://en.wikipedia.org/wiki/Printf#printf_format_placeholders Internally Pd uses the "g" type a lot to format numbers.
Frank
Frank Barknecht wrote:
Internally Pd uses the "g" type a lot to format numbers.
..which is why Pd's floats often have less precision than float: A full-precision float is printed with the 'g' specifier when a patch is saved, then read back in with the reduced precision, so something like 1234567 will end up as 1.23e+6, or 1230000, the next time the patch is opened. Martin
On Wed, 2010-04-07 at 08:59 -0400, Martin Peach wrote:
Frank Barknecht wrote:
Internally Pd uses the "g" type a lot to format numbers.
..which is why Pd's floats often have less precision than float: A full-precision float is printed with the 'g' specifier when a patch is saved, then read back in with the reduced precision, so something like 1234567 will end up as 1.23e+6, or 1230000, the next time the patch is opened.
Now you made it worse than it really is. Actually, it will end up as: 1.23457e+06 or 1234570. It's true though, the reformatting truncates significant digits. Actually, the only way I can think of to store 32bit-float numbers with full precision in Pd is to write to 32-bit-float soundfiles.
Roman
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de