Hi Merry
Just re-write your function a bit, like this
define function <RandomObjectName>
set string <RetVal;ERROR>
if ( $numberparameters$ > 0 ) then {
set numeric <counter; 0>
repeat until ( %counter% = 1 ) {
set numeric <num; $rand(1; 1000)$>
if exists <$parameter(1)$%num%> then set numeric <counter; 0> else set numeric <counter; 1>
}
set <RetVal;$parameter(1)$%num%>
}
return <#RetVal#>
end define
I've tried this and it works...
Be aware, your cloned item will have the original object's name as an alias - so you might want to change that - and also, although the function returns 'error' this is never used because Quest's inbuilt 'can't clone a non-existing item' will kick in.
Al