Re: [NEWBIE] Stacking

From: Daniel Wickes (
Date: 04/07/99

> >1. write_to_output *drumm*rolls* yes, what business has a function
> >fiddling around with my text I'm passing to it, it should do what it's
> >supposed to and write_to_output as _I_ send it (no nannying me).
> That's what layers are supposed to do, fiddle with the text to make it
> displayable.

I must admit, I did think it an odd place to put it, but not so much to kick
up a fuss over.  I do my own colour stuff as part of write_to_output(), as
well as word-wrapping etc., as it seemed the Right Place™.   My object
sorting* takes place in obj_to_room(), obj_to_char(), obj_to_obj() etc.  They
all call the same simple bubble sort function (naturally you could change it
to whatever algorithm you see fit) so when I'm showing them to characters etc.
it's painless to group them all together and it also made relatively simple
the move from;

        You get a sword.
        You get a flail.
        You get a sword.


        You get (2) a sword and a flail.

a simple one.

> >2. isn't this just a touch inefficeint, the only analogy I can think of
> >right now (4:20am) is it's like purifying a whole resevoirs worth of
> >water, to find out you only need a glass full.  You generate all this data
> >to be sent out, allocating resources etc. for it, then it gets cut down at
> >the final hurdle on the way out of the machine, why waste the resources in
> >transit?
> Because then every single little function in CircleMUD doesn't have to have
> the logic to check for multiple messages.  To take your example of code in
> the inventory list.  Now what do you do if you want the combat messages to
> be stacked also?  Put the code there?  Or if you'd like people who spam
> with 20 tells to be stacked? Though I think my code would require a delay,
> except for slow connections, it is much more possible.

Hmm, combat messages...  Hadn't thought of grouping those.  Thanks, George :)
I agree, yours is the simplest change.  I made one for characters, objects and
ships and anything else I would have to add something more in the future.  I'd
still argue that my change was preferable, but then if I wouldn't you probably
wouldn't be reading a mail from me now!

I confess to being a sloppy coder, at least when I play around in CircleMUD.
My job requires I put a little more thought into what I write (but then again
I get paid for that!) and I do my best.  However, when coding stuff for the
MUD, efficiency and re-usability isn't as great a priority as it is otherwise.
Maybe it should be, I'm not so sure.  Anyway, I have no intention of getting
into some argument with someone over it, I just wanted to impart my usage of
the object sorting.

-- Daniel

* : I'd love to take all the credit, but the idea wasn't all mine, though
implementation is...  You don't get many patches for 2.2 these days ;)

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 12/15/00 PST