Newsgroups: rec.arts.int-fiction
Path: gmd.de!jvnc.net!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!zaphod.mps.ohio-state.edu!caen!uunet!hobbes!jondr
From: jondr@sco.COM (Karen Silkwood's car)
Subject: Re: Advsys help
Organization: The Santa Cruz Operation, Inc.
Date: Tue, 08 Dec 1992 18:21:15 GMT
Message-ID: <1992Dec08.182115.18179@sco.com>
References: <1992Dec8.040600.9180@msuinfo.cl.msu.edu>
Sender: news@sco.com (News admin)
Lines: 69


schwarts@cps.msu.edu (Steven Eric Schwartz) writes:
>Could someone please explain to me how the following move definition works
>for actors in ADVSYS? I am not sure how the include file uses the child and
>sibling properties. Thank you in advance.

>  (method (move dir &aux obj sib)

define a method called move.  it takes one argument, dir.  it has two local
variables: obj and sib.

>    (setq obj (getp self child))

obj now has the first child of the object that is executing this method.

>    (while obj

while there is still a child,

>      (setq sib (getp obj sibling))

remember the sibling of this object for later.  (presumably cos we're going
to move this object somewhere and when we're done, it will have a new
sibling.)

>      (if (setq temp (getp obj tied-to))

is the child object tied to something?

>          (if (and (!= (getp temp parent) self) (!= temp self)

if that object is not held by me and not actually the thing that's moving,

>          (getp temp takeable?))

find out if it's the kind of thing you can move.  if it is:

>              (progn
>                (send (getp self parent) leave temp dir)
>                (message "You drag the " temp " along with you.\n")

send a message to the object's parent telling it that the object is moving
in direction dir, then print the text about dragging it.

>              )
>              (error2 "You'll have to drop the " obj
>                      " or untie it from the " temp
>                      " before you can move.\n"
>              )

otherwise, complain.

>          )
>      )
>      (setq obj sib)

now set the loop variable to the object's old sibling.

>    )

and loop...

>    (send (getp self parent) leave self dir)

now send this message to the object's parent.
-- 
Jon Drukman (God's personal DJ)                 uunet!sco!jondr   jondr@sco.com
-------------------------------------------------------------------------------
I was an infinitely hot and dense dot.
