Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
Old 07-15-2002, 01:19 AM   #21
thelenian
Member
 
Join Date: Apr 2002
Posts: 122
thelenian is on a distinguished road
Add some simple debugging routines..

Substitute the following code where appropriate in your nanny()

[code]
...
if ((race == 0)
|| (send_to_char("Checking if(!race_table[race].pc_race...\n",ch),!race_table [race].pc_race)
|| (IS_GOOD(ch) && send_to_char("Hey, you're good! ;D\n",ch),!race_table[race].good)
|| (IS_NEUTRAL(ch) && send_to_char("Hey, you're neutral! ;|\n",ch),!race_table[race].neutral)
|| (IS_EVIL(ch) && send_to_char("Hey, you're evil! Muahahaha! >;)\n",ch),!race_table[race].evil))
...[/quote]

and post the output you get when attempting chargen again.
thelenian is offline   Reply With Quote
Old 07-20-2002, 08:17 AM   #22
melker
New Member
 
Join Date: Jul 2002
Posts: 20
melker is on a distinguished road
Send a message via AIM to melker
First of all, I wanna apologize for not being able to answer more quickly than this, I've been out of town w/o a connection.

I couldnt even compile those lines...
This is the error messages I get. That's on the stuff I was suppose to try and add to the code.

comm.c: 1786: void value not ignored as it ought to be
comm.c: 1786: warning: left-hand operand of comma expression has no effect
comm.c: 1787: void value not ignored as it ought to be
comm.c: 1787: warning: left-hand operand of comma expression has no effect
comm.c: 1788: void value not ignored as it ought to be
comm.c: 1788:warning: left-hand operand of comma expression has no effect
melker is offline   Reply With Quote
Old 07-20-2002, 08:22 AM   #23
Loriel
Member
 
Join Date: May 2002
Posts: 49
Loriel is on a distinguished road
Please refer to my previous post, and try adding back the code which appears to be missing, and see what happens after that.
Loriel is offline   Reply With Quote
Old 07-20-2002, 08:46 AM   #24
melker
New Member
 
Join Date: Jul 2002
Posts: 20
melker is on a distinguished road
Send a message via AIM to melker
That was just a miss in my copy and paste.
melker is offline   Reply With Quote
Old 07-20-2002, 08:54 AM   #25
Loriel
Member
 
Join Date: May 2002
Posts: 49
Loriel is on a distinguished road
Please post the current version of the 3 blocks of code which you posted earlier at my request - namely the 'if' check which is causing the trouble, and the race_table and pc_race_table entries for one race (eg dwarf) labelled so we can see which is which.
Loriel is offline   Reply With Quote
Old 07-20-2002, 09:00 AM   #26
melker
New Member
 
Join Date: Jul 2002
Posts: 20
melker is on a distinguished road
Send a message via AIM to melker
in comm.c
[code]
case CON_GET_ALIGNMENT;
{
//int Race;
switch ( argument[0] )
{
case '1'; ch->alignment = 1000; break;
case '2'; ch->alignment = 750; break;
case '3'; ch->alignment = 500; break;
case '4'; ch->alignment = 250; break;
case '5'; ch->alignment = 0; break;
case '6'; ch->alignment = -250; break;
case '7'; ch->alignment = -500; break;
case '8'; ch->alignment = -750; break;
case '9'; ch->alignment = -1000; break;
default;
send_to_char("Sorry thats not a valid alignment.\n\r\n\r",ch);
// show_align(ch);
return;
}
[/quote]

in merc.h
[code]
struct race_type
{
char * name; /* call name of the race */
bool pc_race; /* can be chosen by pcs */
long act; /* act bits for the race */
long aff; /* aff bits for the race */
long off; /* off bits for the race */
long imm; /* imm bits for the race */
long res; /* res bits for the race */
long vuln; /* vuln bits for the race */
long shd; /* shd bits for the race */
long form; /* default form flag for the race */
long parts; /* default parts for the race */
bool good;
bool neutral;
bool evil;
};


struct pc_race_type /* additional data for pc races */
{
char * name; /* MUST be in race_type */
char who_name[6];
sh_int points; /* cost in points of the race */
sh_int class_mult[MAX_CLASS]; /* exp multiplier for class, * 100 */
char * skills[5]; /* bonus skills for the race */
sh_int stats[MAX_STATS]; /* starting stats */
sh_int max_stats[MAX_STATS]; /* maximum stats */
sh_int size; /* aff bits for the race */
bool good;
bool neutral;
bool evil;
};
[/quote]

In const.c
[code]
{
"dwarf", TRUE,
0,
AFF_INFRARED,
0,
0,
RES_EARTH|RES_POISON|RES_DISEASE,
VULN_WATER,
SHD_TERRA,
A|H|M|V, A|B|C|D|E|F|G|H|I|J|K,
TRUE, /* Good align */
FALSE, /* neutral align */
FALSE, /* evil align */
},
[/quote]
melker is offline   Reply With Quote
Old 07-20-2002, 09:02 AM   #27
melker
New Member
 
Join Date: Jul 2002
Posts: 20
melker is on a distinguished road
Send a message via AIM to melker
[code]

case CON_GET_ALIGNMENT;
{
//int Race;
switch ( argument[0] )
{
case '1'; ch->alignment = 1000; break;
case '2'; ch->alignment = 750; break;
case '3'; ch->alignment = 500; break;
case '4'; ch->alignment = 250; break;
case '5'; ch->alignment = 0; break;
case '6'; ch->alignment = -250; break;
case '7'; ch->alignment = -500; break;
case '8'; ch->alignment = -750; break;
case '9'; ch->alignment = -1000; break;
default;
send_to_char("Sorry thats not a valid alignment.\n\r\n\r",ch);
// show_align(ch);
return;
}

}
write_to_buffer(d,"\n\r",0);
for ( race = 0; race < MAX_PC_RACE; race++ ) {
do_help( ch, "NANNY_RACES" );
if (IS_GOOD(ch)) {
do_help(ch,"GOOD_RACES");
write_to_buffer(d,"\n\r\n\r",1);
send_to_char( "Enter the name of your desired race; ", ch );
// Uncomment these if you use NiMUD DC(d) = CON_CHAR_GEN_RACE;
d->connected = CON_GET_NEW_RACE;
break;
}
if (IS_NEUTRAL(ch)) {
do_help(ch,"NEUTRAL_RACES");
write_to_buffer(d,"\n\r\n\r",1);
send_to_char( "Enter the name of your desired race; ", ch );
// DC(d) = CON_CHAR_GEN_RACE;
d->connected = CON_GET_NEW_RACE;
break;
}
if (IS_EVIL(ch)) {
do_help(ch,"EVIL_RACES");
write_to_buffer(d,"\n\r\n\r",1);
send_to_char( "Enter the name of your desired race; ", ch );
// DC(d) = CON_CHAR_GEN_RACE;
d->connected = CON_GET_NEW_RACE;
break;
}
}
break;
case CON_GET_NEW_RACE;
one_argument(argument,arg);


if (!strcmp(arg,"help"))
{
argument = one_argument(argument,arg);
if (argument[0] == '\0')
do_help(ch,"race help");
else
do_help(ch,argument);
write_to_buffer(d,
"What is your race (help for more information)? ",0);
break;
}

race = race_lookup(argument);
if ((race == 0)
|| (!race_table[race].pc_race)
|| (IS_GOOD(ch) && !race_table[race].good)
|| (IS_NEUTRAL(ch) && !race_table[race].neutral)
|| (IS_EVIL(ch) && !race_table[race].evil))

ch->race = race;

for (i = 0; i < 5; i++)
{
if (pc_race_table[race].skills[i] == NULL)
break;
group_add(ch,pc_race_table[race].skills[i],FALSE);
}
/* add cost */
ch->pcdata->points = pc_race_table[race].points;
ch->size = pc_race_table[race].size;

write_to_buffer( d, "What is your sex (M/F/N)? ", 0 );
d->connected = CON_GET_NEW_SEX;
break;


case CON_GET_NEW_SEX;
switch ( argument[0] )
{
case 'm'; case 'M'; ch->sex = SEX_MALE;
ch->pcdata->true_sex = SEX_MALE;
break;
case 'f'; case 'F'; ch->sex = SEX_FEMALE;
ch->pcdata->true_sex = SEX_FEMALE;
break;
case 'n'; case 'N'; ch->sex = SEX_NEUTRAL;
ch->pcdata->true_sex = SEX_NEUTRAL;
break;
default;
write_to_buffer( d, "That's not a sex.\n\rWhat IS your sex? ", 0 );
return;
}
[/quote]

Forgot that part in the last message, this is of course in comm.c
melker is offline   Reply With Quote
Old 07-20-2002, 09:09 AM   #28
Loriel
Member
 
Join Date: May 2002
Posts: 49
Loriel is on a distinguished road
I believe that the block in nanny() :
[code] if ((race == 0)
   || (!race_table[race].pc_race)
|| (IS_GOOD(ch) && !race_table[race].good)
|| (IS_NEUTRAL(ch) && !race_table[race].neutral)
   || (IS_EVIL(ch) && !race_table[race].evil))

ch->race = race;
[/quote]

should be

[code] if ((race == 0)
   || (!race_table[race].pc_race)
|| (IS_GOOD(ch) && !race_table[race].good)
|| (IS_NEUTRAL(ch) && !race_table[race].neutral)
   || (IS_EVIL(ch) && !race_table[race].evil))
{
  send_to_char( "Invalid selection.\n\rEnter race name; ", ch );
  return;
}

ch->race = race;
[/quote]
Loriel is offline   Reply With Quote
Old 07-20-2002, 12:04 PM   #29
melker
New Member
 
Join Date: Jul 2002
Posts: 20
melker is on a distinguished road
Send a message via AIM to melker
*sigh* I forgot to copy and paste that line again. I have too much commented out atm.... But those lines do not solve my problem.
melker is offline   Reply With Quote
Old 07-20-2002, 12:14 PM   #30
Loriel
Member
 
Join Date: May 2002
Posts: 49
Loriel is on a distinguished road
I don't think it's possible for anybody else to solve the problem if the code we are given to look at is not the code you are actually running.

Best of luck solving the problem on your own.
Loriel is offline   Reply With Quote
Old 07-20-2002, 05:31 PM   #31
thelenian
Member
 
Join Date: Apr 2002
Posts: 122
thelenian is on a distinguished road
It would really help if you could just post a link to a copy of the actual source files. Reading code outside Emacs or vim is a real PITA to me .
thelenian is offline   Reply With Quote
Old 07-20-2002, 08:29 PM   #32
melker
New Member
 
Join Date: Jul 2002
Posts: 20
melker is on a distinguished road
Send a message via AIM to melker
I'm sorry but I'm not gonna put up my code on the web.
Thanks for trying to assist me with my problem, even tho
we couldnt solve it this time.
melker is offline   Reply With Quote
Old 07-21-2002, 08:49 AM   #33
thelenian
Member
 
Join Date: Apr 2002
Posts: 122
thelenian is on a distinguished road
heh.. found the problem with the snippet I gave you..

This should work:

[code] if ((race == 0)
|| (send_to_char("Checking if(!race_table[race].pc_race...\n",ch),!race_table [race].pc_race)
|| (IS_GOOD(ch) && (send_to_char("Hey, you're good! ;D\n",ch),!race_table[race].good))
|| (IS_NEUTRAL(ch) && (send_to_char("Hey, you're neutral! ;|\n",ch),!race_table[race].neutral))
|| (IS_EVIL(ch) && (send_to_char("Hey, you're evil! Muahahaha! >;)\n",ch),!race_table[race].evil)))[/quote]

I was missing 3 sets of parenthesis.
thelenian is offline   Reply With Quote
Old 07-21-2002, 01:38 PM   #34
Robbert
Member
 
Robbert's Avatar
 
Join Date: Apr 2002
Location: #### Paso, Tx
Posts: 89
Robbert is on a distinguished road
Send a message via ICQ to Robbert Send a message via AIM to Robbert
Hi Melker -

If Thelenian's latest solution doesn't work, just cut and paste those functions which are in question (the nanny, the race_table, and anything else) to a single file post the file here as a code sample. Those functions would not be enough to replicate your entire sourcecode, nor would they likely function as standalones were someone stupid enough to 'steal' them and paste them into their own source.

Along with that, would you please post a restatement of the specific problem you're having and the desired result you want to achieve. I think I'm not alone in saying that, in light of the amount of responses here, it would benefit everyone to see this reiteration.
Robbert is offline   Reply With Quote
Old 07-22-2002, 01:44 PM   #35
melker
New Member
 
Join Date: Jul 2002
Posts: 20
melker is on a distinguished road
Send a message via AIM to melker
Answer to thelenien:

I tried it and this is what I got when I picked good align and a evil aligned race...Demon.

Checking if(!race_table[race].pc_race...
Hey, you're good!
What is your sex (M/F/N)?
melker is offline   Reply With Quote
Old 07-22-2002, 01:53 PM   #36
melker
New Member
 
Join Date: Jul 2002
Posts: 20
melker is on a distinguished road
Send a message via AIM to melker
My code in the nanny part in comm.c
[code]
case CON_GET_ALIGNMENT;
{
//int Race;
switch ( argument[0] )
{
case '1'; ch->alignment = 1000; break;
case '2'; ch->alignment = 750; break;
case '3'; ch->alignment = 500; break;
case '4'; ch->alignment = 250; break;
case '5'; ch->alignment = 0; break;
case '6'; ch->alignment = -250; break;
case '7'; ch->alignment = -500; break;
case '8'; ch->alignment = -750; break;
case '9'; ch->alignment = -1000; break;
default;
send_to_char("Sorry thats not a valid alignment.\n\r\n\r",ch);
// show_align(ch);
return;
}
}
write_to_buffer(d,"\n\r",0);
for ( race = 0; race < MAX_PC_RACE; race++ ) {
do_help( ch, "NANNY_RACES" );
if (IS_GOOD(ch)) {
do_help(ch,"GOOD_RACES");
write_to_buffer(d,"\n\r\n\r",1);
send_to_char( "Enter the name of your desired race; ", ch );
// Uncomment these if you use NiMUD DC(d) = CON_CHAR_GEN_RACE;
d->connected = CON_GET_NEW_RACE;
break;
}
if (IS_NEUTRAL(ch)) {
do_help(ch,"NEUTRAL_RACES");
write_to_buffer(d,"\n\r\n\r",1);
send_to_char( "Enter the name of your desired race; ", ch );
// DC(d) = CON_CHAR_GEN_RACE;
d->connected = CON_GET_NEW_RACE;
break;
}
if (IS_EVIL(ch)) {
do_help(ch,"EVIL_RACES");
write_to_buffer(d,"\n\r\n\r",1);
send_to_char( "Enter the name of your desired race; ", ch );
// DC(d) = CON_CHAR_GEN_RACE;
d->connected = CON_GET_NEW_RACE;
break;
}
}
break;
case CON_GET_NEW_RACE;
one_argument(argument,arg);


if (!strcmp(arg,"help"))
{
argument = one_argument(argument,arg);
if (argument[0] == '\0')
do_help(ch,"race help");
else
do_help(ch,argument);
write_to_buffer(d,
"What is your race (help for more information)? ",0);
break;
}

race = race_lookup(argument);

if ((race == 0)
|| (send_to_char("Checking if(!race_table[race].pc_race...\n",ch),!race_table [race].pc_race)
|| (IS_GOOD(ch) && (send_to_char("Hey, you're good! ;D\n",ch),!race_table[race].good))
|| (IS_NEUTRAL(ch) && (send_to_char("Hey, you're neutral! ;|\n",ch),!race_table[race].neutral))
|| (IS_EVIL(ch) && (send_to_char("Hey, you're evil! Muahahaha! >;)\n",ch),!race_table[race].evil)))
ch->race = race;

for (i = 0; i < MAX_STATS; i++)
ch->perm_stat[i] = pc_race_table[race].stats[i];
ch->affected_by = ch->affected_by|race_table[race].aff;
ch->shielded_by = ch->shielded_by|race_table[race].shd;
ch->imm_flags = ch->imm_flags|race_table[race].imm;
ch->res_flags = ch->res_flags|race_table[race].res;
ch->vuln_flags = ch->vuln_flags|race_table[race].vuln;
ch->form = race_table[race].form;
ch->parts = race_table[race].parts;

for (i = 0; i < 5; i++)
{
if (pc_race_table[race].skills[i] == NULL)
break;
group_add(ch,pc_race_table[race].skills[i],FALSE);
}
/* add cost */
ch->pcdata->points = pc_race_table[race].points;
ch->size = pc_race_table[race].size;

write_to_buffer( d, "What is your sex (M/F/N)? ", 0 );
d->connected = CON_GET_NEW_SEX;
break;
[/quote]

my race tables in const.c
[code]
{
"demon", "Demon",
6,
{ 200, 200, 175, 130, 200, 200, 175, 150, 175, 175, 175,
170, 170, 140, 105, 170, 170, 140, 125, 140, 140, 140 },
{ "" },
{ 77, 57, 59, 70, 71, 57, 51, 62 },
{ 84, 64, 66, 77, 88, 64, 58, 69 },
SIZE_LARGE,
FALSE, /* Alignment good */
FALSE, /* Alignment neutral */
TRUE /* Alignment evil */
},
{
"dwarf", "Dwarf",
9,
{ 175, 150, 200, 130, 175, 175, 200, 200, 175, 175, 175,
140, 125, 170, 105, 140, 140, 170, 170, 140, 140, 140 },
{ "bash" },
{ 73, 63, 74, 53, 74, 59, 83, 63 },
{ 80, 70, 81, 60, 81, 66, 90, 70 },
SIZE_MEDIUM,
TRUE, /* Alignment good */
TRUE, /* Alignment neutral */
FALSE /* Alignment evil */
},
[/quote]

[code]
{
"demon", TRUE,
0,
0,
0,
0,
RES_FIRE,
VULN_COLD,
SHD_FIRE,
A|H|M|V, A|B|C|D|E|F|G|H|I|J|K,
FALSE, /* Alignment good */
FALSE, /* Alignment neutral */
TRUE /* Alignment evil */
},

{
"dwarf", TRUE,
0,
AFF_INFRARED,
0,
0,
RES_EARTH|RES_POISON|RES_DISEASE,
VULN_WATER,
SHD_TERRA,
A|H|M|V, A|B|C|D|E|F|G|H|I|J|K,
TRUE, /*good*/
FALSE, /*neutral*/
FALSE, /*evil*/
},
[/quote]

I have this in merc.h
[code]
struct race_type
{
char * name; /* call name of the race */
bool pc_race; /* can be chosen by pcs */
long act; /* act bits for the race */
long aff; /* aff bits for the race */
long off; /* off bits for the race */
long imm; /* imm bits for the race */
long res; /* res bits for the race */
long vuln; /* vuln bits for the race */
long shd; /* shd bits for the race */
long form; /* default form flag for the race */
long parts; /* default parts for the race */
bool good;
bool neutral;
bool evil;
};


struct pc_race_type /* additional data for pc races */
{
char * name; /* MUST be in race_type */
char who_name[6];
sh_int points; /* cost in points of the race */
sh_int class_mult[MAX_CLASS]; /* exp multiplier for class, * 100 */
char * skills[5]; /* bonus skills for the race */
sh_int stats[MAX_STATS]; /* starting stats */
sh_int max_stats[MAX_STATS]; /* maximum stats */
sh_int size; /* aff bits for the race */
bool good;
bool neutral;
bool evil;
};
[/quote]

I hope this helps.
melker is offline   Reply With Quote
Old 07-22-2002, 02:07 PM   #37
Loriel
Member
 
Join Date: May 2002
Posts: 49
Loriel is on a distinguished road
No, it doesn't help much.

Yet again you are posting your code showing that you don't have the piece of code I suggested you should add back.

Every time I made the suggestion, you told us the code was really there, you'd just pasted it wrong.

Is that the case again ?
Loriel is offline   Reply With Quote
Old 07-22-2002, 02:23 PM   #38
melker
New Member
 
Join Date: Jul 2002
Posts: 20
melker is on a distinguished road
Send a message via AIM to melker
It's working now, I just forgot to add 1 simple darn line, heheh. Thanks for all the help boys and girls and aliens..
You've been great..it's much appriciated.
melker is offline   Reply With Quote
Reply


Thread Tools


Compile error - Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruby Error NotL337 MUD Coding 2 07-21-2006 11:14 PM
error when trying to compile UnKnOwN MUD Coding 0 04-07-2006 02:53 PM
an error i got UnKnOwN1205 MUD Coding 1 01-09-2005 03:45 PM
Error when Dying Verboden Faction MUD Coding 2 03-25-2003 11:59 PM
Errors crashing compile Sevoric MUD Coding 24 04-28-2002 12:37 PM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 04:53 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2014