Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
AhrefsBot, Google, Bing

Members: 0
Guests: 54
Stats
Files
Topics
Posts
Members
Newest Member
489
3,792
19,647
597
Aileenutz

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » AFKMud Support & Development » help problem
Forum Rules | Mark all | Recent Posts

help problem
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Mar 13, 2015 6:39 pm   
Go to the top of the page
Go to the bottom of the page

crone
Fledgling
GroupMembers
Posts15
JoinedMay 10, 2011

 
Hi, I have a little problem with help on AFK mud 2.2.1:

if I type:
help acid

Help level: 0
Usage : cast 'acid blast' Duration : InstantLevel : 15 Mage, 17 BardDamage : (caster's level)d4 up to a max of 200Save : vs. spells for half damageMinimum Cost : 18 ManaAcid Blast creates a powerful blast that deals a damaging blow of harmfulacid. One of the advantages to this spell over lightning bolt is that fewerthings are immune to acid and you get it at a lower level. This spell isVERY destructive to mob equipment. It is the weakest of the four aciddisciplines at the Mage's disposal.

See Also: CAUSTIC FOUNT, SULFUROUS SPRAY, ACETUM PRIMUS

but if I type:
help acid blast

Usage : cast 'acid blast'
Duration : Instant
Class Level : Mage 15, Bard 17
Damage : ld4{200
Save : vs Spells for Half Damage
Minimum cost : 18 mana

Acid Blast creates a powerful blast that deals a damaging blow of harmful
acid. One of the advantages to this spell over lightning bolt is that fewer
things are immune to acid and you get it at a lower level. This spell is
VERY destructive to mob equipment. It is the weakest of the four acid
disciplines at the Mage's disposal.

the problem is with help with only a key like "sanctuary"
help sanctuary
Help level: 0
Usage : cast sanctuary Duration : (caster's level)*2Level : 47 Cleric, 80 Druid, 85 PaladinMinimum cost : 50 ManaThe Sanctuary spell reduces the damage taken by the character from any attackby one half.

any ideas for fix it?

Thanks

Post is unread #2 Mar 17, 2015 11:08 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
how does "help actflags" look?

You are seeing it from two different spots and ways it seems. One is from here in help.cpp
   /*
    * Strip leading '.' to allow initial blanks.
    */
   if( pHelp->text[0] == '.' )
      ch->pagerf( "%s\r\n", pHelp->text.substr( 1, pHelp->text.length(  ) ).c_str() );
   else
      ch->pagerf( "%s\r\n", pHelp->text.c_str() );

This I think that is jamming it all together since here it is in helps.dat in the system directory
#HELP
Level    0
WebInvis 0
Keywords ACID BLAST
Related  CAUSTIC FOUNT, SULFUROUS SPRAY, ACETUM PRIMUS
Text     Usage        : cast 'acid blast' 
Duration     : Instant
Level        : 15 Mage, 17 Bard
Damage       : (caster's level)d4 up to a max of 200
Save         : vs. spells for half damage
Minimum Cost : 18 Mana

Acid Blast creates a powerful blast that deals a damaging blow of harmful
acid. One of the advantages to this spell over lightning bolt is that fewer
things are immune to acid and you get it at a lower level. This spell is
VERY destructive to mob equipment. It is the weakest of the four acid
disciplines at the Mage's disposal.¢
End


The other is from skills.cpp
bool get_skill_help( char_data * ch, const string & argument )
{
   skill_type *skill = nullptr;
   char buf[MSL], target[MSL];
   int sn;

   if( ( sn = skill_number( argument ) ) >= 0 )
      skill = skill_table[sn];

   // Not a skill/spell, drop back to regular help
   if( sn < 0 || !skill || skill->type == SKILL_HERB )
      return false;

   target[0] = '\0';
   switch ( skill->target )
   {
      default:
         break;

      case TAR_CHAR_OFFENSIVE:
         mudstrlcpy( target, "", MSL );
         break;

      case TAR_CHAR_SELF:
         mudstrlcpy( target, "", MSL );
         break;

      case TAR_OBJ_INV:
         mudstrlcpy( target, "", MSL );
         break;
   }

   snprintf( buf, MSL, "cast '%s'", skill->name );
   ch->printf( "Usage        : %s %s\r\n", skill->type == SKILL_SPELL ? buf : skill->name, target );

   if( skill->affects.empty(  ) )
      ch->print( "Duration     : Instant\r\n" );
   else
   {
      list < smaug_affect * >::iterator paf;
      bool found = false;

      for( paf = skill->affects.begin(  ); paf != skill->affects.end(  ); ++paf )
      {
         smaug_affect *af = *paf;

         // Make sure duration isn't null, and is not 0
         if( af->duration && af->duration[0] != '\0' && af->duration[0] != '0' )
         {
            if( !found )
            {
               ch->print( "Duration     :\r\n" );
               found = true;
            }
            ch->printf( "   Affect    : '%s' for '%s' rounds.\r\n", aff_flags[af->bit], af->duration );
         }
      }
   }

   ch->printf( "%-5s Level  : ", skill->type == SKILL_RACIAL ? "Race" : "Class" );

   bool firstpass = true;
   if( skill->type != SKILL_RACIAL )
   {
      for( int iClass = 0; iClass < MAX_PC_CLASS; ++iClass )
      {
         if( skill->skill_level[iClass] > LEVEL_AVATAR )
            continue;

         if( firstpass )
         {
            snprintf( buf, MSL, "%s ", class_table[iClass]->who_name );
            firstpass = false;
         }
         else
            snprintf( buf, MSL, ", %s ", class_table[iClass]->who_name );

         snprintf( buf + strlen( buf ), MSL - strlen( buf ), "%d", skill->skill_level[iClass] );
         ch->print( buf );
      }
   }
   else
   {
      for( int iRace = 0; iRace < MAX_PC_RACE; ++iRace )
      {
         if( skill->race_level[iRace] > LEVEL_AVATAR )
            continue;

         if( firstpass )
         {
            snprintf( buf, MSL, "%s ", race_table[iRace]->race_name );
            firstpass = false;
         }
         else
            snprintf( buf, MSL, ", %s ", race_table[iRace]->race_name );

         snprintf( buf + strlen( buf ), MSL - strlen( buf ), "%d", skill->race_level[iRace] );
         ch->print( buf );
      }
   }
   ch->print( "\r\n" );

   if( skill->dice )
      ch->printf( "Damage       : %s\r\n", skill->dice );

   if( skill->type == SKILL_SPELL )
   {
      if( skill->saves > 0 )
         ch->printf( "Save         : vs %s for %s\r\n", spell_saves[( int )skill->saves], spell_save_effect[SPELL_SAVE( skill )] );
      ch->printf( "Minimum cost : %d mana\r\n", skill->min_mana );
   }

   if( skill->helptext )
      ch->printf( "\r\n%s\r\n", skill->helptext );
   return true;
}


Here is what it has for the skill in skills.dat
#SKILL
Name         acid blast~
Type         Spell
Info         9101
Author	      Smaug~
Flags        nobrew~
Target       1
Minpos       fighting~
Saves        5
Slot         70
Mana         18
Rounds       18
Ego          18
Code         spell_smaug
Dammsg       acid blast~
Wearoff      !Acid Blast!~
Hitchar      &G$N is showered with your acid blast!&z~
Hitvict      &GYour skin is hit by $n's blast of acid!&z~
Hitroom      &G$N screams in pain as $n's blast of acid hits $M!&z~
Misschar     &GYour acid blast narrowly misses $N!&z~
Missvict     &GYou dodge nimbly out of the way of $n's acid blast!&z~
Missroom     &G$N dodges out of the way, narrowly avoiding $n's acid blast!&z~
Diechar      &GYour acid blast hits $N and corrodes a hole right through $M!&z~
Dievict      &G$n's acid blast corrodes a hole right through you!&z~
Dieroom      >he acid blast from $n dissolves a hole right through $N!&z~
Dice         ld4{200~
Minlevel     15
Helptext     Acid Blast creates a powerful blast that deals a damaging blow of harmful
acid. One of the advantages to this spell over lightning bolt is that fewer
things are immune to acid and you get it at a lower level. This spell is
VERY destructive to mob equipment. It is the weakest of the four acid
disciplines at the Mage's disposal.~
End

So from the looks of it, the new lines and returns aren't being handled correctly, either on loading or displaying they are wrong from the helps.cpp part

Post is unread #3 Mar 17, 2015 11:19 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
looks like the issue might be this in the load_helps function in helps.cpp
      else if( key == "Text" )
      {
         stream.getline( buf, MSL, '¢' );
         value = buf;
         strip_whitespace( value );
         help->text = value;
      }

The strip_whitespace( value ); strips all the new lines and spaces out.

Taking that out would probably fix it but when I was looking up strip_whitespace to see if it might be the issue i seen this as well
If you wish to just remove excess whitespace from a string, see the example "Strip whitespace" in the preg_replace documentation (http://www.php.net/manual/en/function.preg-replace.php).

Post is unread #4 Mar 18, 2015 3:03 am   Last edited Mar 18, 2015 5:10 am by Remcon
Go to the top of the page
Go to the bottom of the page

crone
Fledgling
GroupMembers
Posts15
JoinedMay 10, 2011

 
Thanks Remcon for open my mind :-)

I have fix :biggrin:

just sub "strip_whitespace" with "strip_lspace" in the load_helps function in helps.cpp:
      else if( key == "Text" )
      {
         stream.getline( buf, MSL, '¢' );
         value = buf;
         strip_lspace( value );
         help->text = value;
      }

edited to add code boxes around it.

Post is unread #5 Mar 18, 2015 5:11 am   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
glad its working right, thanks for posting how to get it to work correctly :)

Pages:<< prev 1 next >>