Re: weights of nested containers

new topic     » goto parent     » topic index » view thread      » older message » newer message

That was part of the problem.  I only have each thing being carried have a
number that marks what they are being carried by...  I don't have a sequence
that holds everyone/thing that is being carried.  Will I need to have it
like that?  I didn't WANT to do it that way.  But, am I going to have to?

Currently to find out what is being carried by a person, here is an
example....when the person enters the room, the message say "<Name> enters."
however I wanted it to say this if they were carrying someone........
"<name> enters, carring <othername> over their shoulder."  This is the
function that generates the part of that message from the comma on.....This
is how I check to see who's being carried.

function carrymessage(integer whichplayer)
sequence thecarrymessage,hisher
integer foundit


--This is just to determine gender of person entering the room
if mudthings[whichplayer][8][22]=1 then hisher="his" else hisher="her" end
if

--Foundit determines if they are carrying anyone at all, so as to finish the
message, if they are
foundit=0
thecarrymessage=""

--mudthings include players, mobiles, objects, and rooms
for x=1 to length(mudthings) do

    --mudthings[x][5] is what "room" this one is in
    --mudthings[whichplayer][1] is the id number of the person being
checked, which determines if the "room" is actually that person, which would
mean they are
carrying this person
     if mudthings[x][5]=mudthings[whichplayer][1] then
          if length(thecarmessage)<0 then
              thecarrymessage=thecarrymessage&", carrying
"&mudthings[whichplayer][2]
          else
              thecarrymessage=thecarrymessage&" and
"&mudthings[whichplayer][2]
          end if
          foundit=1
     end if
end for

if foundit=1 then
     thecarrymessage=thecarmessage&" over "&hisher&" shoulder"
end if

return thecarrymessage
end function


To be able to do nested weights...am I going to HAVE to put it into a
sequence, instead of checking each time?


Michelle Rogers
----- Original Message -----
From: "Derek Parnell" <ddparnell at bigpond.com>
To: <EUforum at topica.com>
Sent: Monday, February 16, 2004 6:01 PM
Subject: RE: weights of nested containers
>
> How about something like this...
>
>   function CalcWeight( object pHolder)
>     atom lWeightSoFar
>
>     lWeightSoFar = pHolder[kWEIGHT]
>     for i = 1 to length(pHolder[kCarrying]) do
>        lWeightSoFar += CalcWeight( TheWorld[ pHolder[kCarrying][i] ] )
>     end for
>
>     return lWeightSoFar
>   end function
>
>   TotalWeight = CalcWeight ( theObject )
>
> This assumes you have a sequence that holds all the data for an entity,
and
> that sequence has a weight attribute and a list of things (an index into
the
> 'world') that the entity is carrying.
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu