keeping slider in position

Hello all
I’d like a joystick controler to keep its position, and not going back to its initial position. All i managed to do is creating stack overfows. Sounds like a noob question but i’m sure you guys know how to resolve it.
cheers
ka

Hi kala
the simplest method would be to store the number in [int] and use a [bang] from [change +] to trigger it; or use [change +], [change -] and a [gate]; these objects output a 1 or -1 when the value is either rising or falling, allowing one to open and close the gate:

– Pasted Max Patch, click to expand. –

Copy all of the following text. Then, in Max, select New From Clipboard.

There are individual objects which perform a similar task, such as [peak], [past] and [maximum], but I find it tricky to operate on realtime number stream input in this way; I guess they are designed to handle lists, but look at the helpfiles for these guys too.

I looked again at this and found that the reason for the unreliability of the [gate] method is due to the control flow ordering of Max: from right to left, so one descending number will ‘sneak’ through the gate before it is closed; the solution is to insert a [pipe 1] object before the [gate]‘s RIGHT inlet.