Re: [TADS] Moving stuf again...


9 Dec 1995 15:45:17 GMT

Neil Demause (neild@echonyc.com) wrote:
: I posted this question once before, but my newsserver chose that moment
: for a week-long vacation, so I don't know if anyone ever answered it. I
: am in desperate need of a reliable chunk of TADS code to move the entire
: contents of one object to another (i.e., emptying a bag onto the floor).
: This should be really easy, I suspect, but I'm having a hell of a time
: coming up with something that works.

Deep Space Drifter has a function that drops the player's inventory -
you could adapt the code to do what you want, I imagine. This is it:

dropAll: function( actor )
{
local cur, rem, loc, cnt;

cnt := 0;
rem := actor.contents;
loc := actor.location;
while ( cur := car( rem ))
{
if ( not cur.isworn )
{
cur.moveInto( loc );
cnt := cnt + 1;
}
rem := cdr( rem );
}
return( cnt );
}

- Neil K.

--
    Neil K. Guy  *  neilg@sfu.ca  *  tela@tela.bc.ca
        49N 16' 123W 7'  *  Vancouver, BC, Canada