Login
User Name:

Password:



Register

Forgot your password?
A Bash Startup Script
Feb 7, 2026 3:49 pm
By eldhamud
Force Skills
Jan 1, 2026 3:58 pm
By Elwood
Overland with Bitmaps
Jul 4, 2025 11:57 pm
By Samson
void nanny_get_new_race -- comm.c
Mar 13, 2025 7:08 am
By Elwood
IPv6
Jan 25, 2025 10:45 pm
By Samson
SWFotEFUSS 1.5.3
Author: Various
Submitted by: Samson
SWRFUSS 1.4.3
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.8
Author: Various
Submitted by: Samson
AFKMud 2.5.2
Author: AFKMud Team
Submitted by: Samson
SmaugFUSS 1.9.7
Author: Various
Submitted by: Samson
Users Online
Anthropic, AhrefsBot, Google, Sogou, Baiduspider

Members: 0
Guests: 20
Stats
Files
Topics
Posts
Members
Newest Member
507
3,814
19,735
596
KandyAaron

» SmaugMuds » Codebases » AFKMud Support & Development » MXP links in help
Forum Rules | Mark all | Recent Posts

MXP links in help
< Newer Topic :: Older Topic > Adds in cross-linking in help entri

Pages:<< prev 1 next >>
* #1 Aug 31, 2005 2:32 pm   Last edited Sep 5, 2005 4:43 pm by Moonwolf
Go to the top of the page
Go to the bottom of the page

Moonwolf
Fledgling
GroupMembers
Posts43
JoinedAug 25, 2005

 
NOTE: this has been edited since it was first posted!

This patch will allow you to tag words in help entries with MXP tags, so players can cross link words highlighted as having other help entries.

the original worked, but only for the first line of help text. thanks to Remcon for the function to tag each line of help text properly for MXP to recognize it. MXP is very annoying in that it seems to want the codes at the start and end of each line.

this patch will also remove any tags from display if the user's got MXP off.

in help.c

at the top, under the other includes, add:
#include "mxp.h"


FIND:
int top_help;

ADD AFTER:
char *send_mxp_text( char *str );
char *send_mxp_clean_text( char *str );


in do_help()

FIND:
   /*
    * Strip leading '.' to allow initial blanks.
    */
   if( pHelp->text[0] == '.' )
      send_to_pager( pHelp->text + 1, ch );
   else
      send_to_pager( pHelp->text, ch );

REPLACE WITH:
   if( MXP_ON( ch ) )
      send_to_char( MXP_TAG_SECURE, ch );

   if( pHelp->text[0] == '.' )
   {
     if( MXP_ON( ch ) )
         send_to_pager( send_mxp_text( pHelp->text + 1 ), ch );
      else
         send_to_pager( send_mxp_clean_text( pHelp->text + 1 ), ch );
   }
   else
   {
      if( MXP_ON( ch ) )
         send_to_pager( send_mxp_text( pHelp->text ), ch );
      else
         send_to_pager( send_mxp_clean_text( pHelp->text ), ch );
   }

   if( MXP_ON( ch ) )
     send_to_char( MXP_TAG_LOCKED, ch );


in build.c

FIND:
void close_area( AREA_DATA * pArea );

ADD AFTER:
/* Function by Remcon @ Pabulum for MXPifying *text blocks */
char *send_mxp_text( char *str )
{
   static char newstr[MSL];
   int i, j;

   for( i = j = 0; str[i] != '\0'; i++ )
   {
      if( ( str[i] == '\r' || str[i] == '\n' ))
      {
         /* End previous MXP */
         newstr[j++] = '\033';
         newstr[j++] = '[';
         newstr[j++] = '2';
         newstr[j++] = 'z';
         /* Add in the str */
         newstr[j++] = str[i];
         /* Start MXP */
         newstr[j++] = '\033';
         newstr[j++] = '[';
         newstr[j++] = '1';
         newstr[j++] = 'z';
      }
      else
         newstr[j++] = str[i];
   }
   newstr[j] = '\0';
   return newstr;
}

/* function by Remcon to remove helplink tags if MXP is off */
char *send_mxp_clean_text( char *str )
{
   static char newstr[MSL];
   int i, j;

   for( i = j = 0; str[i] != '\0'; i++ )
   {
      if( str[i] == '<'
      && str[i + 1] != '\0' && str[i + 1] == 'h'
      && str[i + 2] != '\0' && str[i + 2] == 'l'
      && str[i + 3] != '\0' && str[i + 3] == '>' )
      {
        i += 3;
        continue;
      }
      else if( str[i] == '<'
      && str[i + 1] != '\0' && str[i + 1] == '/'
      && str[i + 2] != '\0' && str[i + 2] == 'h'
      && str[i + 3] != '\0' && str[i + 3] == 'l'
      && str[i + 4] != '\0' && str[i + 4] == '>' )
      {
        i += 4;
        continue;
      }
      newstr[j++] = str[i];
   }
   newstr[j] = '\0';
   return newstr;
}


in system/mxp.style
FIND:
^[[1z<!ELEMENT yell FLAG="Chan yell"> 

ADD AFTER:
^[[1z<!ELEMENT hl "<send href='help &text;' hint='Get help on: &text;'>">


you might need to use copy/paste of one of the other elements to get the escape at the start of that line in your editor, just edit the part
hl "<send href='help &text;' hint='Get help on: &text;'>">


to suit ...

with this mod, wizzes can tag words in help entries with on either side of them, which will create an MXP link that when clicked allows the user to do a help on the highlighted word, for example

this is a help entry for demonstration purposes

would show the words "help entry" as a link in MXP, when clicked on MXP would do a "help help entry" on them.

you can change the tag (hl) to whatever suits your need. if you just change the tag in mxp.style, you only need to hotboot for changes to apply, but be warned that the old tag will still be in the help text. likewise, if you use your help.are on a MUD without this patch afterwards, you'll see those tags.

~miika

Post is unread #2 Sep 5, 2005 4:04 pm   Last edited Sep 5, 2005 4:44 pm by Moonwolf
Go to the top of the page
Go to the bottom of the page

Moonwolf
Fledgling
GroupMembers
Posts43
JoinedAug 25, 2005

 
deleted

Pages:<< prev 1 next >>