Custom Sampler Example Code:

#if %FUZZY_SURFACE && !%BLENDLAYER || !%DIRTLAYER
Texture2D fuzzyTex : register(t9) //Reusing Texture register from Blendlyr and Dirtlyr
<
  UIName = "Fuzzy Mask Map";
  UIDescription = "Fuzzy mask map for fuzzy surface feature";
> = TM_Custom;
#else
    #undefine %FUZZY_SURFACE
 
#endif

Lets break down this sampler code:
-

"#if %FUZZY_SURFACE && !%BLENDLAYER || !%DIRTLAYER"

This is a Preprocessor argument, it tells the compiler when/when not to compile this code into the shader/interface. Preprocessor arguments are special notations that only the compiler sees. This example translates to:
IF "FUZZY SURFACE" feature is enabled, and NOT "BLENDLAYER" OR "DIRTLAYER", compile this code.
-
Texture2D fuzzyTex : register(t9)

-
If you want more information on preprocessor arguments go HERE.

-
This is defining the type of the texture variable, then assigning the texture inside of the register(t9), to the variable "fuzzyTex". The registers are the "Slots" In the sandbox material editor, and yes, they are in order from top to bottom. For example, diffusemap is (t1), bumpmap is (t2). Note however that not all registers are showing at once, some are only shown when triggered by a #Pragma. Currently there can only be 13 texture registers(hardcoded).
-
Please note that your "register()" number needs to match your custom slots register number (the one found in the FXSamplerDefs.cfi file.
-

<
  UIName = "Fuzzy Mask Map";
  UIDescription = "Fuzzy mask map for fuzzy surface feature";
> = TM_Custom;

-
This is the code that sandbox reads to populate the material editor interface with the correct visual objects. "UIName" is the name that will show on the texture slot inside of the material editor, "UIDescription" is the help text that shows up on the bottom of the material editor, which tells you what it is used for.
-
> = TM_Custom

This is important, it tells the sandbox code the name of the shared sampler as defined (in this case) on line 16 of the FXSamplerDefs.cfi.
#else
    #undefine %FUZZY_SURFACE
 
#endif

This code tells the compiler that if the logic set forth in this sampler code is not met in any way, to undefine the FUZZY_SURFACE shader effect. This helps to ensure that it does not interfere with other code in unpredictable ways.