function improbablehousing_secretrooms_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "commentarycommand":
            if (!httpget("hid")) {
                break;
            } else {
                require_once "modules/improbablehousing/lib/lib.php";
                $hid = httpget("hid");
                $rid = httpget("rid");
                $house = improbablehousing_gethousedata(httpget("hid"));
                $secrets = array();
                foreach ($house['data']['rooms'] as $rkey => $rvals) {
                    if ($rkey != $rid) {
                        if ($rvals['enterfrom'] == $rid && $rvals['hidden']) {
                            $secrets[$rkey] = $rvals;
                        } else {
                            if ($rkey == $house['data']['rooms'][$rid]['enterfrom']) {
                                $secrets[$rkey] = $rvals;
                            }
                        }
                    }
                }
                if (count($secrets)) {
                    foreach ($secrets as $rkey => $rvals) {
                        if (count($rvals['triggers'])) {
                            foreach ($rvals['triggers'] as $trigger) {
                                if ($args['command'] == $trigger) {
                                    $args['processed'] = 1;
                                    if (improbablehousing_canenter_room($house, $rkey)) {
                                        redirect("runmodule.php?module=improbablehousing&op=interior&hid={$hid}&rid={$rkey}");
                                    } else {
                                        output_notl("%s`n`n", $rvals['lockreject']);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            break;
        case "improbablehousing_interior":
            $hid = $args['hid'];
            $rid = $args['rid'];
            $house = $args['house'];
            if (improbablehousing_getkeytype($house, $rid) == 100) {
                addnav("Donator Features");
                addnav("Build a Secret Room", "runmodule.php?module=improbablehousing_secretrooms&op=start&hid={$hid}&rid={$rid}");
                if ($house['data']['rooms'][$rid]['hidden']) {
                    addnav("Secret Room Features");
                    addnav("Manage this room's trigger phrases", "runmodule.php?module=improbablehousing_secretrooms&op=manage&hid={$hid}&rid={$rid}");
                }
            }
            break;
    }
    return $args;
}
     global $session;
     $list = improbablehousing_getnearbyhouses($maploc);
     $nlist = count($list);
     output("`bAccessible Dwellings at %s`b`n", $maploc);
     if ($nlist) {
         for ($i = 0; $i < $nlist; $i++) {
             $house = $list[$i];
             $house = improbablehousing_canenter_house($house);
             if ($house['canenter']) {
                 // assemble dwelling code here
                 $nrooms = count($house['data']['rooms']);
                 if ($nrooms) {
                     output("`n%s`0 (owner: %s)`n", $house['data']['name'], moderate_getlogin($house['ownedby']));
                     $hid = $house['id'];
                     foreach ($house['data']['rooms'] as $rid => $roomdet) {
                         if (improbablehousing_canenter_room($house, $rid)) {
                             rawoutput("<a href=\"moderate.php?op=dwellchat&hid={$hid}&rid={$rid}&x={$x}&y={$y}\">" . "[Mod]" . "</a>");
                             addnav("", "moderate.php?op=dwellchat&hid={$hid}&rid={$rid}&x={$x}&y={$y}");
                             output(" %s`n", $roomdet['name']);
                         }
                     }
                 }
             }
         }
     }
     break;
 case "map":
     output("`bWorld Map Lookup`b`n`n");
     output("Enter map coordinates:`n");
     rawoutput("<form action='moderate.php?op=maplook' method='POST'>");
     // Note: Width 2 means a 2-digit number. Set the default location to 13,11 Improbable Central.