home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / SYSOP / MODS1.ZIP / SPV-017D.MOD < prev    next >
Text File  |  1993-12-10  |  11KB  |  272 lines

  1. SPV-017D.MOD [*THE* random saying mod.  Like VBBS.]
  2. Papa Bear #1 @5079
  3. 7Tuesday1, 7December 71, 71993 2 96:201 am
  4. 0R: net33: @4056 (via @4061) [08:41 12/10/93]
  5. 0R: net33: @4050 (via @4064) [05:33 12/10/93]
  6. 0R: net33: @4064 (via @1040) [05:10 12/10/93]
  7. 0R: net33: @1040 (via @2050) [13:37 12/09/93]
  8. 0R: net34: @2050 [11:35 12/09/93]
  9. 0R: net34: @2050 (via @1040) [05:54 12/09/93]
  10. 0R: net33: @1040 (via @1114) [04:39 12/09/93]
  11. 0R: net33: @5079 [09:05 12/07/93]
  12. 4Msg. Status:3▄ 15Please reply!
  13. 3 ▀▀▀▀▀▀▀▀▀▀▀▀
  14.  
  15. ┌────────────────────────────────────────────────────────────────────────────┐
  16. │ Mod Name: SPV-017D.MOD     Mod Authors: Pâpâ ßêâr (1@5079 WWIV/IceNET)     │
  17. │ Difficulty: ▓░░░░░░░░░     [08/07/93] [08/09/93]  (1@5050 SEX/JAMDnet)     │
  18. │ WWIV Version: 4.23         [08/14/93] [09/08/93]   (1@15061 WWIVlink)      │
  19. │ Files Affected: BBSUTL.C BBS.C        [12/06/93]     (1@18 CARDNet)        │
  20. │                 FCNS.H VARDEC.H STRINGS.C            (1@18 CARDNet)        │
  21. │ Description: Puts random words of wisdom at logon, or above prompts or     │
  22. │wherever you want to use them.                                              │
  23. ╞═────────────────────────────────────═╤═───────────────────────────────────═╡
  24. │ StarPort Valhalla [510]522-3583 ASV 14.4kbps  Home of the SPV mod series!  │
  25. ╘═────────────────────────────────────═╧═───────────────────────────────────═╛
  26.  Word of Warning:  You installed it, you're responsible! Make back-ups BEFORE
  27.  attempting to install this modification!  Read all text before beginning.
  28. -----------------------------------------------------------------------------
  29.  LEGEND:
  30.  ==  Original Code [use this to search on]
  31.  ++  Add this Line [mods ALWAYS add stuff, don't they?]
  32. -----------------------------------------------------------------------------
  33.  LONG DESCRIPTION: What this does is place a random saying above the main
  34. prompt, or where ever you want it to. Kinda like SPV-004C.MOD (That one does
  35. not allow for user input. I use both, now, one at all my prompts, and the
  36. other at logon.)
  37.   Why this is different is this allows for letting your USER'S input into the
  38. file. Kinda like what a VBBS I call allows you to do.
  39.  
  40.   This "D" version is another upgrade. It is *NOT* a bug fix. This file
  41. includes all of the fixes and upgrades from 017A, FIX "B", and the 017C
  42. upgrade.
  43.   I did not include all the comments from previous versions.  Nor did I
  44. comment the new changes. This was getting kinda long, and with the upgrade to
  45. 4.23, I hopefully made it a "drop in" for the source ;)
  46.  
  47. FEATURES:
  48. o Fully random.
  49. o Allows user to enter lines into your .STR database.
  50. o Allows for color inputs.
  51. o Auto-detects if defined .STR file exists.  If it doesn't, it automatically
  52.   prompts you to enter the first string, at which point it creates the file
  53.   for you.  No need for an external string manager.
  54. o Set up to only a MINIMUM SL to use.
  55. o Doesn't bug you, as a SysOp, with the strings. (Unless you want it to.)
  56. o Puts user's name in the string, so you all know who entered it.
  57. o Variable length input fields. Determined by user's handle length.
  58. o Full SysOp Log and SSM support.
  59. o Fills in NULL [empty] strings.  Now you can delete old strings, and the mod
  60.   will automatically fill in the dead spots.
  61. o Now updated to work with 4.23.
  62. o Got rid of the MODSTR.H file [got smart and did it another way].
  63.  
  64. THANKS:
  65. Money-Mac (1@5084 WWIVnet) for the idea to let users input their own strings.
  66. Captain EJ (1@5057 WWIVnet) for the idea to make it fill in NULL strings.
  67. Lestat The Immortal (1@3325 WWIVnet) for pointing out that I had left a very
  68.   important step out.  And for E-Mailing me AGAIN with his information!
  69. All the users of StarPort Valhalla who use and like this mod!
  70. -----------------------------------------------------------------------------
  71. STEP 1:  ADD these functions to the end of BBSUTL.C:
  72.  
  73. void ran_strings (int mode)
  74. {
  75.   char s[81],s1[81],s2[81];
  76.   int ls;
  77.  
  78.   ls=(79-(strlen(thisuser.name)+3));
  79.   sprintf(s,"%s%s",syscfg.gfilesdir,RAN_FILENAME);
  80.   if (!(access(s,0)==0)) {                                          // NOTE 1
  81.     if (thisuser.sl!=255)
  82.       pl("Random string file does not exist, please notify SysOp!");
  83.     else {
  84.       nl();
  85.       npr("Please enter a string to start your %s file.\r\n",RAN_FILENAME);
  86.       add_ran_strings(ls);
  87.     }
  88.   } else {
  89.     if (mode) {
  90.       nl();
  91.       pl("Do you want to add a line to be displayed at the prompts?");
  92.       npr("It will be displayed, at random, with others): ";
  93.       if (ny()) {
  94.         nl();
  95.         pl("Please be patient...  I'm looking for a place to put it.");
  96.         nl();
  97.         pl("Please enter your line of wisdom.");
  98.         npr("[%u characters] - Enter aborts.\r\n",ls);
  99.         add_ran_strings(ls);
  100.       } else {
  101.         nl();
  102.         pl("Aborted!");
  103.         nl();
  104.       }
  105.     } else if (thisuser.sl!=255) {                                  // NOTE 2
  106.       pl("%s's random saying from %s.",thisuser.name,syscfg.systemname);
  107.       do {
  108.         strcpy(s1,(getrandomstring(RAN_FILENUMB)));
  109.       } while (s1[0]==NULL);
  110.       pl(s1);
  111.     }
  112.   }
  113.   close_strfiles();
  114. }
  115.  
  116. void add_ran_strings (int lenstr)
  117. {
  118.   char s[255],s1[255],s2[81],s3[81];
  119.   int entrynum;
  120.  
  121.   entrynum=empty_slot();
  122.   set_strings_fn(RAN_FILENUMB,syscfg.gfilesdir,RAN_FILENAME,1);
  123.   mpl(lenstr);
  124.   inli(s,"",lenstr,1);
  125.   nl();
  126.   if (s[0]==0) {
  127.     pl("Aborted!");
  128.     if ((entrynum==1) && (num_strings(RAN_FILENUMB)<2)) {
  129.       sprintf(s3,"%s%s",syscfg.gfilesdir,RAN_FILENAME);
  130.       unlink(s3);
  131.     }
  132.     return;
  133.   } else {
  134.     npr("Use the above string? [ENTER = yes] ");
  135.     if (ny()) {
  136.       nl();
  137.       sprintf(s1,"%s - %s",s,thisuser.name);
  138.       put_string(RAN_FILENUMB,entrynum,s1);
  139.       sysoplog(s1);                                                 // NOTE 3
  140.       ssm(1,0,s1);
  141.       sprintf(s1,"!!! String #%u entered into %s.",entrynum,RAN_FILENAME);
  142.       sysoplog(s1);
  143.       ssm(1,0,s1);                                                  // NOTE 3
  144.     } else {
  145.       nl();
  146.       pl("Aborted!");
  147.     }
  148.     nl();
  149.   }
  150. }
  151.  
  152. NOTE 1:  The access(...) function is a Borland's Turbo C++ 3.0 command. It
  153.   *MAY* be available to most other compilers. (Most especially Borland's
  154.   products.)  All this does is check for the presense of a defined filename
  155.   in the defined directory.  Hence the line:
  156.     sprintf(s,"%s%s",syscfg.gfilesdir,RAN_FILENAME);
  157.   that preceeds my call to the access(...); function.
  158.  
  159. NOTE 2:  If you, as a SysOp (SL 255), WANT to see the strings, just like a
  160.   normal user, then change:
  161.     } else if (thisuser.sl!=255) {
  162.   to look like:
  163.     } else {
  164.  
  165. NOTE 3: Between these two NOTE 3's are where you are notified of any
  166.   additions. You're told when you log on, and in the SysOp's Log, what a user
  167.   inputted, and where it went (by line number and STR filename).
  168. -----------------------------------------------------------------------------
  169. STEP 2: Add this function to the end of BBSUTL.C
  170.  
  171. int empty_slot(void)
  172. {
  173.   int i;
  174.  
  175.   for (i=1;num_strings(RAN_FILENUMB);i++) {
  176.     if (strlen(get_stringx(RAN_FILENUMB,i))==NULL)
  177.       return(i);
  178.   }
  179.   return(num_strings(RAN_FILENUMB)+1);
  180. }
  181. -----------------------------------------------------------------------------
  182. STEP 3: ADD these three lines to FCNS.H
  183.  
  184. == int set_language_1(int n);
  185. == int set_language(int n);
  186. ++ void ran_strings (int mode);
  187. ++ void add_ran_strings (int lenstr);
  188. ++ int empty_slot(void);
  189. -----------------------------------------------------------------------------
  190. STEP 4: Add the following lines to VARDEC.H
  191.  
  192. == #ifndef _VARDEC_H_
  193. == #define _VARDEC_H_
  194. ==
  195. ++ #define RAN_FILENAME "RANSTR.STR"                              // SPV-017C
  196. ++ #define RAN_FILENUMB 5                                         // SPV-017C
  197. ==
  198. == #define OK_LEVEL 0
  199. == #define NOK_LEVEL 1
  200. -----------------------------------------------------------------------------
  201. STEP 5: ADD the following line to BBSUTL.C
  202.  
  203. ==  set_strings_fn(2, languagedir, "YES.STR", 0);
  204. ==  set_strings_fn(3, languagedir, "NO.STR", 0);
  205. ++  set_strings_fn(RAN_FILENUMB, languagedir, RAN_FILENAME, 0);
  206. ==
  207. ==  strncpy(str_yes,get_string(1), sizeof(str_yes)-1);
  208. -----------------------------------------------------------------------------
  209. STEP 6: Add the ^ command to BBS.C
  210.  
  211. ==        } else
  212. ==          pl(get_string(8));
  213. ==        break;
  214. // START SPV-017C
  215. ++      case '^':
  216. ++        nln(2);
  217. ++        npr("Do you want to R)ead a saying, W)rite a saying, or Quit? ");
  218. ++        ch=onek("QRW");
  219. ++        switch(ch) {
  220. ++          case 'R':
  221. ++            nl();
  222. ++            ran_strings(0);
  223. ++            break;
  224. ++          case 'W':
  225. ++            if (thisuser.sl>29)                       // NOTE 1
  226. ++              ran_strings(1);
  227. ++            else {
  228. ++              nl();
  229. ++              pl("Your security access is too low for this command.");
  230. ++              nl();
  231. ++            }
  232. ++            break;
  233. ++          case 'Q':
  234. ++            nl();
  235. ++            pl("Aborted");
  236. ++            break;
  237. ++        }
  238. ++        break;
  239. // END SPV-017C
  240. ==      case '.':
  241. ==        helpl=26;
  242. ==        write_inst(INST_LOC_CHAINS,0,INST_FLAGS_ONLINE);
  243.  
  244. NOTE 1: If you want SL 20 to access this, then change the 29 to 19. (This is
  245.   set up for SL 30 or greater to run.)
  246. -----------------------------------------------------------------------------
  247. STEP 7: Place the following line wherever you want a random string to pop up:
  248.     ran_strings(0);
  249.   You can place this above your prompts, in LILO right before the user stat
  250.   screen, wherever...
  251. -----------------------------------------------------------------------------
  252. STEP 8: Recompile the whole source.
  253. -----------------------------------------------------------------------------
  254. Random strings... All you need to do to ADD a string to the STR file is call:
  255.   ran_strings(1);
  256. You can easily do this right after the user reads their mail (like VBBS), or
  257. as a command, or both (like I NOW have at SPV).  To display a saying use:
  258.   ran_strings(0);
  259. -----------------------------------------------------------------------------
  260.   If you use this, do me a favor and tell me (its a GREAT ego inflator!).
  261.   If you install this, and it doesn't work, e-mail me and I'll try to help
  262. you figure out WHY it doesn't work.
  263.   If it prints strings out that apprear in OTHER .STR files besides the one
  264. you intended, MAKE SURE YOU HAVE THE #define RAN_FILENUMB SET CORRECTLY. You
  265. can set it to 5 just to be safe.
  266.  
  267. 1-7=3*6>2Pâpâ ßêâr6<3*7=1-0
  268.  
  269. 85StarPort Valhalla ASV 510-522-3583════════════════────────────────────────────
  270. ---
  271. 1Th-th-th-that's all folks!
  272.