You can daisy chain multiple raytype nodes together, each with a different Ray option, by connecting them to input
So, basically you can just ctrl-drag that OSLTexture node, connect it in the input
of the first one and change the Ray to Refraction. That will now hide that material in both refractions and reflections.
As for learning OSL, I started by deconstructing the existing scripts and changing some parameters and replacing some values with sliders just to see what happens when I change something. I'm not a programmer at all. So I would highly recommend checking out the presets first and experiment!. When it comes to raytype even almost a year later I'm still finding completely new ways to use it. OSL is really just 95% creativity and 5% coding.
For a good basic introduction, even if you skip all of the boring coding/math parts, here's a few links that really helped me:
If I could go back in time I would give myself this pdf from an old Renderman repository website:https://github.com/tlanc007/RenderMan_Repository/blob/master/RMR/Publications/sig92.course21.pdf
OSL is a descendant of RSL (most of the code actually works without changes) so I would leave GLSL and Shadertoy for later. This is from '92 but most of the concepts from there are in almost every single shader on shadertoy. It's really fundamental stuff. That entire repository is pure gold.
Also these videos from Zap are a great introduction, especially Lesson-3:https://www.dropbox.com/s/mzzuu96rsr1uleg/LESSON-3.mp4?dl=0&fbclid=IwAR2D-r7WPj8OHSaQi_rWXVO4w5BZ_wOksLEDfLJwpGlcYxSWbD14EkwhYQAhttps://www.youtube.com/watch?v=1e13oLqwy6U&list=PLPKbqsL4CjmTcodA2TY0rMXqc2Q21KSVr&index=7&t=0s