On Tue, 3 Feb 1998, John Evans wrote: >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); The random real room version: (to avoid non-existant possibilities) /* NOTE: ch->in_room != NOWHERE */ real_zone = world[ch->in_room].zone; if (real_zone < top_of_zone_table) high = real_room(zone_table[real_zone + 1].number * 100); else high = top_of_world_table; low = real_room(zone_table[real_zone].number * 100); to_real_room = number(low, high); If you want a random virtual number, try: 'zone_table[zone].number * 100' to 'zone_table[zone].top' -- George Greer - Me@Null.net | Genius may have its limitations, but stupidity http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard +------------------------------------------------------------+ | 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