//    Instruction Example :      light.mode.set (objectid,long)

    Screen.Resolution.Set(512, 384)

        Screen.Set(BACK)
          Pattern.Display("avo\bubble.gif")
    Screen.End()

        @camera   = Camera.Create(0.0, 0.0, -100.0, 0.0, 0.0, 0.0)

        @viewport = Viewport.Create()
        Viewport.Camera.Set(@viewport, @camera)

        @light  = Light.Omni.Create(0.0, 100.0, -100.0)

    Mesh.Rotation.Stack(-30, 30, 0)
        @sphere = Mesh.Sphere.Create(35, 16, 16)
        Mesh.Light.Assign(@sphere, @light)

        Mesh.Display(@sphere)
        Viewport.Display(@viewport)

        Screen.Set(FRONT)
          Text.Display("Press a key to switch the light OFF.", CENTER, 10)
        Keyboard.Wait()
          Light.Mode.Set(@light, LIGHT_OFF)
        Box.Fill.Select()
        Box.Clear(0, 10, 512, 10)
          Text.Display("Press a key to switch it on.", CENTER, 10)
        Keyboard.Wait()
          Light.Mode.Set(@light, LIGHT_ON)

          Text.Display("Press a key to switch the light attenuation ON.", CENTER, 10)
        Keyboard.Wait()
          Light.Mode.Set(@light, LIGHT_ATTENUATEON)
          Light.Attenuate.Range.Set(@light, 100, 125)
        Box.Fill.Select()
        Box.Clear(0, 10, 512, 10)
          Text.Display("Press a key to switch it off.", CENTER, 10)
        Keyboard.Wait()
          Light.Mode.Set(@light, LIGHT_ATTENUATEOFF)

          Text.Display("Press a key to exit.", CENTER, 350)
        Keyboard.Wait()
    Screen.End()

        Mesh.Kill(@sphere)
        Light.Kill(@light)
        Viewport.Kill(@viewport)
        Camera.Kill(@camera)
    Script.Stop()