The following script command will modify MAX delay samples value only if new value is lower than existing one:
res = ss.ObjectSetProperties("setControlValue", delay_1_name, 0, 0, "DelaySamples`max", 20 );
Tried in SS 3.12 and 3.13beta build1.
OS is Windows XP
Sample project with script and error message picture are attached