Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, DotBot, Yahoo!

Members: 0
Guests: 6
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » 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, 12:32 pm   Last edited Sep 5, 2005, 2:43 pm by Moonwolf
Go to the top of the page
Go to the bottom of the page

Moonwolf

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 <hl></hl> 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 <hl> </hl> 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 <hl>help entry</hl> 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, 2:04 pm   Last edited Sep 5, 2005, 2:44 pm by Moonwolf
Go to the top of the page
Go to the bottom of the page

Moonwolf

GroupMembers
Posts43
JoinedAug 25, 2005

deleted
       
Pages:<< prev 1 next >>