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, Yandex, Google

Members: 0
Guests: 13
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 » LoP Codebase » Problems installing sayto
Forum Rules | Mark all | Recent Posts

Problems installing sayto
< Newer Topic :: Older Topic > Can't install sayto snippet in LoP

Pages:<< prev 1, 2 next >>
Post is unread #1 May 18, 2009, 11:33 am   Last edited May 21, 2009, 5:47 pm by Remcon
Go to the top of the page
Go to the bottom of the page

Legaeldan
Fledgling
GroupMembers
Posts10
JoinedMay 18, 2009

ok, so i tried installing the sayto command, but i'm going to take a wild guess and say it's because i don't have the ask command installed either. but here is what the snippet is.
void do_say_to_char( CHAR_DATA *ch, char *argument )
{
   char arg[MAX_INPUT_LENGTH], last_char;
   char buf[MAX_STRING_LENGTH];
   char *sbuf;
   CHAR_DATA *victim;
   EXT_BV actflags;
   int arglen;

#ifndef SCRAMBLE
   int speaking = -1, lang;

   for( lang = 0; lang_array[lang] != LANG_UNKNOWN; lang++ )
      if( ch->speaking & lang_array[lang] )
      {
         speaking = lang;
         break;
      }
#endif

   argument = one_argument( argument, arg );

   if( !arg || arg[0] == '\0' || !argument || argument[0] == '\0' )
   {
      send_to_char( "Say what to whom?\n\r", ch );
      return;
   }

   if( ( victim = get_char_room( ch, arg ) ) == NULL
   || ( IS_NPC(victim) && victim->in_room != ch->in_room )
   || (!NOT_AUTHED(ch) && NOT_AUTHED(victim) && !IS_IMMORTAL(ch) ) )
   {
      send_to_char( "They aren't here.\n\r", ch );
      return;
   }

   if( IS_SET( ch->in_room->room_flags, ROOM_SILENCE ) )
   {
      send_to_char( "You can't do that here.\n\r", ch );
      return;
   }

   if( victim == ch )
   {
      send_to_char( "You have a nice conversation with yourself. Did it help?\n\r", ch );
      return;
   }

   arglen = strlen( argument ) - 1;

   /* Remove whitespace and tabs. */
   while( argument[arglen] == ' ' || argument[arglen] == '\t' )
       --arglen;

   last_char = argument[arglen];

   actflags = ch->act;

   if( IS_NPC(ch) )
      xREMOVE_BIT( ch->act, ACT_SECRETIVE );

   sbuf = argument;

   /* Check to see if character is ignoring speaker */
   if( is_ignoring( victim, ch ) )
   {
      /* continue unless speaker is an immortal */
      if( !IS_IMMORTAL(ch) || get_trust(victim) > get_trust(ch) )
         return;
      else
      {
         set_char_color(AT_IGNORE, vch);
         ch_printf( victim, "You attempt to ignore %s, but are unable to do so.\n\r", ch->name );
      }
   }

#ifndef SCRAMBLE
   if( speaking != -1 && (!IS_NPC(ch) || ch->speaking) )
   {
      int speakswell = UMIN( knows_language(victim, ch->speaking, ch ), knows_language( ch, ch->speaking, victim ) );

      if( speakswell < 75 )
         sbuf = translate( speakswell, argument, lang_names[speaking] );
   }
#else
   if( !knows_language( victim, ch->speaking, ch ) && ( !IS_NPC(ch) || ch->speaking != 0 ) )
      sbuf = scramble( argument, ch->speaking );
#endif

   sbuf = drunk_speech( sbuf, ch );

   ch->act = actflags;
   MOBtrigger = FALSE;

   switch( last_char )
   {
      case '?':
         act( AT_SAY, "You ask $N, '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_CHAR );
         act( AT_SAY, "$n asks $N, '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_NOTVICT );
         act( AT_SAY, "$n asks you '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_VICT );
         break;

      case '!':
         act( AT_SAY, "You exclaim at $N, '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_CHAR );
         act( AT_SAY, "$n exclaims at $N, '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_NOTVICT );
         act( AT_SAY, "$n exclaims to you, '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_VICT );
         break;

      default:
         act( AT_SAY, "You say to $N '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_CHAR );
         act( AT_SAY, "$n says to $N '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_NOTVICT );
         act( AT_SAY, "$n says to you '$t&c'", ch, drunk_speech( argument, ch ), victim, TO_VICT );
         break;
   }

   if( IS_SET( ch->in_room->room_flags, ROOM_LOGSPEECH ) )
   {
      snprintf( buf, MAX_STRING_LENGTH, "%s: %s", IS_NPC( ch ) ? ch->short_descr : ch->name, argument );
      append_to_file( LOG_FILE, buf );
   }

   mprog_speech_trigger( argument, ch );

   if( char_died(ch) )
      return;

   oprog_speech_trigger( argument, ch );

   if( char_died(ch) )
      return;

   rprog_speech_trigger( argument, ch );
   return;
}


These are the errors I get when I try to compile it (using ubuntu 9.04 by the way)

make -s lop
  Compiling o/act_comm.o....
act_comm.c:26:22: error: new_auth.h: No such file or directory
act_comm.c: In function �void do_group(CHAR_DATA*, char*)�:
act_comm.c:1917: warning: suggest parentheses around && within ||
act_comm.c: In function �void do_say_to_char(CHAR_DATA*, char*)�:
act_comm.c:2345: error: �MAX_INPUT_LENGTH� was not declared in this scope
act_comm.c:2346: error: �MAX_STRING_LENGTH� was not declared in this scope
act_comm.c:2355: error: no match for �operator&� in �ch->char_data::speaking & lang_array[lang]�
act_comm.c:2362: error: �arg� was not declared in this scope
act_comm.c:2371: error: �IS_NPC� was not declared in this scope
act_comm.c:2372: error: �NOT_AUTHED� was not declared in this scope
act_comm.c:2372: error: �IS_IMMORTAL� was not declared in this scope
act_comm.c:2397: error: �IS_NPC� was not declared in this scope
act_comm.c:2406: error: �IS_IMMORTAL� was not declared in this scope
act_comm.c:2410: error: �vch� was not declared in this scope
act_comm.c:2416: error: �IS_NPC� was not declared in this scope
act_comm.c:2418: error: cannot convert �EXT_BV� to �int� for argument �2� to �int knows_language(CHAR_DATA*, int)�
act_comm.c:2418: error: cannot convert �EXT_BV� to �int� for argument �2� to �int knows_language(CHAR_DATA*, int)�
act_comm.c:2429: error: �FALSE� was not declared in this scope
act_comm.c:2431: error: switch quantity not an integer
act_comm.c:2454: error: �buf� was not declared in this scope
act_comm.c:2454: error: �IS_NPC� was not declared in this scope
make[1]: *** [o/act_comm.o] Error 1
make: *** [all] Error 2

Any help would be much appreciated :biggrin:
       
Post is unread #2 May 18, 2009, 4:25 pm
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

Did it compile before you tried adding this? It doesn't seem like it would.
act_comm.c:26:22: error: new_auth.h: No such file or directory
       
Post is unread #3 May 18, 2009, 5:44 pm
Go to the top of the page
Go to the bottom of the page

Legaeldan
Fledgling
GroupMembers
Posts10
JoinedMay 18, 2009

No, it didn't compile before that, I have it back to compilation status. But i need the sayto snippet to be installed. It won't compile with it in even without the new_auth.h. I get the same error minus the new_auth.h. I keep getting the errors about IS_NPC and IS_IMMORTAL and so on. and the errors about max input.
       
Post is unread #4 May 18, 2009, 5:52 pm
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

You need to get a compiling codebase before you will be able to even start installing the snippet. Then, is this snippet for the same codebase that you're working on? It doesn't make sense for it to not find such fundamental things as IS_NPC -- that means that something else is broken here.
       
Post is unread #5 May 18, 2009, 11:55 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

DavidHaley said:

You need to get a compiling codebase before you will be able to even start installing the snippet. Then, is this snippet for the same codebase that you're working on? It doesn't make sense for it to not find such fundamental things as IS_NPC -- that means that something else is broken here.

I'd have to agree with David on this one, Legaeldan, you need to get LoP to compile cleanly for you before you start trying to figure out why a new snippet addition isn't compiling within it. As for David's question, the say_to snippet is written for SmaugFUSS (and not the current version either) rather than LoP which is a derivative of SmaugFUSS but definitely has significant differences. As far as your specific errors, aside from figuring out how to compile LoP cleanly, I do know that for the following two:
act_comm.c:2345: error: �MAX_INPUT_LENGTH� was not declared in this scope
act_comm.c:2346: error: �MAX_STRING_LENGTH� was not declared in this scope

you're going to want to change the references in the snippet from MAX_INPUT_LENGTH to MIL and MAX_STRING_LENGTH to MSL and for
act_comm.c:2429: error: �FALSE� was not declared in this scope
try changing the FALSE reference(s?) to false (remember that the compiler is case sensitive). But, beyond those three, David and Zeno really sound like they're on the right track here for you, your best bet is to get LoP to compile cleanly before you start trying to introduce new code that may or may not compound the existing problems for you.
       
Post is unread #6 May 19, 2009, 7:25 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

Conner said:

the say_to snippet is written for SmaugFUSS (and not the current version either) rather than LoP which is a derivative of SmaugFUSS but definitely has significant differences

Ah! Well that certainly makes a very big difference. :smile: Thanks for pointing that out Conner.

This means that for the functions like IS_NPC, we'll need to figure out what the LoP equivalent is. Conner already gave several examples of things that have changed. For the rest, either Remcon can stop by and let us know, or you can do a little digging. I'm pretty sure there will be fairly direct equivalents.
       
Post is unread #7 May 21, 2009, 11:21 am   Last edited May 21, 2009, 11:24 am by Legaeldan
Go to the top of the page
Go to the bottom of the page

Legaeldan
Fledgling
GroupMembers
Posts10
JoinedMay 18, 2009

Ok, so I got it to compile cleanly. And I see the point of it being a smaug snippet and why it isn't working for LoP.
Does anyone know how I might enter a new channel called sayto?
I was trying to get a say, with a target, but also seeable by the whole room.

I almost got it by copying the whiper and say snippets out of the SRC, and trying to see the differences between. only problem is, I don't know how to add sayto into pcdata.

There are probably a couple of things i need to change in the whisper snippet aswell to make it seen by the whole room aswell.

thanks for all the help so far by the way
       
Post is unread #8 May 21, 2009, 11:34 am
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

What exactly is the use of this say to command that say doesn't cover? Why can't you just copy whisper into the sayto command and then send it to everyone? If you sayto a player, what's the point? RP?

Maybe add an argument to say? say hey @bob
You say 'Hey' to bob.
Joe says 'Hey' to Bob.
Joe says 'Hey' to you.

I just don't see the convenience of this command or how it helps.
       
Post is unread #9 May 21, 2009, 12:00 pm
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

And why does it require a whole new channel? Can't you just tweak the text that is sent to the room?
       
Post is unread #10 May 21, 2009, 12:09 pm
Go to the top of the page
Go to the bottom of the page

Hanaisse
Magician
GroupMembers
Posts196
JoinedNov 25, 2007


tphegley said:

What exactly is the use of this say to command that say doesn't cover? Why can't you just copy whisper into the sayto command and then send it to everyone? If you sayto a player, what's the point? RP?

Maybe add an argument to say? say hey @bob
You say 'Hey' to bob.
Joe says 'Hey' to Bob.
Joe says 'Hey' to you.

I just don't see the convenience of this command or how it helps.


I've seen it in a CircleMud. It's just a nice to have if there are multiple players in a room and you want to direct a conversation to one specific person. If I remember correctly the output is basically the same as you describe.
       
Post is unread #11 May 21, 2009, 2:57 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

tphegley said:

What exactly is the use of this say to command that say doesn't cover? Why can't you just copy whisper into the sayto command and then send it to everyone? If you sayto a player, what's the point? RP?

Maybe add an argument to say? say hey @bob
You say 'Hey' to bob.
Joe says 'Hey' to Bob.
Joe says 'Hey' to you.

I just don't see the convenience of this command or how it helps.

That mostly covers it, basically it changes "<player> says '<whatever>'" to "<player> says to <other player> <whatever>" for everyone else and to the player it's directed to they'll see "<player> says to you <whatever>" and you'll see "you say to <player> <whatever>" unless you end your sayto with a question mark (then instead of "says to" it shows "asks";) or a exclaimation mark (then instead of "says to" it displays "exclaims to";). The convenience is, as Hanaisse said, if you've multiple players in the room/conversation, everyone can see who's talking [/i]to whom[/i]. I'll leave it to you to determine how that helps. :wink:
       
Post is unread #12 May 21, 2009, 3:28 pm
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

I just don't see the use in it. If I want to talk to someone I use tells and if we're in a room with others I think it's pretty obvious to who we were talking to. But then again, I've always played a mud with 10-20 people so there were never more then like 10 people in one room at any given time.

I guess if 100 people were in a room (I would just use tells then) I could see this being helpful. *shrug*

How to figure it out though, I don't believe that this snippet asks for another channel but rather just sends output to the players so a new channel isn't really necessary for this to work. By the TC's post, I don't believe he got the sayto snippet to work. You aren't adding a new channel, but a new command. I would copy do_whisper or do_tell into the sayto command and just make it seen by every one.

do_tell is like this:

George tells you 'blah blah'
You tell Bob 'blah blah'

do_sayto would be like this:

George says to you 'blah blah'
George says to Bob, 'blah blah' <---this one is added in.
You say to Bob, 'blah blah'

You're just adding that middle one into the code.

       
Post is unread #13 May 21, 2009, 3:42 pm   Last edited May 21, 2009, 3:44 pm by Conner
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Actually, it's closer to do_say than do_whisper or do_tell, but you're right that it's not a new channel just a new command. As for it's usefulness/helpfulness, I expect that would qualify as an individual admin's matter of preference which is why it's still just a snippet rather than pre-included in the FUSS package. I've got it installed on my mud because I like the way it looks much better and I like that it will display says/asks/exclaims depending on context and I have found times when I, or others in the conversation/room, was left wondering who was being asked a question and sayto resolves that for me nicely. On Kayle's mud he's even added a fourth option, if memory serves, that changes the display to mutters if the text sent concludes in an elipse (...) which I've considerd doing too, I just can't decide whether it's rude or not that way. :wink:

Edit: Again if memory serves, I believe Remcon had done something in LoP so that you could create/remove/change "channels" on the fly from within the mud (as an admin) so do_say might be a seperate channel rather than just a command in LoP. If that's the case though, he's going to need Remcon's input to finish resolving this one from this point.
       
Post is unread #14 May 21, 2009, 3:50 pm   Last edited May 21, 2009, 7:57 pm by tphegley
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

In LOP:

/* Sayto Command - 5/21/09 Smaugmuds.com*/
CMDF( do_sayto )
{
   CHAR_DATA *victim;
   char arg[MIL], buf[MIL], *sbuf;
   int position;
   int speaking = -1, lang;

   if( xIS_SET( ch->in_room->room_flags, ROOM_SILENCE ) )
   {
      send_to_char( "You can't do that here.\r\n", ch );
      return;
   }

   if( !is_npc( ch ) && ( xIS_SET( ch->act, PLR_SILENCE )) )
   {
      send_to_char( "You can't do that.\r\n", ch );
      return;
   }

   argument = one_argument( argument, arg );
   if( arg == NULL || arg[0] == '\0' || !argument || argument[0] == '\0' )
   {
      send_to_char( "Say what to whom?\r\n", ch );
      return;
   }

   if( !( victim = get_char_room( ch, arg ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }



   if( ch == victim )
   {
      send_to_char( "You have a nice little chat with yourself.\r\n", ch );
      return;
   }

   if( not_authed( ch ) && !not_authed( victim ) && !is_immortal( victim ) )
   {
      send_to_char( "They can't hear you because you aren't authorized.\r\n", ch );
      return;
   }

   if( !is_npc( victim ) && ( !victim->desc ) )
   {
      send_to_char( "That player is link-dead.\r\n", ch );
      return;
   }

   if( !is_npc( victim ) && xIS_SET( victim->act, PLR_AFK ) )
   {
      send_to_char( "That player is afk.\r\n", ch );
      return;
   }
   for( lang = 0; lang_array[lang] != LANG_UNKNOWN; lang++ )
   {
      if( xIS_SET( ch->speaking, lang_array[lang] ) )
      {
         speaking = lang;
         break;
      }
   }

   if( !is_npc( victim ) && xIS_SET( victim->act, PLR_SILENCE ) )
      send_to_char( "That player is silenced.  They will receive your message but can't respond.\r\n", ch );

   if( ( !is_immortal( ch ) && !is_awake( victim ) ) )
   {
      act( AT_PLAIN, "$E is too tired to discuss such matters with you now.", ch, 0, victim, TO_CHAR );
      return;
   }

   if( !is_npc( victim ) && xIS_SET( victim->in_room->room_flags, ROOM_SILENCE ) )
   {
      act( AT_PLAIN, "A magic force prevents your message from being heard.", ch, 0, victim, TO_CHAR );
      return;
   }

   if( victim->desc  /* make sure desc exists first  -Thoric */
   && victim->desc->connected == CON_EDITING && get_trust( ch ) < PERM_LEADER )
   {
      act( AT_PLAIN, "$E is currently in a writing buffer.  Please try again in a few minutes.", ch, 0, victim, TO_CHAR );
      return;
   }

   /* Check to see if target of sayto is ignoring the sender */
   if( is_ignoring( victim, ch ) )
   {
      /* If the sender is an imm then they can't be ignored */
      if( !is_immortal( ch ) || get_trust( victim ) > get_trust( ch ) )
      {
         set_char_color( AT_IGNORE, ch );
         ch_printf( ch, "%s is ignoring you.\r\n", victim->name );
         return;
      }
      else
      {
         set_char_color( AT_IGNORE, victim );
         ch_printf( victim, "You attempt to ignore %s, but are unable to do so.\r\n", ch->name );
      }
   }

   /* Bug fix by guppy@wavecomputers.net */
   MOBtrigger = false;
   act( AT_TELL, "You say to $N ' $t &D'", ch, argument, victim, TO_CHAR );
   position = victim->position;
   victim->position = POS_STANDING;

   sbuf = argument;
   if( speaking != -1 )
   {
      int speakswell = UMIN( knows_language( victim, speaking ), knows_language( ch, speaking ) );

      if( speakswell < 85 )
         sbuf = translate( speakswell, argument, lang_names[speaking] );
   }
   sbuf = drunk_speech( sbuf, ch );

   act_tell( victim, ch, "$n says to you ' $t &D'", ch, sbuf, victim, TO_VICT );
      act( AT_SAY, "$n says to $N' $t &D'", ch, sbuf, victim, TO_NOTVICT );

   if( !is_npc( victim ) )
   {
      snprintf( buf, sizeof( buf ), "&[sayto]%s said to you ' %s &D&[tell]'\r\n", capitalize( is_npc( ch ) ? ch->short_descr : ch->name ), sbuf );
      add_phistory( 1, victim, buf );
   }

   MOBtrigger = true;

   victim->position = position;
   if( xIS_SET( ch->in_room->room_flags, ROOM_LOGSPEECH ) )
   {
      snprintf( buf, sizeof( buf ), "%s: %s (says to) %s.",
         is_npc( ch ) ? ch->short_descr : ch->name, argument, is_npc( victim ) ? victim->short_descr : victim->name );
      append_to_file( LOG_FILE, buf );
   }

   mprog_speech_trigger( argument, ch );
}



That should do it for you. I'll test it out myself and see what happens.
       
Post is unread #15 May 21, 2009, 4:21 pm
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

Here is the output:

<30000hp 30000m 30000mv>[0Gold][RVnum 21000]
sayto george hey
You say to George ' hey '


Bob says to you ' hey '


Bob says to George' hey '
       
Post is unread #16 May 21, 2009, 4:44 pm
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006


Conner said:

Actually, it's closer to do_say than do_whisper or do_tell, but you're right that it's not a new channel just a new command. As for it's usefulness/helpfulness, I expect that would qualify as an individual admin's matter of preference which is why it's still just a snippet rather than pre-included in the FUSS package. I've got it installed on my mud because I like the way it looks much better and I like that it will display says/asks/exclaims depending on context and I have found times when I, or others in the conversation/room, was left wondering who was being asked a question and sayto resolves that for me nicely. On Kayle's mud he's even added a fourth option, if memory serves, that changes the display to mutters if the text sent concludes in an elipse (...) which I've considerd doing too, I just can't decide whether it's rude or not that way. :wink:

Edit: Again if memory serves, I believe Remcon had done something in LoP so that you could create/remove/change "channels" on the fly from within the mud (as an admin) so do_say might be a seperate channel rather than just a command in LoP. If that's the case though, he's going to need Remcon's input to finish resolving this one from this point.


Sorry, didn't see your post before I made the command. I used the do_tell and fitted it into how Henaisse kind of wanted it. If you want to add the punctuation thing in there then I think that would be easy enough to put in.
       
Post is unread #17 May 21, 2009, 4:57 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

tphegley said:

Sorry, didn't see your post before I made the command. I used the do_tell and fitted it into how Henaisse kind of wanted it. If you want to add the punctuation thing in there then I think that would be easy enough to put in.

No worries, if it works that way then he's set, if he wants the punctuation thing in there it's part of the snippet and should be an easy enough alteration to what you've given him. Either way, I think we've, collectively, thoroughly resolved his issue.
       
Post is unread #18 May 21, 2009, 5:03 pm   Last edited May 21, 2009, 7:56 pm by tphegley
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

I'm bored...hehe

Here is the snippet with punctuation in it.

CMDF( do_sayto )
{
   CHAR_DATA *victim;
   char arg[MIL], buf[MIL], *sbuf;
   char punctuation;
   int speaking = -1, lang;
   int arglen;

   if( xIS_SET( ch->in_room->room_flags, ROOM_SILENCE ) )
   {
      send_to_char( "You can't do that here.\r\n", ch );
      return;
   }

   if( !is_npc( ch ) && ( xIS_SET( ch->act, PLR_SILENCE )) )
   {
      send_to_char( "You can't do that.\r\n", ch );
      return;
   }

   argument = one_argument( argument, arg );
   if( arg == NULL || arg[0] == '\0' || !argument || argument[0] == '\0' )
   {
      send_to_char( "Say what to whom?\r\n", ch );
      return;
   }

   if( !( victim = get_char_room( ch, arg ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( ch == victim )
   {
      send_to_char( "You have a nice little chat with yourself.\r\n", ch );
      return;
   }

   if( not_authed( ch ) && !not_authed( victim ) && !is_immortal( victim ) )
   {
      send_to_char( "They can't hear you because you aren't authorized.\r\n", ch );
      return;
   }

   if( !is_npc( victim ) && ( !victim->desc ) )
   {
      send_to_char( "That player is link-dead.\r\n", ch );
      return;
   }

   if( !is_npc( victim ) && xIS_SET( victim->act, PLR_AFK ) )
   {
      send_to_char( "That player is afk.\r\n", ch );
      return;
   }
   for( lang = 0; lang_array[lang] != LANG_UNKNOWN; lang++ )
   {
      if( xIS_SET( ch->speaking, lang_array[lang] ) )
      {
         speaking = lang;
         break;
      }
   }

   if( !is_npc( victim ) && xIS_SET( victim->act, PLR_SILENCE ) )
      send_to_char( "That player is silenced.  They will receive your message but can't respond.\r\n", ch );

   if( ( !is_immortal( ch ) && !is_awake( victim ) ) )
   {
      act( AT_PLAIN, "$E is too tired to discuss such matters with you now.", ch, 0, victim, TO_CHAR );
      return;
   }

   if( !is_npc( victim ) && xIS_SET( victim->in_room->room_flags, ROOM_SILENCE ) )
   {
      act( AT_PLAIN, "A magic force prevents your message from being heard.", ch, 0, victim, TO_CHAR );
      return;
   }

   if( victim->desc  /* make sure desc exists first  -Thoric */
   && victim->desc->connected == CON_EDITING && get_trust( ch ) < PERM_LEADER )
   {
      act( AT_PLAIN, "$E is currently in a writing buffer.  Please try again in a few minutes.", ch, 0, victim, TO_CHAR );
      return;
   }

   /* Check to see if target of sayto is ignoring the sender */
   if( is_ignoring( victim, ch ) )
   {
      /* If the sender is an imm then they can't be ignored */
      if( !is_immortal( ch ) || get_trust( victim ) > get_trust( ch ) )
      {
         set_char_color( AT_IGNORE, ch );
         ch_printf( ch, "%s is ignoring you.\r\n", victim->name );
         return;
      }
      else
      {
         set_char_color( AT_IGNORE, victim );

         ch_printf( victim, "You attempt to ignore %s, but are unable to do so.\r\n", ch->name );
      }
   }

   arglen = strlen( argument ) - 1;
   /* Remove whitespace and tabs. */
   while( argument[arglen] == ' ' || argument[arglen] == '\t' )
       --arglen;
   punctuation = argument[arglen];

   /* Bug fix by [email]guppy@wavecomputers.net[/email] */
   MOBtrigger = false;

   sbuf = argument;
   if( speaking != -1 )
   {
      int speakswell = UMIN( knows_language( victim, speaking ), knows_language( ch, speaking ) );

      if( speakswell < 85 )
         sbuf = translate( speakswell, argument, lang_names[speaking] );
   }
   sbuf = drunk_speech( sbuf, ch );


  switch ( punctuation )
  {
   case '?':
         act( AT_SAY, "You ask $N ' $t &D'", ch, argument, victim, TO_CHAR );
         act( AT_SAY,  "$n asks you ' $t &D'", ch, argument, victim, TO_VICT );
         act( AT_SAY, "$n asks $N' $t &D'", ch, argument, victim, TO_NOTVICT );
         break;
   case '!':
         act( AT_SAY, "You exclaim at $N ' $t &D'", ch, argument, victim, TO_CHAR );
         act( AT_SAY,  "$n exclaims to you ' $t &D'", ch, argument, victim, TO_VICT );
         act( AT_SAY, "$n exclaims at $N ' $t &D'", ch, argument, victim, TO_NOTVICT );
         break;
   default:
         act( AT_SAY, "You say to $N ' $t &D'", ch, argument, victim, TO_CHAR );
         act( AT_SAY,  "$n says to you ' $t &D'", ch, argument, victim, TO_VICT );
         act( AT_SAY, "$n says to $N' $t &D'", ch, argument, victim, TO_NOTVICT );
         break;
  }



   if( !is_npc( victim ) )
   {
      snprintf( buf, sizeof( buf ), "&[sayto]%s said to you ' %s &D&[tell]'\r\n", capitalize( is_npc( ch ) ? ch->short_descr : ch->name ), sbuf );
      add_phistory( 1, victim, buf );
   }

   MOBtrigger = true;


   if( xIS_SET( ch->in_room->room_flags, ROOM_LOGSPEECH ) )
   {
      snprintf( buf, sizeof( buf ), "%s: %s (says to) %s.",
         is_npc( ch ) ? ch->short_descr : ch->name, argument, is_npc( victim ) ? victim->short_descr : victim->name );
      append_to_file( LOG_FILE, buf );
   }

   mprog_speech_trigger( argument, ch );
}


       
Post is unread #19 May 21, 2009, 5:27 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

Sorry I so hadn't paid any attention to the fact this was in the LoP forums. Glad it seems though that others were able to be of help :). And from just a quick glance I didn't notice anything that stood out as it would fail lol. Even tossed it into the history nice job tphegley :)
       
Post is unread #20 May 21, 2009, 6:26 pm   Last edited May 21, 2009, 6:27 pm by Conner
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Remcon said:

Sorry I so hadn't paid any attention to the fact this was in the LoP forums. Glad it seems though that others were able to be of help :).

No biggie, you know we try to help out where we can. :)

Remcon said:

Even tossed it into the history nice job tphegley :)

Hehe, that's because he was using do_tell as his basis for do_sayto and tells are already added to history. :wink:
But, otherwise, I'll second your comment that he did do a good job.
       
Pages:<< prev 1, 2 next >>