IMHO, the argument $ClientColor should not be (re)Dim(med)
Put Setoption Explicit on top and it will complain
Code:

$SO = SetOption("Explicit","On")


And I do not understand the error message as the $ClientColor parameter is not optional. I get:
Code:

ERROR : invalid method/function call: missing required parameter 1!
Script: D:\Scripts\test\test.kix
Line : 10