Pages:<< prev 1 next >>
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:
FIND:
ADD AFTER:
in do_help()
FIND:
REPLACE WITH:
in build.c
FIND:
ADD AFTER:
in system/mxp.style
FIND:
ADD AFTER:
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
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 ahelp 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
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
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
this is a
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
Pages:<< prev 1 next >>