Function Merlin()
break On
; If InGroup("Testgroup")
$merlin_path = "%windir%\msagent\chars\merlin.acs"
$agent = createobject ("agent.control.2")
$agent.connected = "1"
$= $agent.characters.load("merlin","$merlin_path")
$merlin = $agent.characters.character("merlin")
$= $merlin.moveto(400,200)
$= $merlin.show()
$wait = $merlin.play("announce" )
do sleep 1 until $merlin.wait($wait) <> 0
$wait = $merlin.speak("Hello! You are part of a test group using the new login scripts." )
$wait = $merlin.speak("If I had anything important to say, I would have told you here." )
do sleep 3 until $merlin.wait($wait) <> 0

; Endif
EndFunction

This code works fine as stand-alone and without Function Merlin() and Endfunction.