Quick save tell snippet.

From: Patrick J. Dughi (dughi@IMAXX.NET)
Date: 03/30/98


        I don't know why I never threw this out there, its handy, but
truth to be told, its probably about 5 minutes of work..really simple. The
only bug I think thats in it is the colors are horrendous.

        What it does:  Simply type "tell" to see up to the last 10 tells
that people sent you. Good in case you're spammed, lagged, afk, etc.

        Its in patch format, cause that was most of the 5 minutes of work.
                                enjoy.
                                                        PjD

diff -BduprN -x *.o ../../circle30bpl12/src/act.comm.c ./act.comm.c
--- ../../circle30bpl12/src/act.comm.c  Fri Apr 12 22:39:21 1996
+++ ./act.comm.c        Mon Mar 30 02:14:37 1998
@@ -80,6 +80,45 @@ ACMD(do_gsay)
   }
 }

+void list_tb(struct char_data *ch) {
+  int counter;
+  send_to_char("Tells\r\n"
+               "-----\r\n", ch);
+
+  for(counter=9;counter >= 0;counter--) {
+    if(GET_TELLS(ch,counter)) {
+      send_to_char(GET_TELLS(ch,counter),ch);
+    }
+  }
+}
+
+void add_to_tb(struct char_data *ch, struct char_data *vict, char
*argument) {
+  char *new_tell, *old_tell;
+  int counter;
+
+  if(IS_NPC(vict)) {
+    return;           /* don't save from mobs */
+  }
+
+
+  sprintf(buf,"%s%s%s > %s%s%s\r\n",
+   CCRED(ch, C_NRM), GET_NAME(vict), CCNRM(ch, C_NRM),
+   CCCYN(ch, C_NRM), argument, CCNRM(ch, C_NRM));
+
+  CREATE(new_tell,char, strlen(buf) +1);
+  strcpy(new_tell, buf);
+
+
+  for(counter=0;counter<=9;counter++) {
+    if(counter==9) {
+      /* then we don't want the old one anymore.. */
+      free(GET_TELLS(ch,counter));
+    }
+    old_tell=GET_TELLS(ch,counter);
+    GET_TELLS(ch,counter)=new_tell;
+    new_tell=old_tell;
+  }
+}

 void perform_tell(struct char_data *ch, struct char_data *vict, char
*arg)
 {
@@ -98,6 +137,9 @@ void perform_tell(struct char_data *ch,
   }

   GET_LAST_TELL(vict) = GET_IDNUM(ch);
+
+       /* lets add the tell buffer too */
+  add_to_tb(vict,ch, arg);
 }

 /*
@@ -110,7 +152,9 @@ ACMD(do_tell)

   half_chop(argument, buf, buf2);

-  if (!*buf || !*buf2)
+  if (!*buf && !*buf2)
+    list_tb(ch);
+  else if (!*buf || !*buf2)
     send_to_char("Who do you wish to tell what??\r\n", ch);
   else if (!(vict = get_char_vis(ch, buf)))
     send_to_char(NOPERSON, ch);
diff -BduprN -x *.o ../../circle30bpl12/src/structs.h ./structs.h
--- ../../circle30bpl12/src/structs.h   Tue Oct 28 23:16:29 1997
+++ ./structs.h Mon Mar 30 01:19:42 1998
@@ -775,6 +775,7 @@ struct player_special_data {
    long last_tell;             /* idnum of last tell from              */
    void *last_olc_targ;                /* olc control
*/
    int last_olc_mode;          /* olc control                          */
+   char *previous_tells[10];    /* Aye, the last ten tells.            */
 };


diff -BduprN -x *.o ../../circle30bpl12/src/utils.h ./utils.h
--- ../../circle30bpl12/src/utils.h     Wed Oct 29 16:04:08 1997
+++ ./utils.h   Mon Mar 30 01:33:04 1998
@@ -272,6 +272,7 @@ void        update_pos(struct char_data *victim
 #define GET_LAST_OLC_MODE(ch)  ((ch)->player_specials->last_olc_mode)
 #define GET_ALIASES(ch)                ((ch)->player_specials->aliases)
 #define GET_LAST_TELL(ch)      ((ch)->player_specials->last_tell)
+#define GET_TELLS(ch,number)
((ch)->player_specials->previous_tells[number])

 #define GET_SKILL(ch, i)       ((ch)->player_specials->saved.skills[i])
 #define SET_SKILL(ch, i, pct)  { (ch)->player_specials->saved.skills[i] =
pct; }


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST