newdo_help.txt
snippets · 4.7 KB · 2010-03-30
New do_help: a replacement help system for stock ROM.
Download « Back to the snippets list
*****)))))>>>>> A few Words <<<<<(((((*****
Here is a new help system for your mud to replace the old pice of crap one in stock rom.
All you have to do is add: "help code maby by abarak" to your greeting screen :P, Just joking.
You dont have to E-Mail me or anything, hell, I dont ever care if you print it out and tare it
to shreds while cursing your ass off at it. I just made this to help you out, as many things
could be added to this code. I am not going to put out any more updates as this is just a
stupid little pice of code, so please dont ask me. If you need any help or anything like that,
please E-Mail me at: abrazak_2000@hotmail.com, but dont mail me saying my code sucks ass or
other junk like that.
Thanks.
-- Abarak, Player by day, Coder by night.
E-Mail: abrazak_2000@hotmail.com
Mud : bb12.betterbox.net 5555
Web pg:
Mud : http://fl.betterbox.net
Self: http://www.angelfire.com/linux/orwhatnot
*****)))))>>>>> What this code does <<<<<(((((*****
When more then one help file is found for the keword, you get a screen like this:
More then one help file found for what you where looking for
Here is the list of them all
============================================================
<1 : NOTE 'NOTE WRITE' 'NOTE READ' BOARD 'NOTE SYSTEM' BOARDS >
<2 : QBUY BUY >
<3 : BRIEF COMPACT >
<4 : BUG TYPO >
<5 : BUY LIST SELL VALUE >
<6 : BRANDISH QUAFF RECITE ZAP >
<7 : ALLOW BAN PERMBAN >
<8 : BLESS >
<9 : BLINDNESS >
<10: 'ACID BLAST' 'BURNING HANDS' 'COLOUR SPRAY' FIREBALL 'LIGHTNING BOLT' 'MAGIC MISSILE' 'SHOCKING GRASP' >
There was 10 keywords found for what you where looking for
Also, if someone types in a keyword and it is not found it is loged with the players name
and what he/she types to find.
*****)))))>>>>> How to install <<<<<(((((*****
Just replace the stock do_help with this one. How hard can that be??
*****)))))>>>>> The Code <<<<<(((((*****
void do_help( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
HELP_DATA *pHelp;
BUFFER *output;
bool found = FALSE;
char argall[MAX_INPUT_LENGTH],argone[MAX_INPUT_LENGTH];
int level;
int count = 0;
output = new_buf();
if ( argument[0] == '\0' )
argument = "summary";
/* this parts handles help a b so that it returns help 'a b' */
argall[0] = '\0';
while (argument[0] != '\0' )
{
argument = one_argument(argument,argone);
if (argall[0] != '\0')
strcat(argall," ");
strcat(argall,argone);
}
for ( pHelp = help_first; pHelp != NULL; pHelp = pHelp->next )
{
level = (pHelp->level < 0) ? -1 * pHelp->level - 1 : pHelp->level;
if (level > get_trust( ch ) )
continue;
if ( is_name( argall, pHelp->keyword ) )
{
/* add seperator if found */
if (found)
{
send_to_char("\n\r", ch);
send_to_char("More then one help file found for what you where looking for\n\r", ch);
send_to_char("Here is the list of them all\n\r", ch);
send_to_char("{r=========={R=========={b=========={B=========={g=========={G=========={x\n\r\n\r",ch);
for ( pHelp = help_first; pHelp != NULL; pHelp = pHelp->next )
{
level = (pHelp->level < 0) ? -1 * pHelp->level - 1 : pHelp->level;
if (level > get_trust( ch ) )
continue;
if ( is_name( argall, pHelp->keyword ) )
{
if ( pHelp->level >= 0 && str_cmp( argall, "imotd" ) )
{
count++;
sprintf( buf,
"{B<{G%-2d{R:{x ", count);
send_to_char( buf, ch );
send_to_char(pHelp->keyword, ch);
send_to_char(" {B>{x\n\r", ch);
}
}
}
sprintf( buf,
"\n\rThere was {R%d{x keywords found for what you where looking for", count);
send_to_char( buf, ch );
return;
}
if ( pHelp->level >= 0 && str_cmp( argall, "imotd" ) )
{
add_buf(output,pHelp->keyword);
}
/*
* Strip leading '.' to allow initial blanks.
*/
if ( strlen( argall ) == 1 )
; // DJR HACK - display only keywords
else if ( pHelp->text[0] == '.' )
add_buf(output,pHelp->text+1);
else
add_buf(output,pHelp->text);
found = TRUE;
/* small hack :) */
if (ch->desc != NULL && ch->desc->connected != CON_PLAYING
&& ch->desc->connected != CON_GEN_GROUPS)
break;
}
}
if (!found)
{
send_to_char( "We are always working on new help files\n\r", ch );
send_to_char( "So always check back for the help file you are looking for", ch );
sprintf( log_buf, "NO HELP: %s could not find a help file for %s", ch->name, argone );
log_string( log_buf );
}
else
page_to_char(buf_string(output),ch);
free_buf(output);
}