Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Problem with memin spells.

Problem with memin spells.

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ithildin   USA  (262 posts)  Bio
Date Thu 09 Dec 2004 05:31 AM (UTC)

Amended on Thu 09 Dec 2004 05:58 AM (UTC) by Ithildin

Message
Ok, I got everything working great, but I have one other problem. If I were to make a new spell, and save skill table and reboot, then the sn changes. When a player mem's a spell, he mem's the sn. so when the sn changes on the sort skill table, the player has a different spell memed. I tried not sorting in db.c, but then the spell stays at the end of the slo and you can't find the spell. Here's what I did:

sset create skill aeros
sset save skill table
slo aeros ( aros is slot 273)
<305hp 258m 568mv> 
<   > slo aeros
Sn:  273 Slot:    0 unknown: 'aeros               '
Saves: none  SaveEffect: none
Type: unknown  Target: ignore  Minpos: 0  Mana: 0  Beats: 0  Range: 0
Flags: 0  Guild: -1  Value: 0  Info: 0  Code: spell_smaug
Sectors Allowed: All
Dammsg: 
Wearoff: 
--------------------------[CLASS USE]--------------------------
Mag) lvl: 101 max: 95%  Cle) lvl: 101 max: 95%  Thi) lvl: 101 max: 95%
War) lvl: 101 max: 95%  Pal) lvl: 101 max: 95%  Dru) lvl: 101 max: 95%
Ran) lvl: 101 max: 95%  

<305hp 258m 568mv> 
<   > 
Comm: Sock.sinaddr:  4.225.5.196, port 3117.

<305hp 258m 568mv> 
<   > sset save skill table
Log: Camilla: sset save skill table
Saving skill table...


reboot mud now
slo aeros
<305hp 258m 568mv> 
<   > slo aeros
No such skill, spell, proficiency or tongue.


It's not showing up after it loads skill table. ANy thoughts on what to do?

here is db.c

    log_string("Loading skill table");
    load_skill_table();
//   sort_skill_table();
   remap_slot_numbers();	/* must be after the sort */

    gsn_first_spell  = 0;
    gsn_first_skill  = 0;
    gsn_first_weapon = 0;
    gsn_first_tongue = 0;
    gsn_top_sn	     = top_sn;

    for ( x = 0; x < top_sn; x++ )
	if ( !gsn_first_spell && skill_table[x]->type == SKILL_SPELL )
	    gsn_first_spell = x;
	else
	if ( !gsn_first_skill && skill_table[x]->type == SKILL_SKILL )
	    gsn_first_skill = x;
	else
	if ( !gsn_first_weapon && skill_table[x]->type == SKILL_WEAPON )
	    gsn_first_weapon = x;
	else
	if ( !gsn_first_tongue && skill_table[x]->type == SKILL_TONGUE )
	    gsn_first_tongue = x;




Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #1 on Thu 09 Dec 2004 10:56 PM (UTC)
Message
Ok, i'm guessing this:


void remap_slot_numbers()
{
    SKILLTYPE *skill;
    SMAUG_AFF *aff;
    char tmp[32];
    int sn;

    log_string( "Remapping slots to sns" );

    for ( sn = 0; sn <= top_sn; sn++ )
    {
	if ( (skill=skill_table[sn]) != NULL )
	{
	    for ( aff = skill->affects; aff; aff = aff->next )
		if ( aff->location == APPLY_WEAPONSPELL
		||   aff->location == APPLY_WEARSPELL
		||   aff->location == APPLY_REMOVESPELL
		||   aff->location == APPLY_STRIPSN
		||   aff->location == APPLY_RECURRINGSPELL )
		{
		    sprintf( tmp, "%d", slot_lookup(atoi(aff->modifier)) );
		    DISPOSE(aff->modifier);
		    aff->modifier = str_dup(tmp);
		}
	}
    }
}


and this:


int skill_lookup2(const char *name, CHAR_DATA * ch)
{
int sn;

    if ( (sn=bsearch_skill_exact(name, gsn_first_spell, gsn_first_skill-1)) == -1 )
      if ( (sn=bsearch_skill_exact(name, gsn_first_skill, gsn_first_weapon-1)) == -1 )
	if ( (sn=bsearch_skill_exact(name, gsn_first_weapon, gsn_first_tongue-1)) == -1 )
	  if ( (sn=bsearch_skill_exact(name, gsn_first_tongue, gsn_top_sn-1)) == -1 )
	    if ( (sn=bsearch_skill_prefix(name, gsn_first_spell, gsn_first_skill-1)) == -1 )
	      if ( (sn=bsearch_skill_prefix(name, gsn_first_skill, gsn_first_weapon-1)) == -1 )
		if ( (sn=bsearch_skill_prefix(name, gsn_first_weapon, gsn_first_tongue-1)) == -1 )
		  if ( (sn=bsearch_skill_prefix(name, gsn_first_tongue, gsn_top_sn-1)) == -1
		  &&    gsn_top_sn < top_sn )
		  {
		      for ( sn = gsn_top_sn; sn < top_sn; sn++ )
		      {
			  if ( !skill_table[sn] || !skill_table[sn]->name )
			    return -1;
			  if ( LOWER(name[0]) == LOWER(skill_table[sn]->name[0])
			  &&  !str_prefix( name, skill_table[sn]->name ) )
			    return sn;
		      }
		      return -1;
		  }
    return sn;
}


I'm sure those are the two things I have to mess with in order to get the mem'd spells to move up a slot when new spells are added and sorted.

Any thoughts? Any thing I can do?
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,031 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.