Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Counter with range



I tried this, but the result reverts to 0 as soon as the increase signal is set to false. I guess I must "hold" the _count variable somehow? Thanks for your help.

Increasing = inputs[0];
Decreasing = inputs[1];
Reset = inputs[2];
Min = inputs[3];
Max = inputs[4];

 
var _count = 0;
if (Increasing) _count==Max?_count:_count++;
if (Decreasing) _count==Min?_count:_count--;
if (Reset) _count = 0;
    
outputs[0] = _count; 

 

On 7/6/07, Alessandro Sabatelli <email@hidden> wrote:
Hey F.  You'll need to store an internal variable for the count.  Here is some "pseudocode" to get you started...

var _count = 0;
function (__number Count) main (__boolean Increasing, __boolean Decreasing, __boolean Reset, __number Min, __number Max) {
    var result = new Object();
   
    if (Increasing) _count==Max?_count:_count++;
    if (Decreasing) _count==Min?_count:_count--;
   
    result.Count = _count;   
    return result;
}

.xX


email@hidden wrote:
Hi list,

is there a patch that works like the Counter but with a minimum/maximum value? I know I could simply connect the counter to a Range patch or a restricted Input Splitter, but given that the maximum count is 5 and the counter has received 100 increase signals, I don't want to have to send it 95 decrease signals to get to the point where the count starts decreasing again. I figure this is feasible with a _javascript_ patch, but I'm afraid I don't have any _javascript_ing skills. The patch also needs a reset signal input (just like the standard counter). 

Your help is much appreciated.
F.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (email@hidden .com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman /options/quartzcomposer-dev/email@hidden This email sent to email@hidden


 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden

References: 
 >Counter with range (From: email@hidden)
 >Re: Counter with range (From: Alessandro Sabatelli <email@hidden>)
 >Re: Counter with range (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.