Help implementing Script node for material
The related post you mentioned is not in Python but in OSL. In order to enable OSL you must set your render device in CPU mode and enable the Open Shading Language Option. I tried the code and it was working quite good (except the last part which crashed my machine).