Hi, Brad.
The problem is depth-first message passing. And, in PD, if one outlet connects to two things, the messages are sent in the order the connections were made... which you can't tell by looking.
If you insert a [print] object after your [+ 1] object, you will see that it always outputs 0 before outputting another number. This is because it first sends its output to the [route], which follows its chain of messages through all the way to the [-1( message, BEFORE sending the same output to the [float] object. So after 4, it outputs 0 and 5, then 0 and 6, etc. It sends its result twice, and the second one replaces the -1 message to the float. Solving it would be as simple as deleting the connection to the [route] object and reconnecting it, so that that message is sent last.
Also, I don't know if it matters, but the loadbang means that a 0 is sent on opening. You could just make the float object -1 instead of 0, and delete the loadbang, unless you want an initial 0 output on opening.
-Chuckk
Date: Sat, 5 Nov 2005 20:36:20 +0100
From: Brad Kligerman <bkligerman@gmail.com
>
Subject: [PD] Building a counter problem
To: pd-list@iem.at
Message-ID:
<9afc437d0511051136x2bdf06bi50fe74584f14651d@mail.gmail.com
>
Content-Type: text/plain; charset="iso-8859-1"
Skipped content of type multipart/alternative-------------- next part --------------
A non-text attachment was scrubbed...
Name: counter-1.pd
Type: application/octet-stream
Size: 1186 bytes
Desc: not available
Url : http://lists.puredata.info/pipermail/pd-list/attachments/20051105/adc49dff/counter-1-0001.obj