(version 2)
(include "sci.sh")
(use "Main")
(use "Print")
(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 gFpMessager:findTalker(Message(msgGET 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 gFpMessager: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(#perform 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 theTheGNumber_2 param2)
        (var theGNumber, theTheGNumber, theTheTheGNumber, theTheTheGNumber_2, theTheTheGNumber_2_2, theTheTheGNumber_2_3, theTheTheGNumber_2_4, theTheTheGNumber_2_5)
        = theTheTheGNumber_2_2 0
        = theTheTheGNumber_2 theTheTheGNumber_2_2
        = theTheTheGNumber theTheTheGNumber_2
        = theTheGNumber theTheTheGNumber
        = theGNumber theTheGNumber
        = theTheTheGNumber_2_5 0
        = theTheTheGNumber_2_4 theTheTheGNumber_2_5
        = theTheTheGNumber_2_3 theTheTheGNumber_2_4
        (if (paramTotal and not IsObject(theTheGNumber_2[0]))
            = theGNumber theTheGNumber_2[0]
            (if (== theGNumber -1)
                = theGNumber gNumber
            )
            (if (> paramTotal 1)
                = theTheGNumber theTheGNumber_2[1]
                (if (> paramTotal 2)
                    = theTheTheGNumber theTheGNumber_2[2]
                    (if (> paramTotal 3)
                        = theTheTheGNumber_2 theTheGNumber_2[3]
                        (if (> paramTotal 4)
                            = theTheTheGNumber_2_2 theTheGNumber_2[4]
                            (if (> paramTotal 5)
                                = theTheTheGNumber_2_3 theTheGNumber_2[5]
                                (if (> paramTotal 6)
                                    = theTheTheGNumber_2_4 theTheGNumber_2[6]
                                    (if (> paramTotal 7)
                                        = theTheTheGNumber_2_5 theTheGNumber_2[7]
                                    )
                                )
                            )
                        )
                    )
                )
            )
            (if (not IsObject(theTheGNumber_2[0]))
                (super:add((send ((MessageObj:new())):
                        modNum(theGNumber)
                        noun(theTheGNumber)
                        verb(theTheTheGNumber)
                        case(theTheTheGNumber_2)
                        sequence(theTheTheGNumber_2_2)
                        x(theTheTheGNumber_2_3)
                        y(theTheTheGNumber_2_4)
                        font(theTheTheGNumber_2_5)
                        yourself()
                    )
))
            )
        )(else
            (super:add(theTheGNumber_2 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 theScript sendParams)
        (if (IsObject(script))
            (send script:dispose())
        )
        (if (theScript)
            (send theScript:init(self rest sendParams))
        )
    )


    (method (load param1)
        (var theGNumber, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8)
        = theGNumber 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 (theGNumber)
            (if (== theGNumber -1)
                = theGNumber gNumber
            )
            (self:add(theGNumber temp1 temp2 temp3 temp4 temp5 temp6 temp7))
            = theGNumber 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))
        )
    )

)
