18 Jan, 2009, Venrexx wrote in the 1st comment:
Votes: 0
First I will start off by saying that I didn't do ANYTHING to this code and now it just won't work properly and I cannot figure out why. If someone were to type (example) redit bexit n 12001 you would get:

Build: Venrexx: redit bexit n 12001
Create, change or remove a two-way exit.
Usage: redit bexit <dir> [room] [flags] [key] [keywords]

Instead of it actually adding the room, it does the same thing with redit exit and I cannot figure out why this has all of a sudden started happening. The code that involves bexit is below, any help would be appreciated… but please bear in mind I am not the greatest coder in the world..
if ( !str_cmp( arg, "bexit" ) )
{
EXIT_DATA *xit, *rxit;
char tmpcmd[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *tmploc;
int vnum, exnum;
char rvnum[MAX_INPUT_LENGTH];
bool numnotdir;

argument = one_argument( argument, arg2 );
argument = one_argument( argument, arg3 );
if ( !arg2[0] == '\0' )
{
send_to_char( "Create, change or remove a two-way exit.\n\r", ch );
send_to_char( "Usage: redit bexit <dir> [room] [flags] [key] [keywords]\n\r", ch );
return;
}
numnotdir = FALSE;
switch( arg2[0] )
{
default:
edir = get_dir( arg2 );
break;
case '#':
numnotdir = TRUE;
edir = atoi( arg2+1 );
break;
case '+':
edir = get_dir( arg2+1 );
break;
}
tmploc = location;
exnum = edir;
if ( numnotdir )
{
if ( (xit = get_exit_num(tmploc, edir)) != NULL )
edir = xit->vdir;
}
else
xit = get_exit(tmploc, edir);
rxit = NULL;
vnum = 0;
rvnum[0] = '\0';
if ( xit )
{
vnum = xit->vnum;
if ( arg3[0] != '\0' )
sprintf( rvnum, "%d", tmploc->vnum );
if ( xit->to_room )
rxit = get_exit(xit->to_room, rev_dir[edir]);
else
rxit = NULL;
}
sprintf( tmpcmd, "exit %s %s %s", arg2, arg3, argument );
do_redit( ch, tmpcmd );
if ( numnotdir )
xit = get_exit_num(tmploc, exnum);
else
xit = get_exit(tmploc, edir);
if ( !rxit && xit )
{
vnum = xit->vnum;
if ( arg3[0] != '\0' )
sprintf( rvnum, "%d", tmploc->vnum );
if ( xit->to_room )
rxit = get_exit(xit->to_room, rev_dir[edir]);
else
rxit = NULL;
}
if ( vnum )
{
sprintf( tmpcmd, "%d redit exit %d %s %s",
vnum,
rev_dir[edir],
rvnum,
argument );
do_at( ch, tmpcmd );
}
return;
}
18 Jan, 2009, Igabod wrote in the 2nd comment:
Votes: 0
The code looks fine to me but I'm not all that familiar with Smaug. If there is a problem I would think it's somewhere between line 10 and 17 of that piece of code you gave. Only other thing I can think of is maybe you are supposed to type out the direction fully not just the abbreviated form. example: redit bexit north 12001. Sorry if this isn't any help, like I said, I'm not a smaug guy.

On a side note, isn't it funny that abbreviate is such a long word?

[edit to add] just saw the rest of the subject line. Don't let little problems like these turn you away from mudding, sure constantly running into little problems is frustrating as hell, but that's how we learn. I'm sure somebody here will be able to help you out with just about any problem you could run into. Just keep hacking away at the code and don't lose faith.
18 Jan, 2009, tphegley wrote in the 3rd comment:
Votes: 0
Did you change anything with redit? 54 and 55 might be the culprit.
18 Jan, 2009, Zeno wrote in the 4th comment:
Votes: 0
Use gdb when that function is called. Print what arg2.
18 Jan, 2009, Keberus wrote in the 5th comment:
Votes: 0
if ( !arg2[0] == '\0' )


That looks wrong to me
try:
if ( arg2[0] == '\0' )


It should just be checking the zeroth character of arg2. I don't know what the hell the check above would do.
18 Jan, 2009, Igabod wrote in the 6th comment:
Votes: 0
Ah keberus got it I think. It's little things like that that trip me up all the time. The code as it is says if arg2 isn't null then it'll return the usage message. It should be if arg2 IS null return the usage message. Damn those little one character errors.
18 Jan, 2009, Sharmair wrote in the 7th comment:
Votes: 0
Keberus said:
if ( !arg2[0] == '\0' )


That looks wrong to me
try:
if ( arg2[0] == '\0' )


It should just be checking the zeroth character of arg2. I don't know what the hell the check above would do.

It would look at the first char of arg2 then evaluate the left side as TRUE (1) if the char is NUL (empty
string) or FALSE (0) if it is not empty, then compare that to 0. So, the whole thing would be TRUE if
the string is NOT empty and FALSE if it is empty, the complete reverse of what it should be.

The code here is the same as stock SMAUG 1.4a other then this line (and this is in fact the problem).
The line in stock is:
if ( !arg2 || arg2[0] == '\0' )

Which in itself is a bit odd. !arg2 is ALWAYS going to be FALSE as it is an array.
Other then the line like Keberus suggested, you could also use:
if( !*arg2 )

Both do the same thing, so it is just personal preference.
18 Jan, 2009, Venrexx wrote in the 8th comment:
Votes: 0
if ( arg2[0] == '\0' )

Did not work :(
if( !*arg2 )

Also Did not Work
no the only thing I changed in redit is the line listed below:
if ( !arg2 || arg2[0] == '\0' )

Changed that above to this below
if ( !arg2[0] == '\0' )

Which is now…:
if ( arg2[0] == '\0' )

[Edit] Ok I have solved the issue and I will tell all how incase anyone else comes across this issue with a similar codebase. What I did was I copied the "exit" and "bexit" snippets from SmaugFUSS and only had to change ONE thing to make it work 100% perfect without any compile warnings.
if( evnum < 1 || evnum > MAX_VNUM )

Changed the above code to the one below lol
if( evnum < 1 || evnum > MAX_VNUMS )

Thats right, as little as a change as it were it saved all my building problems, BUT as I look though all of this you guys were right, The above lines I listed before had to be changed anyways as they were causing issues, infact the issue was in more lines that I think any of us knew. Thank you all SO much for your help, it's this great help that keeps me coming back here anytime I need assistance :D
-Venrexx
18 Jan, 2009, Keberus wrote in the 9th comment:
Votes: 0
You canged it, and it still does the exact same thing?
18 Jan, 2009, Venrexx wrote in the 10th comment:
Votes: 0
As I posted above your recent post (edited while you were typing :P lol) I had resolved the issue and like usual your fix was very helpful. Thanks a ton man :D
18 Jan, 2009, Keberus wrote in the 11th comment:
Votes: 0
Glad we could help
18 Jan, 2009, Venrexx wrote in the 12th comment:
Votes: 0
Have to admit though, ever since I had first started asking for help here I have been improving quite a bit and I am fairly proud of that :D lol
18 Jan, 2009, Igabod wrote in the 13th comment:
Votes: 0
That's why Keb was made part of the smaugfuss team, he knows what he's doing.
0.0/13