17 Oct, 2008, canoffruitpunch wrote in the 1st comment:
Votes: 0
Hello I am fairly new to C coding but I have some knowledge in VB.net and ASP.net…that knowledge has helped me minimally with C though lol.

I have recently added a snippet for the remort option. It has compiled fine but the problem is everytime I start the MUD I have to hotboot it to use the command! It is very strange but I am not sure why it is not saving…I'm not even sure what code I should go ahead and show you.

My other problem is that I have tried adding a way for players to "store" their level once they remort showing what their cumulative level is but still reverts their "regular" level to 1. Well my problem is that it keeps saying that the players stored level is 2 and on every hotboot it erases their stored level bringing it back to level 0.

Here is the code I had added within the function of do_remort.
//now for the fun, lets begin this process….  
act(AT_WHITE, "$n starts to glow white as $e starts to remort into %s new body.", ch, NULL, NULL, TO_ROOM);
ch_printf(ch, "You are now remorting, you will lose all your equipment and stats and start over as\n\ryour new race and class.\n\r");
ch_printf(ch, "You are now remorting, you will lose all your equipment and stats and start over as\n\ryour new class.\n\r");

d = ch->desc;
oldch = ch;
d->character->desc = NULL;
d->character = NULL;
load_char_obj(d, capitalize( oldch->name ), TRUE, FALSE);
ch = d->character;
DISPOSE( ch->pcdata->pwd );
ch->pcdata->pwd = str_dup( oldch->pcdata->pwd );
DISPOSE( ch->pcdata->rank );
ch->pcdata->rank = str_dup( oldch->pcdata->rank );
set_title( ch, oldch->pcdata->title );
ch->race = oldch->race;
ch->race = iRace;
ch->Class = iClass;
ch->pcdata->tier = 2;
ch->max_hit = 20; /* Max HP/Mana/Move is stock, if you need something different change it – Xerves */
ch->hit = ch->max_hit;
ch->max_mana = 100;
ch->mana = ch->max_mana;
ch->max_move = 100;
ch->move = ch->max_move;
ch->gold = 0;
ch->pcdata->favor = 0;
ch->practice = 0;
//Below is what is in comm.c when you first create a character, replace with any info you might have
//or removed. – Xerves

//Change these two lines if you don't want them in their own clan.
ch->pcdata->clan_name = STRALLOC( oldch->pcdata->clan_name );
ch->pcdata->clan = oldch->pcdata->clan;

//Smaug 1.4a code
switch ( class_table[ch->Class]->attr_prime )
case APPLY_STR: ch->perm_str = 16; break;
case APPLY_INT: ch->perm_int = 16; break;
case APPLY_WIS: ch->perm_wis = 16; break;
case APPLY_DEX: ch->perm_dex = 16; break;
case APPLY_CON: ch->perm_con = 16; break;
case APPLY_CHA: ch->perm_cha = 16; break;
case APPLY_LCK: ch->perm_lck = 16; break;

ch->perm_str += race_table[ch->race]->str_plus;
ch->perm_int += race_table[ch->race]->int_plus;
ch->perm_wis += race_table[ch->race]->wis_plus;
ch->perm_dex += race_table[ch->race]->dex_plus;
ch->perm_con += race_table[ch->race]->con_plus;
ch->perm_cha += race_table[ch->race]->cha_plus;
ch->affected_by = race_table[ch->race]->affected;
ch->perm_lck += race_table[ch->race]->lck_plus;

ch->armor += race_table[ch->race]->ac_plus;
ch->alignment += race_table[ch->race]->alignment;
ch->attacks = race_table[ch->race]->attacks;
ch->defenses = race_table[ch->race]->defenses;
ch->saving_poison_death = race_table[ch->race]->saving_poison_death;
ch->saving_wand = race_table[ch->race]->saving_wand;
ch->saving_para_petri = race_table[ch->race]->saving_para_petri;
ch->saving_breath = race_table[ch->race]->saving_breath;
ch->saving_spell_staff = race_table[ch->race]->saving_spell_staff;

/* ch->height = number_range(race_table[ch->race]->height *.9, race_table[ch->race]->height *1.1);
ch->weight = number_range(race_table[ch->race]->weight *.9, race_table[ch->race]->weight *1.1);*/

//For Paladin's alignment, remove if you have no paladin or don't use this anymore
if ( ch->Class == CLASS_PALADIN )
ch->alignment = 1000;

if ( (iLang = skill_lookup( "common" )) < 0 )
bug( "Nanny: cannot find common language." );
ch->pcdata->learned[iLang] = 100;

for ( iLang = 0; lang_array[iLang] != LANG_UNKNOWN; iLang++ )
if ( lang_array[iLang] == race_table[ch->race]->language )
if ( lang_array[iLang] == LANG_UNKNOWN )
bug( "Nanny: invalid racial language." );
if ( (iLang = skill_lookup( lang_names[iLang] )) < 0 )
bug( "Nanny: cannot find racial language." );
ch->pcdata->learned[iLang] = 100;

//You can uncomment that if you want, It gives stats based on your name, I think it is useless and stupid – Xerves
//name_stamp_stats( ch );

//Remove these if your stats are different and allow more than 9-18 naturally
ch->perm_str = UMIN( 18, ch->perm_str );
ch->perm_wis = UMIN( 18, ch->perm_wis );
ch->perm_dex = UMIN( 18, ch->perm_dex );
ch->perm_int = UMIN( 18, ch->perm_int );
ch->perm_con = UMIN( 18, ch->perm_con );
ch->perm_cha = UMIN( 18, ch->perm_cha );
ch->perm_lck = UMIN( 18, ch->perm_lck );
ch->perm_str = UMAX( 9, ch->perm_str );
ch->perm_wis = UMAX( 9, ch->perm_wis );
ch->perm_dex = UMAX( 9, ch->perm_dex );
ch->perm_int = UMAX( 9, ch->perm_int );
ch->perm_con = UMAX( 9, ch->perm_con );
ch->perm_cha = UMAX( 9, ch->perm_cha );
ch->perm_lck = UMAX( 9, ch->perm_lck );

ch->store_level += ch->level;
ch->exp = exp_level(ch, 2);
ch->max_hit += race_table[ch->race]->hit;
ch->max_mana += race_table[ch->race]->mana;
ch->hit = UMAX(1,ch->max_hit);
ch->mana = UMAX(1,ch->max_mana);
ch->move = ch->max_move;

I thank everyone on here for their help!
17 Oct, 2008, David Haley wrote in the 2nd comment:
Votes: 0
I'm not sure why you'd have to hotboot to enable a command. That said, about this:
Well my problem is that it keeps saying that the players stored level is 2 and on every hotboot it erases their stored level bringing it back to level 0.

It sounds like you're just not saving or loading it correctly? When you added the field did you add code to deal with that?
17 Oct, 2008, Vassi wrote in the 3rd comment:
Votes: 0
Also, hopefully there will be a C# MUD driver you can extend with VB.NET some day =\
17 Oct, 2008, canoffruitpunch wrote in the 4th comment:
Votes: 0
I've added the following code to…

KEY( "Stored Level", ch->store_level, fread_number( fp ) );

fprintf( fp, "Stored Level        %d\n", ch->store_level );

ch->store_level = 0;

and I have this in struct char_data
short store_level;

I think I have it all in the right spots…but the biggest problem killing me is the hotboot issue. It seems weird after a clean compile that I have to go on and hotboot? Is there any code you could think of effecting this? Thank you for your help!
17 Oct, 2008, canoffruitpunch wrote in the 5th comment:
Votes: 0
Ok I got the hotboot/startup problem fixed but I don't understand what the problem was? All I did was go into my area folder and delete the old startup script and replace it with a new one (I'm using Cygwin) and now I don't have to hotboot every startup. If anyone could explain why that problem was for learning reasons I would be most appreciative.

It's still not storing my levels though…I just remorted a level 10,000 charector and it says his stored level is only 2 still! during a hotboot I get
A puff of ethereal smoke dissipates around you!
Comm: Loading player data for: Test (1K)
Log: [*****] BUG: fread_char: no match: Stored
Log: [*****] FILE: ../player/t/Test LINE: 10
Test appears in a puff of ethereal smoke!
Log: Hotboot recovery complete.

But I thought I had everything added to fread_char! so it reverts the level to 0 ><

Thanks again guys (and girls?)
17 Oct, 2008, MacGregor wrote in the 6th comment:
Votes: 0
The key used in the KEY macro was read with fread_word(), and "Stored Level" is two words. Change it to StoredLevel and it'll work.
17 Oct, 2008, kiasyn wrote in the 7th comment:
Votes: 0
canoffruitpunch said:
I've added the following code to…

KEY( "Stored Level", ch->store_level, fread_number( fp ) );

fprintf( fp, "Stored Level        %d\n", ch->store_level );

it wont like spaces
17 Oct, 2008, canoffruitpunch wrote in the 8th comment:
Votes: 0
Thanks guys I will change this when I get home and let you know how it worked out…I'm in class right now and I gotta go! (Got a big web project coming up)
17 Oct, 2008, Lobotomy wrote in the 9th comment:
Votes: 0
Good luck with your projects. :smile:
18 Oct, 2008, canoffruitpunch wrote in the 10th comment:
Votes: 0
I actually found out the problem to my code by myself! :lol:

Thanks everyone, I think I'm starting to get this c stuff :P
18 Oct, 2008, Conner wrote in the 11th comment:
Votes: 0
Gratz on finding it, but you should let us know what it was, not only for the sake of closure, but also so that anyone else who encounters a similar roblem in the future will know what to look for as a probable solution. :wink:
18 Oct, 2008, canoffruitpunch wrote in the 12th comment:
Votes: 0
All I had to do was change the pointer to ch->level to oldch-> level

It was storing the chars level alright…the new one!

So I wanted to add its old level.