Scripted graphs can be used to simulate other types of material nodes. The following script simulates a metal using its complex index of refraction.
First a note about the index of refraction. The index input on a specular material is a real value, which can be used to simulate dielectric materials. For instance common glass has an IOR around 1.45 and water has 1.33.
For metals you may also find an IOR, for instance you may find Gold has an IOR of 0.47. This number alone is useless, as metals have a complex index of refraction. You should get two values, called N and K. These are the real and imaginary parts of the IOR. For gold these values are around 0.47 and 2.25.
Also for some metals, like gold, the IOR is dependent on the wavelength. The script assumes the given IOR is for green light (around 550 nm).
Using the script:
The scripted node has two inputs determining the glossy reflectance:
The color can be used to give the metal some color. The brightness of the color will be changed according to the IOR. Most metals will be gray, so you can leave the color input white. Only RGB colors and greyscale colors are supported.
The index of refraction are the n and k values you find for the metal.
The rest of the inputs are the same as the inputs on glossy materials.