SmaugWiz_Rdig.txt
Zanthoris Snippets/SmaugWiz_Rdig.txt · 3.8 KB
From the archive Zanthoris Snippets.zip
Download the archive « Back to the archive contents
Rdig Command
Original author: Mark Mealman(Dracones)
Port to SmaugWiz by Zanthoris
Installation Instructions
-------------------------
1. In smaug.h look for:
DECLARE_DO_FUN(do_rdelete);
add this line after it:
DECLARE_DO_FUN(do_rdig);
2. In skills.cpp look for:
if (!str_cmp (name, "do_rdelete")) return do_rdelete;
and after it add this line:
if (!str_cmp( name, "do_rdig")) return do_rdig;
also in skills.cpp look for:
if (skill == do_rdelete) return "do_rdelete";
and add:
if ( skill == do_rdig ) return "do_rdig";
3. In build.cpp add this new function:
/* rdig command by Dracones */
/* Ported to SmaugWiz by Zanthoris on 11/08/2000 */
void do_rdig( CCharacter *ch, char *argument )
{
char arg [MAX_INPUT_LENGTH];
char buf [MAX_STRING_LENGTH];
CRoomIndexData *location, *ch_location;
CAreaData *pArea;
int vnum, edir;
char tmpcmd[MAX_INPUT_LENGTH];
CExitData *xit;
set_char_color( AT_PLAIN, ch );
ch_location = ch->GetInRoom();
argument = one_argument( argument, arg );
if ( !arg || arg[0] == '\0' )
{
ch->SendText( "Dig out a new room or dig into an existing room.\n\r");
ch->SendText( "Usage: rdig <dir>\n\r");
return;
}
edir = get_dir( arg );
xit = get_exit( ch_location, edir );
if ( !xit )
{
pArea = ch->GetArea();
vnum = pArea->low_r_vnum;
while(vnum <= pArea->hi_r_vnum && RoomTable.GetRoom(vnum) != NULL)
vnum++;
if(vnum > pArea->hi_r_vnum)
{
ch->SendText("No empty upper rooms could be found.\r\n");
return;
}
sprintf( buf, "Digging out room %d to the %s.\r\n", vnum, arg);
ch->SendText(buf);
location = make_room(vnum);
if ( !location )
{
bug( "rdig: make_room failed", 0 );
return;
}
location->SetArea(ch->GetArea());
sprintf( tmpcmd, "bexit %s %d", arg, vnum );
do_redit( ch, tmpcmd );
}
else
{
vnum = xit->vnum;
location = RoomTable.GetRoom(vnum);
sprintf( buf, "Digging into room %d to the %s.\r\n", vnum, arg);
ch->SendText(buf);
}
location->SetName(ch_location->GetName());
location->SetDescription (ch_location->GetDescription());
location->sector_type = ch_location->sector_type;
location->SetRoomFlags(ch_location->GetRoomFlags());
/* Move while rdigging -- Dracones */
sprintf(buf, "%d", vnum);
do_goto( ch, buf);
return;
}
4. Make clean, then recompile.
5. Create an rdig command, setting it to the desired level or just put the following
in your commands.dat file:
#COMMAND
Name rdig~
Code do_rdig
Position 100
Level 60
Log 3
End
command usage: rdig <dir>
This code allows builders to quickly "dig" new rooms or room
exits without having to use the goto command.
New rooms are created using the current room's statistics for name,
description, flags, and sector type.
rdig can also "dig" into existing rooms, in which case the above
statistics for the existing room are rewritten.
WARNING: This command has _no_ checks in place for security. Also this command
uses the character's assigned edit room range(pArea) when creating new rooms,
so you should only use this command in your build-zone.
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
This snippet was written for and tested on SmaugWiz version 2.01, I cannot guarantee that
it will work in previous versions without some modification (though I expect it will). If
you have problems with this snippet let me know!
-=Zanthoris=-
zanthoris@hotmail.com
telnet:\\zanthoris.dhs.org:4000
http:\\zanthoris.home.dhs.org