%o is the number that increases, which means it will be either 1,2,3 etc depending on which run it is. $(X,2) will evaluate the content 2 times. $+(X,X) appends X to X so it looks like XX
So in overall, $($+($,%o),2) will append a $ to a number, to make it either $1,$2,$3 and evaluate this number into mSL code.