[Adventuron] - Nesting zones

Can I nest zones?


zones {
   zone_window : zone {
      locations = [ bedroom_1,dining_room,drawing_room,kitchen,scullery,study]
   zone_garden : zone {
      locations  = [ garden, garden_3, garden_4, garden_5]
   zone_all : zone {
   locations  = [ zone_window, zone_garden ]

(the editor doesn’t like this…am I missing some obvious way of achieving it?)

Not a bad idea, but no, this isn’t supported (at least yet).

I don’t think you really need to nest zones. You can just have rooms in multiple zones as needed. This is a bit more verbose, but you’ll find that it’s a lot more more flexible.

In place of your zone_all, when testing for zones, you can just say : if (is_at "zone_window" || is_at "zone_garden") {} and it serves the same purpose as zone_all.

By keeping the zones separate, you can also test for overlaps. For (not a very realistic) example, suppose you had a greenhouse that had both a window and a garden, you could put it in both zone_window and zone_garden. Now if you wanted to test whether a room had both a window and a garden, you could use : if (is_at "zone_window" && is_at "zone_garden") {}.

The concept of zones is a very powerful feature. I use it to move around floating objects in the on_pre_describe section. Other languages would use a Boolean property for the rooms that Adventuron puts in zones. Adventuron allows you to do that too, if you want, using traits. I’ve just noticed that traits are now documented in section 1.40 of the cookbook.

Yes, that’s what I do at the moment. Just wondering if there was a more compact way of doing it that I haven’t fathomed because I don’t know how to express it in code (happens to me a lot).