Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Sogou, Yahoo!

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » A New function for the channe...
Forum Rules | Mark all | Recent Posts

A New function for the channel history
< Newer Topic :: Older Topic > Might be of use :)

Pages:<< prev 1 next >>
Post is unread #1 Jun 30, 2006, 10:06 pm
Go to the top of the page
Go to the bottom of the page

ToadVile

GroupMembers
Posts47
JoinedApr 1, 2006

I was thinking bout like a command, so that you can clear the history of channels. Any channel you want.
Like clear "tells" would remove all thats been said, all. giving you a nice, empty history buffer again..

Just a idea
       
Post is unread #2 Nov 23, 2006, 4:52 am   Last edited Nov 23, 2006, 4:52 am by Moridian
Go to the top of the page
Go to the bottom of the page

Moridian

GroupMembers
Posts5
JoinedNov 13, 2006

ToadVile said:

I was thinking bout like a command, so that you can clear the history of channels. Any channel you want.
Like clear "tells" would remove all thats been said, all. giving you a nice, empty history buffer again..

Just a idea

I realize that this is an old post but it got me thinking, so I whipped up a short function to do just what was suggested.

Not sure if it's allowed so Samson feel free to remove the code if you don't want it posted. It was just easy and I wanted it for my mud and thought I'd share. ;)

void do_clearhist ( CHAR_DATA *ch, char *argument )
{
    MUD_CHANNEL *channel;
    int loopa;

    if ( !argument || argument[0] == '\0' )
    {
        send_to_char( "&GSyntax: clearhist <name>\n\r", ch );
        return;
    }

    if ( !(channel = find_channel( argument ) ) )
    {
        send_to_char( "&RNo channel with that name exists.\n\r", ch );
        return;
    }

    for( loopa = 0; loopa < MAX_CHANHISTORY; loopa++ )
    {
        if ( channel->history[loopa][0] )
            DISPOSE( channel->history[loopa][0] );
        if ( channel->history[loopa][1] )
            DISPOSE( channel->history[loopa][1] );
    }
    ch_printf( ch, "History for channel %s cleared.\n\r", channel->name );
    return;
}

-Moridian
       
Post is unread #3 Nov 23, 2006, 2:30 pm   Last edited Nov 23, 2006, 2:30 pm by kiasyn
Go to the top of the page
Go to the bottom of the page

kiasyn
Magician
GroupMembers
Posts121
JoinedJun 30, 2006

    for( loopa = 0; loopa < MAX_CHANHISTORY; loopa++ )
    {
        if ( channel->history[loopa][0] )
            DISPOSE( channel->history[loopa][0] );
        if ( channel->history[loopa][1] )
            DISPOSE( channel->history[loopa][1] );
    }

IIRC DISPOSE checks for NULL so you can remove the ifchecks.
       
Post is unread #4 Nov 23, 2006, 7:41 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

We added this in the code for send_tochannel because I was lazy and didn't feel like adding a new command. If you want to use this, it's up to you to backport the C++

   if( !argument || argument[0] == '\0' || !str_cmp( argument, "hpurge" ) )
   {
      if( !channel->flags.test( CHAN_KEEPHISTORY ) )
      {
         ch->printf( "%s what?\r\n", capitalize( channel->name ) );
         return;
      }

      if( !str_cmp( argument, "hpurge" ) )
      {
         for( int x = 0; x < MAX_CHANHISTORY; ++x )
         {
            DISPOSE( channel->history[x][0] );
            DISPOSE( channel->history[x][1] );
         }
         ch->printf( "The %s channel history has been purged.\r\n", channel->name );
         return;
      }
      show_channel_history( ch, channel );
      return;
   }
       
Pages:<< prev 1 next >>