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, Yahoo!, Google

Members: 0
Guests: 14
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
Evoru (32)
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » Adding listen all/listen none
Forum Rules | Mark all | Recent Posts

Adding listen all/listen none
< Newer Topic :: Older Topic > Channels.c

Pages:<< prev 1 next >>
Post is unread #1 Aug 19, 2002, 2:21 pm   Last edited Nov 24, 2007, 10:42 am by Samson
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

Here's a suggested additon to do_listen if anyone likes it feel free to use.

I also added in comm.c nanny function

addname( &ch->pcdata->chan_listen, "newbiechat" );

so players dont start out null.

In do listen

if (ch->level < 2)
{
send_to_char( "&YYou must be level 2 to listen.\r\n", ch);
return;
}

   if( !argument || argument[0] == '\0' )
   {
        send_to_char( "&GFor a list of channels, type &Wchannels\r\n", ch );
        send_to_char( "&YYou are listenting to the following local mud channels:\r\n", ch );
        send_to_char( "&GSyntax: listen\r\nSyntax: listen all\r\nSyntax: listen none$
        ch_printf( ch, "&W%s\r\n", ch->pcdata->chan_listen );
        return;
   }

if ( !str_cmp( argument, "all" ) )
{
 addname( &ch->pcdata->chan_listen, "chat" );
 addname( &ch->pcdata->chan_listen, "ooc" );
 addname( &ch->pcdata->chan_listen, "icc" );
 addname( &ch->pcdata->chan_listen, "shout" );
 addname( &ch->pcdata->chan_listen, "yell" );
 addname( &ch->pcdata->chan_listen, "ask" );
 addname( &ch->pcdata->chan_listen, "answer" );
 addname( &ch->pcdata->chan_listen, "music" );
 addname( &ch->pcdata->chan_listen, "wartalk" );
 addname( &ch->pcdata->chan_listen, "quest" );
send_to_char( "&YAll main channels of communication have been turned on.\r\n", ch);
return;
}

if ( !str_cmp( argument, "none" ) )
{
 removename( &ch->pcdata->chan_listen, "chat" );
 removename( &ch->pcdata->chan_listen, "ooc" );
 removename( &ch->pcdata->chan_listen, "icc" );
 removename( &ch->pcdata->chan_listen, "shout" );
 removename( &ch->pcdata->chan_listen, "yell" );
 removename( &ch->pcdata->chan_listen, "ask" );
 removename( &ch->pcdata->chan_listen, "answer" );
 removename( &ch->pcdata->chan_listen, "music" );
 removename( &ch->pcdata->chan_listen, "wartalk" );
 removename( &ch->pcdata->chan_listen, "quest" );
send_to_char( "&YAll main channels of communication have been turned off.\r\n", ch);
return;
}
       
Post is unread #2 Aug 20, 2002, 7:31 am
Go to the top of the page
Go to the bottom of the page

kilroy
Magician
GroupMembers
Posts122
JoinedMay 1, 2002

pretty cool
thanks
       
Post is unread #3 Aug 20, 2002, 2:38 pm   Last edited Nov 24, 2007, 10:44 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Indeed. Liked it so much I've turned do_listen into this, performs the same function but doesn't require that you add or remove channel entries for future channels:

void do_listen( CHAR_DATA *ch, char *argument )
{
   MUD_CHANNEL *channel;

   if( !argument || argument[0] == '\0' )
   {
	send_to_char( "&GSyntax: listen\r\n", ch );
	send_to_char( "&GSyntax: listen all\r\n", ch );
	send_to_char( "&GSyntax: listen none\r\n", ch );
	send_to_char( "&GFor a list of channels, type &Wchannels\r\n", ch );
	send_to_char( "&YYou are listenting to the following local mud channels:\r\n\r\n", ch );
	ch_printf( ch, "&W%s\r\n", ch->pcdata->chan_listen );
	return;
   }

   if( !str_cmp( argument, "all" ) )
   {
	for( channel = first_channel; channel; channel = channel->next )
	{
	   if( ch->level >= channel->level && !hasname( ch->pcdata->chan_listen, channel->name ) )
		addname( &ch->pcdata->chan_listen, channel->name );
	}
	send_to_char( "&YYou are now listening to all available channels.\r\n", ch );
	return;		
   }

   if( !str_cmp( argument, "none" ) )
   {
	for( channel = first_channel; channel; channel = channel->next )
	{
	   if( ch->level >= channel->level && hasname( ch->pcdata->chan_listen, channel->name ) )
		removename( &ch->pcdata->chan_listen, channel->name );
	}
	send_to_char( "&YYou no longer listen to any available channel.\r\n", ch );
	return;
   }

   if( hasname( ch->pcdata->chan_listen, argument ) )
   {
      removename( &ch->pcdata->chan_listen, argument );
      ch_printf( ch, "&YYou no longer listen to &W%s\r\n", argument );
   }
   else
   {
      if( !( channel = find_channel( argument ) ) )
      {
         send_to_char( "No such channel.\r\n", ch );
         return;
      }
	if( channel->level > ch->level )
	{
	   send_to_char( "That channel is above your level.\r\n", ch );
	   return;
	}
      addname( &ch->pcdata->chan_listen, argument );
      ch_printf( ch, "&YYou now listen to &W%s\r\n", channel->name );
   }
   return;
}
       
Pages:<< prev 1 next >>