Random room in a zone.

From: John Evans (evansj@HI-LINE.NET)
Date: 02/03/98


Heya,
        I've searched (manually and automagically) through both archives
of the list for the following and came up empty. I know that it's been
discussed before, but I can't find anything about it. If I remember right,
George (as usual) had the right answer for this....

I have a teleport spell that bamfs the character to a random room
somewhere in the MUD. That's easy.

I am coding a less powerful version of the teleport spell that will take
you to a random room in the zone that you are in. I've seen things like:

zone = world[ch->in_room].number;
to_room = number((zone * 100), (zone * 100) + 99);

and that is what I currently have coded, but I think that I've seen that
that is "wrong." I am going to do my best to make sure that all zones are
100 rooms numbering from X00 to X99, but I'm not foolish enough to think
that I may outlast my code. This means that someone down the line might do
something different and I don't want the code to "break" because of an
event like this. I've muddled it over and searched, and am coming up
empty-handed.

Any advice or pointers?

John Evans <evansj@hi-line.net>  --  http://www.hi-line.net/~evansj/

Any sufficiently advanced technology is indistinguishable from magic.
--Arthur C. Clarke


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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