// I thought, well, the real world has windows as well as doors, and this concept can be used
// to create "optical gateways" to other parts of the world (Or the next room!) Allowing
// players to look out the window (or into the dark pool of water... whatever) and see
// what is going on else where in the world.

// Additions to Voltec's original window code by Ahriman of Darkmoor 8/19/00

In act_info.c

DECLARE_DO_FUN( do_play		);
DECLARE_DO_FUN(	do_inventory	);
   
/* add any othe names you use in the same format. Darkmoor also
 * has crystal balls and scrying pools.
 */
+ void look_crystal( CHAR_DATA *ch, OBJ_DATA *obj );
+ void look_ball( CHAR_DATA *ch, OBJ_DATA *obj );
+ void look_window( CHAR_DATA *ch, OBJ_DATA *obj );
+ void look_pool( CHAR_DATA *ch, OBJ_DATA *obj );
+ void look_scrying( CHAR_DATA *ch, OBJ_DATA *obj );

in the function do_look() at some point find the following code...

    for ( obj = ch->in_room->contents; obj != NULL; obj = obj->next_content )
    {
	if ( can_see_obj( ch, obj ) )
	{
/* add any othe names you use in the same format. Darkmoor also
 * has crystal balls and scrying pools.
 */
+	    if (obj->item_type == ITEM_SCRYER)    /* Voltecs Window code */
+	       {
+		   look_crystal(ch, obj);
+           return;
+		   }
+		if (obj->item_type == ITEM_SCRYER)    /* Voltecs Window code */
+	       {
+		   look_ball(ch, obj);
+           return;
+		   }
+		if (obj->item_type == ITEM_SCRYER)    /* Voltecs Window code */
+	       {
+		   look_window(ch, obj);
+           return;
+		   }
+		if (obj->item_type == ITEM_SCRYER)    /* Voltecs Window code */
+	       {
+		   look_pool(ch, obj);
+           return;
+		   }
+       if (obj->item_type == ITEM_SCRYER)    /* Voltecs Window code */
+	       {
+		   look_scrying(ch, obj);
+           return;
+		   }
		   

const.c

after the     {   ITEM_JUKEBOX,	"jukebox"	}, line

+	{   ITEM_SCRYER,    "scryer"    },  /* Voltec Window Code */   

db.c in

the create_object() function, and in the case statemnt find the following

   case ITEM_GEM:
   case ITEM_JEWELRY:
+  case ITEM_SCRYER:   /* Voltecs Window Code */


merc.h in the object types section

  #define ITEM_JUKEBOX		 34
+ #define ITEM_SCRYER		 35 /* Voltecs Window Code */


tables.c in the flag_type type_flags[] table declaration after jukebox

	{   "scryer",       ITEM_SCRYER,        TRUE    },


/* Set the following if you use OLC */

olc_act.c  case statement in set_obj_values()

+    case ITEM_SCRYER:
+	    switch ( value_num )
+	    {
+	        default:
+		    send_to_char( "set v0 to the destination room, or to zero if you wish to use the item description \n\r",ch);
+	            return FALSE;
+	        case 0:
+	            send_to_char( "VIEWING ROOM SET.\n\r\n\r", ch );
+	            pObj->value[0] = atoi( argument );
+	            break;       
+        }
+		break;

in the function show_obj_values() add the following clause to the case statement...

+	    case ITEM_SCRYER:   /* Voltecs Window code! */
+	    sprintf( buf, 
+		"[v0] Room to view: [%d]\n\r"
+		obj->value[0] );
+		send_to_char( buf, ch );
+		break;	

/*
______________________________________________ E.O.SNIPPET____________________________________

I think thats about it, but if you have any problems getting this one to work
or have any sugestions as to how I can improve it, let me know!  (At the moment the object
has to be a "window", ie if you call it a portal, then looking at it still calls it a window..
easy enough to fix, but I don't have the time at the moment...  Watch this space for an update...)

Basically, grep your code for any referances to ITEM_JUKE_BOX and add a similar line for the window...
(thats what I did!!!)

If you use it, send me an e-mail so I know it was worth the effort...

voltec@cyberdude.com

*/

If anyone can tell me how to do this without the multiple IF statements in act_info.c
it would be much appreciated.

Ahriman
darkmoormud@aol.com

With little sleep I forgot the most important part of the code that goes into act_info.c
I placed this before do_read

void look_crystal( CHAR_DATA *ch, OBJ_DATA *obj )    /* Voltecs Window code 
1998 */
{
char             buf[MAX_STRING_LENGTH];
ROOM_INDEX_DATA *scryer_room;   

if ( obj->value[0] == 0 )
{
sprintf(buf, "%s\n\r", obj->description );
send_to_char(buf, ch);
return;
}

scryer_room = get_room_index( obj->value[0] );

if ( scryer_room == NULL )
{
send_to_char( "!!BUG!! Crystal Ball looks into a NULL room! Please 
report!\n\r", ch );
bug( "Crystal Ball %d looks into a null room!!!", 
obj->pIndexData->vnum );
return;
}

if ( !IS_NPC(ch) )
{
send_to_char( "Gazing deeply into the crystal ball, this vision enters 
your mind....", ch);
send_to_char( "\n\r", ch);
send_to_char( "{e", ch);
send_to_char( scryer_room->name, ch );
send_to_char( "{x", ch);
send_to_char("\n\r", ch);
send_to_char( scryer_room->description, ch);
send_to_char("\n\r", ch);
show_list_to_char( scryer_room->contents, ch, FALSE, FALSE );
show_char_to_char( scryer_room->people,   ch );
act("$n gazes deeply into the crystal ball.", ch, NULL, NULL, TO_ROOM );
return;
}
}

void look_ball( CHAR_DATA *ch, OBJ_DATA *obj )    /* Voltecs Window code 1998 
*/
{
char             buf[MAX_STRING_LENGTH];
ROOM_INDEX_DATA *scryer_room;   

if ( obj->value[0] == 0 )
{
sprintf(buf, "%s\n\r", obj->description );
send_to_char(buf, ch);
return;
}

scryer_room = get_room_index( obj->value[0] );

if ( scryer_room == NULL )
{
send_to_char( "!!BUG!! Crystal Ball looks into a NULL room! Please 
report!\n\r", ch );
bug( "Crystal Ball %d looks into a null room!!!", 
obj->pIndexData->vnum );
return;
}

if ( !IS_NPC(ch) )
{
send_to_char( "Gazing deeply into the crystal ball, this vision enters 
your mind....", ch);
send_to_char( "\n\r", ch);
send_to_char( "{e", ch);
send_to_char( scryer_room->name, ch );
send_to_char( "{x", ch);
send_to_char("\n\r", ch);
send_to_char( scryer_room->description, ch);
send_to_char("\n\r", ch);
show_list_to_char( scryer_room->contents, ch, FALSE, FALSE );
show_char_to_char( scryer_room->people,   ch );
act("$n gazes deeply into the crystal ball.", ch, NULL, NULL, TO_ROOM );
return;
}
}

void look_window( CHAR_DATA *ch, OBJ_DATA *obj )    /* Voltecs Window code 
1998 */
{
char             buf[MAX_STRING_LENGTH];
ROOM_INDEX_DATA *scryer_room;   

if ( obj->value[0] == 0 )
{
sprintf(buf, "%s\n\r", obj->description );
send_to_char(buf, ch);
return;
}

scryer_room = get_room_index( obj->value[0] );

if ( scryer_room == NULL )
{
send_to_char( "!!BUG!! Window looks into a NULL room! Please 
report!\n\r", ch );
bug( "Window %d looks into a null room!!!", obj->pIndexData->vnum );
return;
}

if ( !IS_NPC(ch) )
{
send_to_char( "Looking through the window you see,", ch);
send_to_char( "\n\r", ch);
send_to_char( "{e", ch);
send_to_char( scryer_room->name, ch );
send_to_char( "{x", ch);
send_to_char("\n\r", ch);
send_to_char( scryer_room->description, ch);
send_to_char("\n\r", ch);
show_list_to_char( scryer_room->contents, ch, FALSE, FALSE );
show_char_to_char( scryer_room->people,   ch );
act("$n looks through the window.", ch, NULL, NULL, TO_ROOM );
return;
}
}

void look_pool( CHAR_DATA *ch, OBJ_DATA *obj )    /* Voltecs Window code 1998 
*/
{
char             buf[MAX_STRING_LENGTH];
ROOM_INDEX_DATA *scryer_room;   

if ( obj->value[0] == 0 )
{
sprintf(buf, "%s\n\r", obj->description );
send_to_char(buf, ch);
return;
}

scryer_room = get_room_index( obj->value[0] );

if ( scryer_room == NULL )
{
send_to_char( "!!BUG!! Scrying Pool looks into a NULL room! Please 
report!\n\r", ch );
bug( "Scrying Pool %d looks into a null room!!!", 
obj->pIndexData->vnum );
return;
}

if ( !IS_NPC(ch) )
{
send_to_char( "Peering into the depths of the scrying pool you 
see......,", ch);
send_to_char( "\n\r", ch);
send_to_char( "{e", ch);
send_to_char( scryer_room->name, ch );
send_to_char( "{x", ch);
send_to_char("\n\r", ch);
send_to_char( scryer_room->description, ch);
send_to_char("\n\r", ch);
show_list_to_char( scryer_room->contents, ch, FALSE, FALSE );
show_char_to_char( scryer_room->people,   ch );
act("$n peers deep into the scrying pool.", ch, NULL, NULL, TO_ROOM );
return;
}
}

void look_scrying( CHAR_DATA *ch, OBJ_DATA *obj )    /* Voltecs Window code 
1998 */
{
char             buf[MAX_STRING_LENGTH];
ROOM_INDEX_DATA *scryer_room;   

if ( obj->value[0] == 0 )
{
sprintf(buf, "%s\n\r", obj->description );
send_to_char(buf, ch);
return;
}

scryer_room = get_room_index( obj->value[0] );

if ( scryer_room == NULL )
{
send_to_char( "!!BUG!! Scrying Pool looks into a NULL room! Please 
report!\n\r", ch );
bug( "Scrying Pool %d looks into a null room!!!", 
obj->pIndexData->vnum );
return;
}

if ( !IS_NPC(ch) )
{
send_to_char( "Peering into the depths of the scrying pool you 
see......,", ch);
send_to_char( "\n\r", ch);
send_to_char( "{e", ch);
send_to_char( scryer_room->name, ch );
send_to_char( "{x", ch);
send_to_char("\n\r", ch);
send_to_char( scryer_room->description, ch);
send_to_char("\n\r", ch);
show_list_to_char( scryer_room->contents, ch, FALSE, FALSE );
show_char_to_char( scryer_room->people,   ch );
act("$n peers deep into the scrying pool.", ch, NULL, NULL, TO_ROOM );
return;
}
}