12 Jan, 2009, Venrexx wrote in the 1st comment:
Votes: 0
Hey I have been trying to figure something out and I was hoping someone can assist me. I am using a DB Saga SMAUG codebase and I am having an issue with a couple races. You can create a character using the 2 races (majin and mutant) but in score it will say you are a ferett and in mstat it will say your race is #/unknown(eg; Mutant would show up like = ( Class : 31/Mutant Race : 31/Unknown)). Also when I try to use either godset or mset commands to try and change someone to either majin or mutant the game instead turns them into a saiyan (first choosable race). Please help, so far everything I have done has made no effect on it :(
12 Jan, 2009, Sharmair wrote in the 2nd comment:
Votes: 0
From your rather sketchy info I can't tell for sure what the problem is. It would help to have
your pc and npc race and class lists (the npc class and race lists should be in const.c, typing
showrace should give your pc race list, and if you are very lucky, typing showclass might list
your pc classes - the race.lst and class.lst files in the races and classes directory should give
at least the list of pc races and classes you are trying to load if the showxxx commands don't
give the info).

From the info you do give, you could be mixing pc and npc races, confusing race with class or
have added new races incorrectly. The only thing I see that could indicate npc race is the
ferret in score (which is 32 in stock SMAUG 1.4a). And the fact that in your mstat example
you have a class with the same name as you claim is the intended race, and they both use
the same index is the only things that point to a race/class mixup.

But if you are intending the classes to line up with the races, all the info you supplied can be
explained by incorrectly adding new races. Try that showrace command I noted earlier, if the
list has any holes in it (entries that are blank or say unused and are followed by named races)
that is an indicator of the problem. You should look at your race.lst file and check each race
file to make sure each has it's own race number (no repeats) and the numbers go from 0 to
the number of entries in race.lst - 1 (no skips). If you find any repeats or skips, edit the race
number in the files so there are none (you might want to number them the same as the order
in the race.lst file, but be warned that if you change numbers, players might change race -
though you can always reorder in the race.lst). If this is your problem, fixing the numbers
should fix the issues you are having.

As a side note, in stock SMAUG, there is a functional limit of 32 classes as the race uses a 32
bit value for class restriction (there is also the same things with both class and race in the
morph code). Those numbers would be 0 to 31, so if you do have 33 classes (or more), it
might be an issue you will have to look at.
13 Jan, 2009, Venrexx wrote in the 3rd comment:
Votes: 0
Nope I will show you more than that:
In comm.c I Have it set like this -
case CON_GET_NEW_CLASS:
argument = one_argument(argument, arg);
if (is_number(arg))
{
i = atoi(arg);
c = 0;
/*if( i == 0 )
c = 0; // saiyan*/
if( i == 0 )
c = 1; // human
if( i == 1 )
c = 2; // halfbreed
if( i == 2 )
c = 3; // namek
if( i == 3 )
c = 5; // icer
if( i == 4 )
c = 6; // bio
if( i == 5 )
c = 7; // kaio
if( i == 6 )
c = 8; // demon
if( i == 7 )
c = 27; // majin
if( i == 8 )
c = 31; // mutant

And Races look exactly Identical so they mirror each other. In game when you type showrace it shows Mutant at #31 and Majin at #27 (just as shown above in the selection list). in the races files (majin.race and mutant.race) the numbers are also set correctly there, yet I cannot use those races properly because in score and mstat it shows them as either a ferret or a dog and I cannot find where those are being crossed. Although I will try to change their race numbers to something lower and see if that helps any as well… But last time I did do that I was then unable to select them at creation, even after changing the creation values…. Maybe this time I will have more luck, who knows.
13 Jan, 2009, Sharmair wrote in the 4th comment:
Votes: 0
Again, the output from showrace would be very helpful to see just what is going on. But using
this code as a guide to what races you have pretty much confirms the problem I detailed how to
detect and fix in the last post.

I detailed how to look for repeats or skips, and, though you don't seem to have any repeats, you
have a whole lot of skips (4, 9-26 and 28-30 - I am assuming you are using c as the index number).
From what you have here, you seem to have 10 races/classes so the indexes should be 0 to 9 (even
though you have the first one commented out here, I am assuming it actually exists). In case I
did not make it clear in this post or the last, you want NO unused numbers in the range you use
for class/race indexes. When you load classes/races the maximum valid index is related to the
number you load (meaning how many) not the numbers (indexes) themselves. Score will display
npc race if the index is higher then the pc max (and still in the npc range), mstat will show Unknown
(both like you have seen).

With that said, some stock SMAUGs have the code:
/*
* Take this out SHADDAI
*/
for ( iClass = 0; iClass < MAX_PC_CLASS-2; iClass++ )

in the CON_GET_NEW_SEX case of nanny(). This would keep the last two classes from displaying,
but you could still pick them if you knew and used the names (the -2 should be removed to display
all classes). Maybe this has something to do with having problems picking them.

Make sure you fix the numbers and if you still have problems, post your showrace output and we
will go from there. And if you have the other problem of picking the races at creation, we will work
on that.
13 Jan, 2009, Venrexx wrote in the 5th comment:
Votes: 0
I have not modified showrace at all, this as you said may have been the issue but I am having trouble find out how lol the code follows for showrace.
void do_showrace( CHAR_DATA *ch, char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
struct race_type *race;
int ra, i, ct;

set_pager_color( AT_PLAIN, ch );

argument = one_argument( argument, arg1 );

if ( arg1[0] == '\0' )
{
send_to_char( "Syntax: showrace \n\r", ch );
/* Show the races code addition by Blackmane */
/* fixed printout by Miki */
ct = 0;
for ( i = 0;i < MAX_RACE;i++)
{
++ct;
pager_printf(ch, "%2d> %-16s", i, race_table[i]->race_name);
if ( ct % 4 == 0 )
send_to_pager("\n\r", ch );
}
send_to_pager("\n\r", ch );
return ;
}

if ( is_number(arg1) && (ra = atoi(arg1)) >= 0 && ra < MAX_RACE )
race = race_table[ra];
else
{
race = NULL;
for ( ra = 0; ra < MAX_RACE && race_table[ra]; ra++ )
if ( !str_cmp(race_table[ra]->race_name, arg1) )
{
race = race_table[ra];
break;
}
}
if ( !race )
{
send_to_char( "No such race.\n\r", ch );
return ;
}

sprintf( buf, "RACE: %s\n\r", race->race_name);
send_to_char( buf, ch);
ct = 0;
sprintf( buf, "Disallowed Classes: ");
send_to_char( buf, ch);
for (i = 0;i < MAX_CLASS;i++)
{
if ( IS_SET(race->class_restriction, 1 << i) )
{
ct++;
sprintf(buf, "%s ", class_table[i]->who_name);
send_to_char( buf, ch);
if ( ct % 6 == 0)
send_to_char("\n\r", ch);
}
}
if ( (ct % 6 != 0) || (ct == 0))
send_to_char("\n\r", ch);

ct = 0;
sprintf( buf, "Allowed Classes: ");
send_to_char( buf, ch);
for (i = 0;i < MAX_CLASS;i++)
{
if ( !IS_SET(race->class_restriction, 1 << i) )
{
ct++;
sprintf(buf, "%s ", class_table[i]->who_name);
send_to_char( buf, ch);
if ( ct % 6 == 0)
send_to_char("\n\r", ch);
}
}
if ( (ct % 6 != 0) || (ct == 0))
send_to_char("\n\r", ch);



sprintf( buf, "Str Plus: %-3d\tDex Plus: %-3d\tWis Plus: 0\tInt Plus: %-3d\t\n\r",
race->str_plus, race->dex_plus, race->int_plus);
send_to_char( buf, ch);
sprintf( buf, "Con Plus: %-3d\tCha Plus: 0\tLck Plus: %-3d\n\r",
race->con_plus, race->lck_plus);
send_to_char( buf, ch);
sprintf( buf, "Hit Pts: %-3d\tMana: %-3d\tAlign: %-4d\tAC: %-d\n\r",
race->hit, race->mana, race->alignment, race->ac_plus);
send_to_char( buf, ch);
sprintf( buf, "Min Align: %d\tMax Align: %-d\t\tXP Mult: %-d%%\n\r",
race->minalign, race->maxalign, race->exp_multiplier);
send_to_char( buf, ch);
sprintf( buf, "Height: %3d in.\t\tWeight: %4d lbs.\tHungerMod: %d\tThirstMod: %d\n\r",
race->height, race->weight, race->hunger_mod, race->thirst_mod);
send_to_char( buf, ch);

send_to_char( "Affected by: ", ch);
send_to_char( affect_bit_name( &race->affected ), ch);
send_to_char( "\n\r", ch);

send_to_char( "Resistant to: ", ch);
send_to_char( flag_string(race->resist, ris_flags), ch);
send_to_char( "\n\r", ch);

send_to_char( "Susceptible to: ", ch);
send_to_char( flag_string(race->suscept, ris_flags), ch);
send_to_char( "\n\r", ch);

sprintf(buf, "Saves: (P/D) %d (W) %d (P/P) %d (B) %d (S/S) %d\n\r",
race->saving_poison_death,
race->saving_wand,
race->saving_para_petri,
race->saving_breath,
race->saving_spell_staff);
send_to_char( buf, ch);

send_to_char( "Innate Attacks: ", ch);
send_to_char( ext_flag_string(&race->attacks, attack_flags), ch);
send_to_char( "\n\r", ch);

send_to_char( "Innate Defenses: ", ch);
send_to_char( ext_flag_string(&race->defenses, defense_flags), ch);
send_to_char( "\n\r", ch);

}
/*
* quest point set - TRI
* syntax is: qpset char give/take amount
*/

ALSO in game showrace looks like this:
Syntax: showrace
0> Saiyan 1> Human 2> Halfbreed 3> Namek
4> Android 5> Icer 6> Bio-Android 7> Kaio
8> Demon 9> Wizard 10> unused 11> unused
12> unused 13> unused 14> unused 15> unused
16> unused 17> unused 18> unused 19> unused
20> unused 21> unused 22> unused 23> unused
24> unused 25> unused 26> Super-Android 27> Majin
28> Android-h 29> Android-e 30> Android-fm 31> Mutant
32> Saiba 33> unused 34> unused 35> unused
36> unused 37> unused 38> unused 39> unused
13 Jan, 2009, Venrexx wrote in the 6th comment:
Votes: 0
Ok I changes the classes and races numbers and also changed in selection code the new numbers, showrace now looks like this:
0> Saiyan 1> Human 2> Halfbreed 3> Namek
4> Android 5> Icer 6> Bio-Android 7> Kaio
8> Demon 9> Wizard 10> Super-Android 11> Majin
12> Mutant 13> Saiba 14> unused 15> unused
16> unused 17> unused 18> unused 19> unused
20> unused 21> unused 22> unused 23> unused
24> unused 25> unused 26> unused 27> unused
28> unused 29> unused 30> unused 31> unused
32> unused 33> unused 34> unused 35> unused
36> unused 37> unused 38> unused 39> unused
And that code I showed for character selection shows like this now:
i = atoi(arg);
c = 0;
/*if( i == 0 )
c = 0; // saiyan*/
if( i == 0 )
c = 1; // human
if( i == 1 )
c = 2; // halfbreed
if( i == 2 )
c = 3; // namek
if( i == 3 )
c = 4; // Android
if( i == 4 )
c = 5; // Icer
if( i == 5 )
c = 6; // Bio-Android
if( i == 6 )
c = 7; // Kaio
if( i == 7 )
c = 8; // Demon
if( i == 8 )
c = 11; // Majin
if( i == 9 )
c = 12; // Mutant

The only problem I have no is Android, Majin and Mutant races are not showing up in character creation now and most of the races you choose during creation start you as the wrong race from what you selected.
14 Jan, 2009, Venrexx wrote in the 7th comment:
Votes: 0
ALSO I looked into that code you said:
/*
* Take this out SHADDAI
*/
for ( iClass = 0; iClass < MAX_PC_CLASS-2; iClass++ )

The ones I found showed they were nulled out already and haven't played a role in that in awhile, so I am back to square 1…
14 Jan, 2009, Sharmair wrote in the 8th comment:
Votes: 0
I was not implying there was anything wrong with the showrace command, Using it as a tool
to get the list of the races showed the holes (all those unused between active races) that should
be fixed. I see you did fix that and that part of your problem should be fixed. The classes have
the same rules as far as 'holes' too, but the showclass command might not have the list option
(stock does not have it, but some derived code does). Though, from what I can tell, that is not
your problem with the create.

In normal SMAUG the create code uses the data from the races and classes to show the lists of
what you can pick, and validate your input, and it is all automatic. The only thing you have to
worry about is that the classes and races exist and the race's class restriction is set right (a
change in the numbers would require resetting the class restriction). From the code you show
here, you seem to be hard coding the picking, so you might have disabled the auto part of the
code. To really see what you are doing, it would be helpful if you showed all the code in nanny()
related to class and race (in stock, that is the CON_GET_NEW_SEX, CON_GET_NEW_CLASS and
CON_GET_NEW_RACE cases).
14 Jan, 2009, Venrexx wrote in the 9th comment:
Votes: 0
Here are the code snippets you are looking for to the best of my knowledge.
send_to_desc_color( "\n\r&WWhat is your sex &Y(&CM&Y/&PF&Y/&WN&Y)&W? &D", d );
d->connected = CON_GET_NEW_SEX;
break;

case CON_GET_NEW_SEX:
switch ( argument[0] )
{
case 'm': case 'M': ch->sex = SEX_MALE; break;
case 'f': case 'F': ch->sex = SEX_FEMALE; break;
case 'n': case 'N': ch->sex = SEX_NEUTRAL; break;
default:
send_to_desc_color( "&RThat's not a sex.\n\r&RWhat IS your sex? &D", d );
return;
}

send_to_desc_color( "&RSaiyans are currently a quest/rp race help saiyans for more details\n\r&D",d);
send_to_desc_color( "&r==============================================================================&D",d);
sprintf( buf, "\n\r&OChoose the number of your race&Y: &D" );
send_to_desc_color( buf, d );
d->connected = CON_GET_NEW_CLASS;
break;

case CON_GET_NEW_CLASS:
argument = one_argument(argument, arg);
if (is_number(arg))
{
i = atoi(arg);
c = 0;
/*if( i == 0 )
c = 0; // saiyan*/
if( i == 0 )
c = 1; // human
if( i == 1 )
c = 2; // halfbreed
if( i == 2 )
c = 3; // namek
if( i == 3 )
c = 4; // Android
if( i == 4 )
c = 5; // Icer
if( i == 5 )
c = 6; // Bio-Android
if( i == 6 )
c = 7; // Kaio
if( i == 7 )
c = 8; // Demon
if( i == 8 )
c = 11; // Majin
if( i == 9 )
c = 12; // Mutant
/*for ( iClass = 0; iClass < MAX_PC_CLASS; iClass++ )*/
//for ( iClass = 0; iClass < 9; iClass++ )
for ( iClass = 1; iClass < 32; iClass++ )
{
// Edited by Karn - dbsdevelop.com
if( iClass > 8 && iClass < 27 )
continue;
if ( class_table[iClass]->who_name &&
class_table[iClass]->who_name[0] != '\0' )
{
//if ( i == iClass )
if( c == iClass )
{
ch->class = iClass;
ch->race = iClass;
break;
}
}
}
}
else
{
//char letters[11] = "abcdefghij";
// char letters[14] = "abcdefghijklmno";
for (i=0;i<14;i++)
{
if (arg[0] == letters[i] )
{
int c = i;
/*if( i == 0 )
c = 0; // saiyan*/
if( i == 0 )
c = 1; // human
if( i == 1 )
c = 2; // halfbreed
if( i == 2 )
c = 3; // namek
if( i == 3 )
c = 4; // Android
if( i == 4 )
c = 5; // Icer
if( i == 5 )
c = 6; // Bio-Android
if( i == 6 )
c = 7; // Kaio
if( i == 7 )
c = 8; // Demon
if( i == 8 )
c = 11; // Majin
if( i == 9 )
c = 12; // Mutant
if(!str_cmp(class_table[c]->who_name,"android") )
sprintf(buf, "android");
else
sprintf(buf, "%s", class_table[c]->who_name);
do_help(ch, buf);
return;
}
}

There is no extry called CON_GET_NEW_RACE except a single insert in mud.h and all it says is CON_GET_NEW_RACE in a list.
15 Jan, 2009, Sharmair wrote in the 10th comment:
Votes: 0
I don't see here where you display the list to the player, but I will assume it is a list of ten
races from human to mutant with numbers to enter from 0 to 9. And also, it is VERY important
in this code that your race and class numbers match up. To make sure, I would make sure
the class number in the class file is the same as the race number in the race file of the same
name.
With that said, your problem is probably (at least part of it) this:
if( iClass > 8 && iClass < 27 )
continue;

And I would remove that. There is also a number of other things in the code that are unneeded
or a bit suspect. There does not seem to be any check for invalid number, and if a number other
then 0 to 9 is entered, it will just leave class and race whatever they were started at (in stock it
is race 0 and class 3). You really could get by without the iClass for and just use something like:
c = 12; // Mutant
if(c == 0){
//code here to tell player the input was invalid
return;
}
ch->class = c;
ch->race = c;
}

Note: the last line here is line 55 in your code, the } before the else.
Leaving the for in would not really cause problems, and even does check for incomplete classes.
But, if you do leave it in, I still would add the check for invalid input and probably replace the 32
with MAX_PC_CLASS.

The help part of the code seems to comment out both defines of letters[], so it better be defined
as at least a 14 char array someplace else. And the code:
if(!str_cmp(class_table[c]->who_name,"android") )
sprintf(buf, "android");
else
sprintf(buf, "%s", class_table[c]->who_name);

could be replaced with the one line:
strcpy(buf, class_table[c]->who_name);

But it is not a bug, just a cleaner way of doing it. I should also note here that using the buffer
(buf) in the call to do_help() is the CORRECT way of doing that.
Anyway, I hope this helps and I have not confused you too much with the more minor details
(that I could go on about).
15 Jan, 2009, Venrexx wrote in the 11th comment:
Votes: 0
I will start by saying there already is a code to tell you if it is invalid number for input during racial selection later on in the code :)
I have figured it out and your help was the cause to the solution. I had almost lost hope when I found ANOTHER string in the code that I changed, I will list the steps that helped me.
First I found this:
if( iClass == 4 )
{
i++;
continue;

I commented that out and It made Class/Race 4 available which is android. Then I changed around the race numbers (the ones that are still in prototype and not available being last) and edited this line:
if( iClass > 8 && iClass < 27 )

and I changed this line to look like this:
if( iClass > 10 && iClass < 27 )

This freed up what is now races 9 and 10 (mutant and majin) and has set thjem selectable. I have a few colors off but that is also easy to fix. Thank you so much for all your help; also… I did all you told me to do before and it seems that modifying character selections has become alot easier, thanks for the snippet help man, truly appreciated :D
0.0/11