The logical error would be that the script assumes a Bayonet type for unscrewing \:\)

Logical version for a score of 755
 Code:
; ChangeLamp.kix
;	Automated lightbulb changer
;! 
Dim $R,$O,$N,$S,$I,$M,$
"Please enter lightbulb maintenance reference:" Gets $R
$=Lamp
$O=GetObject($+"://"+$R)
$S=GetObject("Switch://"+$R)
If $O.Illuminated | $S.Toggle | $O.Illuminated
  If $O.Type="Bayonet"
    Do
      $O.Push
      $O.Rotate(-90)
      $O.Pull
    Until $O.Released
    Do
      $N=CreateObject($+".Bayonet")
      $N.Push
      $O.Rotate(90)
      If $N.IsHot
        $S.Toggle
        $=RunFingersUnderColdWater(@WKSTA)
      EndIf
    until 0=$N.Broken
  Else
    Do
      $O.Rotate(-180)
    Until $O.Released
    Do
      $N=CreateObject($+".Screw")
      While $N.Loose
        $N.Rotate(180)
        If $N.IsHot
          $S.Toggle
          $=RunFingersUnderColdWater(@WKSTA)
        EndIf
      Loop
    Until 0=$N.Broken
  EndIf
  $S.Toggle
  If $OState | $O.Illuminated
    $+"successfully changed and tested"+@CRLF
  Else
    $+"still not working. Please try running FixFuse.kix then retry ChangeLamp.kix"+@CRLF
  EndIf
  $S.Toggle
Else
  $+"is OK, no need to change"+@CRLF
;!