Control fader via midi with soft takeover

I want to control a fader inside open stage control with my midi controller. This works nicely following the costum module example here: Examples - Open Stage Control

However, i am trying to create a "soft takeover" mode, so the fader will only be affected by the incoming midi value when it is already close to the faders current value. For this to work i need to access the current value of the fader inside the costum module, but i can't figure out if there is a way to do this. Any suggestions?

You need to catch the fader's outgoing messages (in the oscOutFilter function) and store its value in a variable in the custom module, and then compare this variable to the incoming midi value and decide what to do with the result.