29 Aug, 2009, boblinski wrote in the 61st comment:
Votes: 0
Hi all.. here's my newest issue:

Entire code segment (from magic2.c):
//Undead barricade.. call_bonewall in ability.c
void spell_bonewall( int sn, int level, CHAR_DATA *ch, void *vo, int target )
{
EXIT_DATA *pexit;
ROOM_INDEX_DATA *room1;
ROOM_INDEX_DATA *room2;
char arg1[MAX_INPUT_LENGTH];
int door1, door2;
int wall1, wall2;
bool dual_walls = TRUE;

target_name = one_argument(target_name, arg1);

if (arg1 == NULL || arg1 == "\0")
{
send_to_char ("In which direction would you like to cast this bonewall?\r\n");
return;
}

//not for npc's
if (IS_NPC (ch))
{
return;
}

if (!str_prefix (arg1, "north"))
{
door1 = DIR_NORTH;
door2 = DIR_SOUTH;
wall1 = BONEWALL_DIR_NORTH;
wall2 = BONEWALL_DIR_SOUTH;
}
else if (!str_prefix (arg1, "east"))
{
door1 = DIR_EAST;
door2 = DIR_WEST;
wall1 = BONEWALL_DIR_EAST;
wall2 = BONEWALL_DIR_WEST;
}
else if (!str_prefix (arg1, "south"))
{
door1 = DIR_SOUTH;
door2 = DIR_NORTH;
wall1 = BONEWALL_DIR_SOUTH;
wall2 = BONEWALL_DIR_NORTH;
}
else if (!str_prefix (arg1, "west"))
{
door1 = DIR_WEST;
door2 = DIR_EAST;
wall1 = BONEWALL_DIR_WEST;
wall2 = BONEWALL_DIR_EAST;
}
else if (!str_prefix (arg1, "up"))
{
door1 = DIR_UP;
door2 = DIR_DOWN;
wall1 = BONEWALL_DIR_UP;
wall2 = BONEWALL_DIR_DOWN;
}
else if (!str_prefix (arg1, "down"))
{
door1 = DIR_DOWN;
door2 = DIR_UP;
wall1 = BONEWALL_DIR_DOWN;
wall2 = BONEWALL_DIR_UP;
}
else
{
send_to_char ("That is not a direction.\n\r", ch);
return;
}

room1 = ch->in_room;

//no exit from room1
if ((pexit = ch->in_room->exit[door1]) == NULL
|| (room2 = get_room_index (pexit->u1.to_room->vnum)) == NULL)
{
send_to_char ("No one can go there anyway.\n\r", ch);
return;
}

//no exit from room2
if ( (!room1->exit[door1]) || (!room2->exit[door2]) )
{
dual_walls = FALSE;
}

//already wall1 in room1
if (get_mob_vnum_room(ch, wall1))
{
send_to_char("There is already an undead barricade constructed in that direction!\r\n", ch);
return;
}

//already wall2 in room2 START
char_from_room( ch );
char_to_room( ch, room2 );
if (get_mob_vnum_room(ch, wall2))
{
dual_walls = FALSE;
}
char_from_room( ch );
char_to_room( ch, room1 );


//call mobs.
if (dual_walls)
{
call_bonewall (ch, wall1, room1);
call_bonewall (ch, wall2, room2);
}
else
call_bonewall (ch, wall1, room1);

return;
}


It compiles fine, and everything works real good.. except if there is no "target" direction given.. it doesn't work properly…

Problem piece:
target_name = one_argument(target_name, arg1);

if (arg1 == NULL || arg1 == "\0")
{
send_to_char ("In which direction would you like to cast this bonewall?\r\n");
return;
}


It doesn't "send_to_char ("In which direction……etc", and instead continues and ends up targeting 'north'…

Any suggestions?
30 Aug, 2009, Kline wrote in the 62nd comment:
Votes: 0
For one check:
arg1[0] == '\0'


And where is "target_name" coming from? Is it just a floating variable within your spells file? I don't see it being passed into that function anyplace.
30 Aug, 2009, boblinski wrote in the 63rd comment:
Votes: 0
At the top of magic2.c:
extern char *target_name;


Thanks for the fix on that one Kline, seems to be working now!
60.0/63