This OSL Shader is available in Wall Worm/Wall Worm Pro v3.74+ for 3ds Max 2019. It creates a mask based on an input texture and the vertex color of the target map channel. It mimmicks the affect of the blendmodulatetexture parameter in Source Engine's WorldVertexTransition shader.
The seamless_scale code was largely derived from Yann at Isotropix.
Note that because OSL does not yet currently support Channel -2 (Vertex Alpha) it means you cannot use the current vertex alpha channel (used by the DX Shader) but must copy it from -2 to the channel you wish to use in the map.