(include "sci.sh")
(use "Main")
(use "Print")
(use "MessageObj")
(use "Obj")
(script 925)



(class MessageObj of Obj
    (properties
        modNum -1
        noun 0
        verb 0
        case 0
        sequence 0
        whoSays 0
        client 0
        caller 0
        font 0
        x 0
        y 0
    )

    (method (showSelf)
        (var temp0[40])
        = whoSays (send gTestMessager:findTalker(GetMessage(0 modNum noun verb case 
                    (if (sequence)
                    )(else
                        1
                    )
)))
        (if (not IsObject(whoSays))
            (Print:
                addTextF("<MessageObj> Message not found: %d - %d, %d, %d, %d" modNum noun verb case sequence)
                init()
            )
            = global4 1
        )(else
            (if (font)
                (send whoSays:font(font))
            )
            (if (x or y)
                (send whoSays:
                    x(x)
                    y(y)
                )
            )
            (send gTestMessager:say(noun verb case sequence caller modNum))
        )
    )

)
(class Conversation of List
    (properties
        elements 0
        size 0
        script 0
        curItem -1
        caller 0
    )

    (method (init theCaller)
        = curItem -1
        (if (paramTotal and IsObject(theCaller))
            = caller theCaller
        )
        (send gTheDoits:add(self))
        (self:cue())
    )


    (method (doit)
        (if (script)
            (send script:doit())
        )
    )


    (method (dispose)
        (var theCaller)
        (self:eachElementDo(96 cleanCode))
        (send gTheDoits:delete(self))
        (if (gDialog)
            (send gDialog:dispose())
        )
        (if (script)
            = script 0
        )
        = theCaller caller
        (super:dispose())
        (if (theCaller)
            (send theCaller:cue())
        )
    )


    (method (add theTheGModNum param2)
        (var theGModNum, theTheTheGModNum, theTheTheGModNum_2, theTheTheGModNum_3, theTheTheGModNum_4, theTheTheGModNum_5, theTheTheGModNum_6, theTheTheGModNum_7)
        = theGModNum (= theTheTheGModNum (= theTheTheGModNum_2 (= theTheTheGModNum_3 (= theTheTheGModNum_4 0))))
        = theTheTheGModNum_5 (= theTheTheGModNum_6 (= theTheTheGModNum_7 0))
        (if (paramTotal and not IsObject(theTheGModNum[0]))
            (if (== (= theGModNum theTheGModNum[0]) -1)
                = theGModNum gModNum
            )
            (if (> paramTotal 1)
                = theTheTheGModNum theTheGModNum[1]
                (if (> paramTotal 2)
                    = theTheTheGModNum_2 theTheGModNum[2]
                    (if (> paramTotal 3)
                        = theTheTheGModNum_3 theTheGModNum[3]
                        (if (> paramTotal 4)
                            = theTheTheGModNum_4 theTheGModNum[4]
                            (if (> paramTotal 5)
                                = theTheTheGModNum_5 theTheGModNum[5]
                                (if (> paramTotal 6)
                                    = theTheTheGModNum_6 theTheGModNum[6]
                                    (if (> paramTotal 7)
                                        = theTheTheGModNum_7 theTheGModNum[7]
                                    )
                                )
                            )
                        )
                    )
                )
            )
            (if (not IsObject(theTheGModNum[0]))
                (super:add((send ((MessageObj:new())):
                        modNum(theGModNum)
                        noun(theTheTheGModNum)
                        verb(theTheTheGModNum_2)
                        case(theTheTheGModNum_3)
                        sequence(theTheTheGModNum_4)
                        x(theTheTheGModNum_5)
                        y(theTheTheGModNum_6)
                        font(theTheTheGModNum_7)
                        yourself()
                    )
))
            )
        )(else
            (super:add(theTheGModNum rest param2))
        )
    )


    (method (cue param1)
        (var temp0, temp1)
        (if ((paramTotal and param1) or (== ++curItem size))
            (self:dispose())
        )(else
            = temp0 (self:at(curItem))
            (if ((send temp0:isKindOf(MessageObj)))
                (send temp0:
                    caller(self)
                    showSelf()
                )
            )(else
                (if ((send temp0:isKindOf(Script)))
                    (self:setScript(temp0 self))
                )(else
                    (if (IsObject(temp0))
                        (send temp0:doit(self))
                    )(else
                        (self:cue())
                    )
                )
            )
        )
    )


    (method (setScript param1 param2)
        (if (IsObject(script))
            (send script:dispose())
        )
        (if (param1)
            (send param1:init(self rest param2))
        )
    )


    (method (load param1)
        (var theGModNum, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8)
        = theGModNum proc999_6(param1 0)
        = temp1 proc999_6(param1 1)
        = temp2 proc999_6(param1 2)
        = temp3 proc999_6(param1 3)
        = temp4 proc999_6(param1 4)
        = temp5 proc999_6(param1 5)
        = temp6 proc999_6(param1 6)
        = temp7 proc999_6(param1 7)
        = temp8 7
        (while (theGModNum)
            (if (== theGModNum -1)
                = theGModNum gModNum
            )
            (self:add(theGModNum temp1 temp2 temp3 temp4 temp5 temp6 temp7))
            = theGModNum proc999_6(param1 ++temp8)
            = temp1 proc999_6(param1 ++temp8)
            = temp2 proc999_6(param1 ++temp8)
            = temp3 proc999_6(param1 ++temp8)
            = temp4 proc999_6(param1 ++temp8)
            = temp5 proc999_6(param1 ++temp8)
            = temp6 proc999_6(param1 ++temp8)
            = temp7 proc999_6(param1 ++temp8)
        )
    )

)
(instance cleanCode of Code
    (properties)

    (method (doit param1)
        (var temp0)
        (if ((send param1:isKindOf(Script)))
            (send param1:caller(0))
        )
        (if (((send param1:isKindOf(MessageObj)) and IsObject((= temp0 (send param1:whoSays)))) and (send temp0:underBits))
            (send temp0:dispose(1))
        )
    )

)
