(include "sci.sh")
(use "Main")
(use "starCon")
(use "SpeakWindow")
(use "Blink")
(use "Osc")
(use "RandCycle")
(use "CueObj")
(use "n958")
(use "Cycle")
(use "Sounds")
(use "View")
(use "Obj")
(script 135)


(local
    local0[10] = (3 4 4 2 4 2 4 3 )
    local10[10] = (2 3 0 4 1 4 1 1 2 4 )
    local20

)
(instance public rm135 of Rm
    (properties
        noun 11
        picture 22
        style 32778
    )

    (method (init)
        (self:setRegions(109))
        proc958_0(128 120 121 122 123 124 128)
        proc958_0(143 135)
        (send gSQ5:handsOff())
        proc0_2(1)
        proc0_10(160 5)
        (send gEgo:view(121))
        (blobBody:
            init()
            setOnMeCheck(1 2)
        )
        (blueGuyBody:
            init()
            setOnMeCheck(1 4)
        )
        (dumbCadetBody:
            init()
            setOnMeCheck(1 8)
        )
        (greenGirlBody:
            init()
            setOnMeCheck(1 16)
        )
        (klingonBody:
            init()
            setOnMeCheck(1 32)
        )
        (ramBody:
            init()
            setOnMeCheck(1 64)
        )
        (smartCadetBody:
            init()
            setOnMeCheck(1 128)
        )
        (rogDesk:
            init()
            setOnMeCheck(1 16384)
        )
        (smartCadetDesk:
            init()
            setOnMeCheck(1 8192)
        )
        (dumbCadetDesk:
            init()
            setOnMeCheck(1 32768)
        )
        (classDoor:
            init()
            setOnMeCheck(1 4096)
        )
        (generalDesk:
            init()
            setOnMeCheck(1 512)
        )
        (cyclopsEye:
            init()
            setScript(sCyclopsEye)
        )
        (hornedGuy:
            init()
            setScript(sHornedGuy)
        )
        (redGuy:init())
        (bubbleHead:init())
        (smartEyes:
            init()
            setScript(sSmartEyes)
        )
        (smartHand:
            init()
            setCycle(RandCycle)
        )
        (super:init())
        (switch (gGModNum)
            (case 137
                (
                (if (> gState 9)
                    (send gRoom:setScript(sTestOver))
                )(else
                    (cheatDroid:
                        posn(Random(20 320) 55)
                        init()
                        setLoop(0)
                        setScript(sCheatDroid)
                    )
                    (send gRoom:setScript(sRogTakeTest))
                )
 )
            )
            (default 
                ((send gRoom:setScript(sTalkToTeach)) )
            )
        )
    )


    (method (dispose)
        (super:dispose())
    )

)
(instance sTalkToTeach of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) = global115 0 = gState 0 (send gEgo:
                    view(120)
                    setLoop(0)
                    setCel(0)
                    posn(96 41)
                    setPri(14)
                    signal(16400)
                    setScale(0)
                    init()
                )
 = seconds 1  )
            )
            (case 1
                ((send gEgo:
                    view(121)
                    setLoop(0)
                    setCel(0)
                    posn(104 49)
                )
 (send gSq5Music2:
                    number(123)
                    setLoop(1)
                    play(self)
                )
  )
            )
            (case 2
                ((send gTestMessager:say(10 0 0 1 self))  )
            )
            (case 3
                ((send gSq5Music2:
                    number(1231)
                    setLoop(1)
                    play(self)
                )
  )
            )
            (case 4
                ((send gEgo:
                    setLoop(5)
                    setCel(0)
                    posn(104 48)
                )
 = local20 1 (send gSq5Music1:
                    number(6)
                    setLoop(-1)
                    play()
                )
 = ticks 10  )
            )
            (case 5
                ((send gTestMessager:say(10 0 0 2 self))  )
            )
            (case 6
                ((send gSq5Music1:stop()) (send gEgo:
                    setLoop(0)
                    setCel(0)
                    posn(104 49)
                )
 = local20 0 = cycles 1  )
            )
            (case 7
                ((send gSq5Music2:
                    number(1232)
                    setLoop(1)
                    play(self)
                )
  )
            )
            (case 8
                ((send gTestMessager:say(10 0 0 3 self))  )
            )
            (case 9
                ((send gSq5Music2:
                    number(1231)
                    setLoop(1)
                    play(self)
                )
  )
            )
            (case 10
                ((send gTestMessager:say(10 0 0 4 self))  )
            )
            (case 11
                ((send gSq5Music1:
                    number(7)
                    setLoop(-1)
                    play()
                )
 (send gEgo:
                    setLoop(2)
                    setCel(0)
                    posn(111 71)
                )
 (blueGuy:
                    init()
                    setScript(sBlueGuy)
                )
 (klingon:
                    init()
                    setScript(sKlingon)
                )
 (send gSQ5:handsOn()) (send gRoom:newRoom(137)) (self:dispose()) )
            )
        )
    )

)
(instance sRogTakeTest of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gEgo:
                    setLoop(2)
                    setCel(0)
                    posn(111 71)
                    init()
                )
 (rogShiftyEyes:
                    setCycle(Osc)
                    init()
                )
 (send gSQ5:handsOn()) (send gSq5IconBar:disable(0 4)) (self:dispose()) )
            )
        )
    )

)
(instance sLookAtSmart of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (proc0_10(161 5) 
                (if ((< 6 gState) and (< gState 9))
                    (cheatAnswer:loop(3))
                )(else
                    (cheatAnswer:loop(2))
                )
 (cheatAnswer:
                    posn(50 30)
                    cel(local0[gState])
                    init()
                )
 (cheatQuestion:
                    posn(46 16)
                    cel(gState)
                    init()
                )
 = seconds 3  )
            )
            (case 1
                ((send gSq5Music2:
                    number(120)
                    setLoop(1)
                    play(self)
                )
 (cheatAnswer:dispose()) (cheatQuestion:dispose())  )
            )
            (case 2
                ((send gEgo:setScript(sRogTakeTest)) = seconds 1  )
            )
            (case 3
                ((bubbleHead:
                    setCel(1)
                    posn(30 40)
                )
 (smartEyes:hide()) (smartHand:hide()) = seconds 2  )
            )
            (case 4
                ((bubbleHead:
                    setCel(0)
                    posn(31 41)
                )
 (smartEyes:show()) (smartHand:show()) (cheatDroid:setScript(sCheatDroid)) (send gSQ5:handsOn()) (send gSq5IconBar:disable(0 4)) (self:dispose()) )
            )
        )
    )

)
(instance sLookAtDumb of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (
                (if ((< 6 gState) and (< gState 9))
                    (cheatAnswer:loop(3))
                )(else
                    (cheatAnswer:loop(2))
                )
 (cheatAnswer:
                    posn(250 30)
                    cel(local10[gState])
                    init()
                )
 (cheatQuestion:
                    posn(246 16)
                    cel(gState)
                    init()
                )
 = seconds 3  )
            )
            (case 1
                ((send gSq5Music2:
                    number(120)
                    setLoop(1)
                    play(self)
                )
 (cheatAnswer:dispose()) (cheatQuestion:dispose())  )
            )
            (case 2
                ((send gEgo:setScript(sRogTakeTest)) = seconds 1  )
            )
            (case 3
                ((redGuy:
                    setCel(1)
                    posn(266 49)
                )
 = seconds 2  )
            )
            (case 4
                ((redGuy:
                    setCel(0)
                    posn(274 46)
                )
 (cheatDroid:setScript(sCheatDroid)) (send gSQ5:handsOn()) (send gSq5IconBar:disable(0 4)) (self:dispose()) )
            )
        )
    )

)
(instance sBlueGuy of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((blueGuy:show()) = seconds Random(3 6)  )
            )
            (case 1
                ((blueGuy:hide()) = seconds Random(3 6)  )
            )
            (case 2
                (= state -1 = cycles 1 )
            )
        )
    )

)
(instance sSmartEyes of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (= seconds (* Random(1 3) 3)  )
            )
            (case 1
                ((smartEyes:setCycle(Osc 1 self))  )
            )
            (case 2
                (= state -1 = cycles 1 )
            )
        )
    )

)
(instance sHornedGuy of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((hornedGuy:show()) = seconds Random(1 4)  )
            )
            (case 1
                ((hornedGuy:hide()) = seconds Random(1 4)  )
            )
            (case 2
                (= state -1 = cycles 1 )
            )
        )
    )

)
(instance sKlingon of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((klingon:show()) = seconds Random(2 5)  )
            )
            (case 1
                ((klingon:hide()) = seconds Random(2 5)  )
            )
            (case 2
                (= state -1 = cycles 1 )
            )
        )
    )

)
(instance sCyclopsEye of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((cyclopsEye:setCycle(End self))  )
            )
            (case 1
                (= seconds Random(1 3)  )
            )
            (case 2
                ((cyclopsEye:setCycle(Beg self))  )
            )
            (case 3
                (= seconds Random(3 6)  )
            )
            (case 4
                (= state -1 = cycles 1 )
            )
        )
    )

)
(instance sCheatDroid of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((cheatDroid:cel(3)) = seconds Random(2 4)  )
            )
            (case 1
                ((cheatDroid:cel(4)) = ticks 4  )
            )
            (case 2
                ((cheatDroid:cel(5)) = ticks 4  )
            )
            (case 3
                ((cheatDroid:cel(0)) = seconds Random(2 4)  )
            )
            (case 4
                ((cheatDroid:cel(1)) = ticks 4  )
            )
            (case 5
                ((cheatDroid:cel(2)) = state -1 = ticks 4 )
            )
        )
    )

)
(instance sCheatAlert of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((droidAmbient:dispose()) (cheatDroid:xStep(10)) 
                (if (> (cheatDroid:x) 160)
                    (cheatDroid:setMotion(MoveTo 240 (cheatDroid:y) self))
                )(else
                    (cheatDroid:setMotion(MoveTo 80 (cheatDroid:y) self))
                )
 )
            )
            (case 1
                (
                (if (== (cheatDroid:cel) 2)
                    (cheatDroid:setCel(1))
                    = cycles 1
                )(else
                    (if (> (cheatDroid:cel) 3)
                        (cheatDroid:setCycle(End self))
                    )(else
                        = cycles 1
                    )
                )
 )
            )
            (case 2
                ((send gSq5Music2:
                    number(122)
                    setLoop(-1)
                    play()
                )
 (cheatDroid:
                    setLoop(1)
                    setCel(0)
                )
 = ticks 4  )
            )
            (case 3
                ((cheatDroid:
                    setLoop(1)
                    setCel(1)
                )
 = ticks 4  )
            )
            (case 4
                ((alertTop:
                    posn(- (cheatDroid:x) 9 - (cheatDroid:y) 16)
                    init()
                )
 (alertEyes:
                    x(- (cheatDroid:x) 9)
                    y(- (cheatDroid:y) 6)
                    init()
                    setCycle(Fwd)
                )
 (alertBeacon:
                    posn(- (cheatDroid:x) 4 + (cheatDroid:y) 10)
                    init()
                )
 (alertBeaconLight:
                    posn(- (cheatDroid:x) 2 + (cheatDroid:y) 15)
                    init()
                )
 (alertBottom:
                    posn(+ (cheatDroid:x) 2 + (cheatDroid:y) 37)
                    init()
                )
 = ticks 4  )
            )
            (case 5
                ((alertBeaconLight:setCycle(Fwd)) (alertBeacon:setCycle(Fwd)) (cyclopsEye:dispose()) (klingon:dispose()) (blueGuy:dispose()) (hornedGuy:dispose()) = ticks 1  )
            )
            (case 6
                ((alertTop:hide()) (alertBottom:hide()) = ticks 2  )
            )
            (case 7
                (
                (if (not (send gEgo:script))
                    (send gEgo:setScript(sRogCaught))
                )
 (alertTop:show()) (alertBottom:show()) = ticks 2  )
            )
            (case 8
                (= state 3 = cycles 1 )
            )
        )
    )

)
(instance sRogCaught of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((rogShiftyEyes:hide()) (send gSq5Music1:
                    number(8)
                    setLoop(1)
                    play()
                )
 (send gEgo:
                    loop(5)
                    cel(1)
                    posn(113 75)
                )
 = seconds 3  )
            )
            (case 1
                ((send gTestMessager:say(10 0 0 8 self))  )
            )
            (case 2
                ((send gRoom:newRoom(195)) (self:dispose()) )
            )
        )
    )

)
(instance sTestOver of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSq5Music1:fade()) (send gEgo:
                    loop(0)
                    cel(0)
                    posn(104 49)
                    init()
                )
 = seconds 3  )
            )
            (case 1
                ((send gSq5Music1:
                    number(5)
                    setLoop(-1)
                    play()
                )
 (send gTestMessager:say(10 0 0 5 self))  )
            )
            (case 2
                ((send gSq5Music2:
                    number(123)
                    setLoop(1)
                    play(self)
                )
  )
            )
            (case 3
                (
                (if (> global115 4)
                    (send gTestMessager:say(10 0 0 6 self))
                )(else
                    (send gTestMessager:say(10 0 0 7 self))
                )
 )
            )
            (case 4
                (
                (if (> global115 4)
                    (starCon:setScript(ScriptID(109 2)))
                    = cycles 2
                )(else
                    (send gRoom:newRoom(195))
                    (self:dispose())
                )
 )
            )
            (case 5
                ((send gRoom:newRoom(123)) (self:dispose()) )
            )
        )
    )

)
(instance rogShiftyEyes of Prop
    (properties
        x 169
        y 95
        noun 1
        modNum 1
        view 121
        loop 6
        priority 14
        signal 16400
    )
)
(instance hornedGuy of Prop
    (properties
        x 204
        y 50
        noun 9
        view 124
        loop 4
        priority 2
        signal 16
        detailLevel 2
    )
)
(instance blueGuy of Prop
    (properties
        x 162
        y 38
        noun 2
        view 124
        loop 2
        priority 1
        signal 16
        detailLevel 2
    )
)
(instance klingon of Prop
    (properties
        x 98
        y 49
        noun 8
        view 124
        loop 3
        priority 2
        signal 16
        detailLevel 2
    )
)
(instance cyclopsEye of Prop
    (properties
        x 80
        y 77
        noun 1
        view 124
        loop 5
        priority 1
        signal 16
        detailLevel 2
    )
)
(instance redGuy of Prop
    (properties
        x 274
        y rm135
        noun 6
        view 124
        priority 6
        signal 16
    )
)
(instance bubbleHead of Prop
    (properties
        x 31
        y 41
        noun 12
        view 123
        priority 6
        signal 16
    )
)
(instance cheatDroid of Actor
    (properties
        x 350
        y 55
        noun 3
        view 122
        priority 4
        signal 16
    )

    (method (init)
        (super:init())
        (droidAmbient:
            init()
            setCycle(Fwd)
        )
        (send gSq5Music2:
            number(121)
            setLoop(-1)
            play()
        )
    )


    (method (doit)
        (if ((== (cheatDroid:mover) 0) and not (== (cheatDroid:script) sCheatAlert))
            (if (> (cheatDroid:x) 300)
                (cheatDroid:setMotion(MoveTo 20 55))
            )(else
                (cheatDroid:setMotion(MoveTo 320 55))
            )
        )
        (super:doit())
        (if (== (self:cel) 0)
            (droidAmbient:
                loop(6)
                show()
            )
        )(else
            (if (== (self:cel) 3)
                (droidAmbient:
                    loop(7)
                    show()
                )
            )(else
                (droidAmbient:hide())
            )
        )
        (droidAmbient:
            x((self:x))
            y((self:y))
        )
    )


    (method (dispose)
        (send gSq5Music2:stop())
        (super:dispose())
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 1
                (
                (if (== (self:cel) 3)
                    (send gTestMessager:say(noun 1 2 0 self))
                )(else
                    (send gTestMessager:say(noun 1 1 0 self))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance droidAmbient of Prop
    (properties
        noun 3
        view 122
        loop 6
        priority 4
        signal 16400
    )
)
(instance alertTop of Prop
    (properties
        noun 3
        view 122
        loop 2
        priority 5
        signal 16
    )
)
(instance alertEyes of Prop
    (properties
        noun 3
        view 122
        loop 5
        priority 5
        signal 16
    )
)
(instance alertBeacon of Prop
    (properties
        noun 3
        view 122
        loop 4
        priority 5
        signal 16
    )
)
(instance alertBottom of Prop
    (properties
        noun 3
        view 122
        loop 2
        cel 2
        priority 5
        signal 16
    )
)
(instance alertBeaconLight of Prop
    (properties
        noun 3
        view 122
        loop 3
        priority 6
        signal 16
        cycleSpeed 0
    )
)
(instance smartEyes of Prop
    (properties
        x 65533
        y 93
        noun 12
        view 123
        loop 2
        priority 14
        signal 16
        cycleSpeed 20
    )
)
(instance smartHand of Prop
    (properties
        x 65526
        y 155
        noun 12
        view 123
        loop 1
        priority 15
        signal 16
        cycleSpeed 15
    )
)
(instance rogMouth of Prop
    (properties
        nsTop 11
        view 121
    )
)
(instance dumbMouth of Prop
    (properties
        nsTop 1
        nsLeft 1
        view 123
        loop 4
    )
)
(instance smartMouth of Prop
    (properties
        nsTop 1
        nsLeft 1
        view 123
        loop 4
    )
)
(instance public rogerTalker of Talker
    (properties
        x 104
        view 121
        talkWidth 170
        textX 65466
    )

    (method (init param1)
        = talkWidth proc0_12(250 170 250 170 170)
        = font gFont
        = gSq5Win SpeakWindow
        (send gSq5Win:
            tailX(proc0_12(164 164 164 164 124))
            tailY(proc0_12(42 46 42 46 46))
            xOffset(proc0_12(5 5 5 5 65531))
        )
        (if (local20)
            (rogMouth:
                loop(7)
                nsTop(13)
                nsLeft(42)
            )
            (self:
                loop(5)
                cel(0)
                y(46)
            )
        )(else
            (rogMouth:
                loop(1)
                nsTop(11)
                nsLeft(43)
            )
            (self:
                loop(0)
                cel(0)
                y(49)
            )
        )
        (super:init(0 0 rogMouth rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
(instance public dumbTalker of Talker
    (properties
        x 260
        y 49
        view 123
        loop 3
        talkWidth 130
        textX 65436
    )

    (method (init param1)
        = font gFont
        (send (= gSq5Win SpeakWindow):
            tailX(260)
            tailY(43)
            xOffset(65491)
        )
        (super:init(0 0 dumbMouth rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
(instance public smartTalker of Talker
    (properties
        x 30
        y 49
        view 123
        loop 3
        talkWidth 170
        textX 40
    )

    (method (init param1)
        = font gFont
        (send (= gSq5Win SpeakWindow):
            tailX(40)
            tailY(43)
            xOffset(60)
        )
        (super:init(0 0 smartMouth rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
(instance cheatAnswer of View
    (properties
        x 50
        y 30
        view 128
        loop 2
        priority 15
        signal 16
    )
)
(instance cheatQuestion of View
    (properties
        x rm135
        y 16
        view 128
        priority 15
        signal 16
    )
)
(instance rogDesk of Feature
    (properties
        x 157
        y 136
        noun 5
        onMeCheck 16384
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 4
                ((send gRoom:newRoom(137))  )
            )
            (case 1
                ((send gRoom:newRoom(137))  )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance smartCadetDesk of Feature
    (properties
        x 12
        y 149
        noun 5
        onMeCheck 8192
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 1
                ((send gSQ5:handsOff()) (cheatDroid:setScript(0)) (rogShiftyEyes:hide()) (send gSq5Music2:
                    number(120)
                    setLoop(1)
                    play()
                )
 (send gEgo:
                    setLoop(3)
                    setCel(0)
                    posn(107 46)
                )
 
                (if (not == (cheatDroid:cel) 3)
                    (cheatDroid:setScript(sCheatAlert))
                )(else
                    (send gRoom:setScript(sLookAtSmart))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance dumbCadetDesk of Feature
    (properties
        x 304
        y 127
        noun 5
        onMeCheck 32768
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 1
                ((send gSQ5:handsOff()) (cheatDroid:setScript(0)) (rogShiftyEyes:hide()) (send gSq5Music2:
                    number(120)
                    setLoop(1)
                    play()
                )
 (send gEgo:
                    setLoop(4)
                    setCel(0)
                    posn(117 61)
                )
 
                (if (not == (cheatDroid:cel) 3)
                    (cheatDroid:setScript(sCheatAlert))
                )(else
                    (send gRoom:setScript(sLookAtDumb))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance blobBody of Feature
    (properties
        x 4
        y 20
        noun 1
        onMeCheck 2
    )
)
(instance blueGuyBody of Feature
    (properties
        x 4
        y 20
        noun 2
        onMeCheck 4
    )
)
(instance dumbCadetBody of Feature
    (properties
        x 4
        y 20
        noun 6
        onMeCheck 8
    )
)
(instance greenGirlBody of Feature
    (properties
        x 4
        y 20
        noun 7
        onMeCheck 16
    )
)
(instance klingonBody of Feature
    (properties
        x 4
        y 20
        noun 8
        onMeCheck 32
    )
)
(instance ramBody of Feature
    (properties
        x 4
        y 20
        noun 9
        onMeCheck 64
    )
)
(instance smartCadetBody of Feature
    (properties
        x 4
        y 20
        noun 12
        onMeCheck 128
    )
)
(instance classDoor of Feature
    (properties
        x 4
        y 20
        noun 4
        onMeCheck 4096
    )
)
(instance generalDesk of Feature
    (properties
        x 4
        y 20
        noun 5
        onMeCheck 512
    )
)
