I'm don't think that exactly what @Sylvain asked for. This is something that can be handled with the script property:
// if the knob was moved before
// (we need something to compare)
if (locals.previousValue !== undefined) {
// compare old value to current value
if (locals.previousValue > value) {
send('/control', 1, 50, 127) // channel 1, cc 51, val 127
} else if (locals.previousValue < value) {
send('/control', 1, 51, 127)
}
}
// update old value
locals.previousValue = value
Doing this with an encoder instead of a knob would be more straightforward:
if (value == -1) {
send('/control', 1, 50, 127) // channel 1, cc 51, val 127
} else if (value == 1) {
send('/control', 1, 51, 127)
}