There's a lot of stuff passed into functions such as where, ppos, sel_ppos, mx, my, etc. Are these global variables that are always available to every function?
I used the mx and my variables without really understanding where they came from to detect the current mouse position, and it "just worked"

The more I tinker in DSB, the less I realise I understand...