home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / SYSOP / MODS1.ZIP / SPV-017H.MOD < prev    next >
Text File  |  1995-06-04  |  18KB  |  464 lines

  1. Papa Bear #1 @11579
  2. 7Thursday1, 7June 11, 71995 2 86:217 am
  3. 0R 34 06/04 18:34 WWIVnet ->8339
  4. 0R 34 06/04 16:40 WWIVnet 8314->8304
  5. 0R 34 06/04 08:31 WWIVNET 4001->8314
  6. 0R 34 06/04 11:42 WWIVnet 4000->4001
  7. 0R 34 06/03 07:50 WWIVnet ->4000
  8. 0R 34 06/01 10:03 WWIVnet 4001->4000
  9. 0R 34 06/01 17:26 WWIVnet 11579->4001
  10. 0R 34 06/01 08:17 WWIVnet ->11579
  11. 4Msg. Status:9▄ 5Please reply!
  12. 9 ▀▀▀▀▀▀▀▀▀▀▀▀
  13. ┌────────────────────────────A CEREBRUM RELEASE!─────────────────────────────┐
  14. │ Mod Name: SPV-017H.MOD     Mod Authors: Pâpâ ßêâr (1@11579.wwivnet)        │
  15. │ Difficulty: ▓▓░░░░░░░░         First: [08/07/93]                           │
  16. │ WWIV Version: 4.24              Last: [06/01/95]                           │
  17. │ Files Affected: LILO.C MMENU.C SYSOPF.C STRINGS.C{?} FCNS.H VARDEC.H       │
  18. │ Description: Puts random words of wisdom at logon, or above prompts or     │
  19. │wherever you want to use them.  The mod will not display ANY entered strings│
  20. │until you, the sysop, approve them.                                         │
  21. ╞═────────────────────────────────────═╤═───────────────────────────────────═╡
  22. │ StarPort Valhalla [   ]   -     ASV 28.8kbps  Home of the SPV mod series!  │
  23. └─────────────────────────────────────═╧═────────────────────────────────────┘
  24.  
  25.                      >>> OFFICIAL WWIV SUPPORT SITE! <<<
  26.  
  27.  Word of Warning:  You installed it, you're responsible! Make back-ups BEFORE
  28.  attempting to install this modification!  Read all text before beginning.
  29. ─────────────────────────────────────────────────────────────────────────────
  30.  LEGEND:
  31.  ==  Original Code [use this to search on]
  32.  ++  Add this Line [mods ALWAYS add stuff, don't they?]
  33. ...  Skipping down some code in the same function.
  34. ─────────────────────────────────────────────────────────────────────────────
  35.  LONG DESCRIPTION: What this does is place a random saying above the main
  36. prompt, or where ever you want it to. Kinda like SPV-004C.MOD (That one does
  37. not allow for user input. I use both, now, one at all my prompts, and the
  38. other at logon.)
  39.   Why this is different is this allows for letting your USER'S input into the
  40. file. Kinda like what a VBBS I call allows you to do.
  41.  
  42. FEATURES:
  43. o Fully random.
  44. o Allows user to enter lines into your .STR database.
  45. o Allows for color inputs.
  46. o Auto-detects if defined .STR file exists.  If it doesn't, it automatically
  47.   prompts you to enter the first string, at which point it creates the file
  48.   for you.  No need for an external string manager.
  49. o Set up to only a MINIMUM SL to use.
  50. o Doesn't bug you, as a SysOp, with the strings. (Unless you want it to.)
  51. o Puts user's name in the string, so you all know who entered it.
  52. o Variable length input fields. Determined by user's handle length.
  53. o Full SysOp Log and SSM support.
  54. o Fills in NULL [empty] strings.  Now you can delete old strings, and the mod
  55.   will automatically fill in the dead spots.
  56. [12/31/93 *MINOR* MODIFICATIONS]
  57. o Now prints the "I'm looking for a place to put it" message only if the
  58.   string file grows larger than 200 strings.
  59. o Removed altogether the restrictions that prevented the SysOp viewing the
  60.   random strings.
  61. [06/05/94] Little, more, uh, common sense.
  62. o Changed the "...looking for a place to put it".  It appears in the right
  63.   place, and erases itself when an empty space *is* found.
  64. o Shortened up the code somewhat.
  65. o Added code that allows you to validate each string.  If you say that a
  66.   string is NOT okay, then it is automatically removed from the STR file.
  67. [11/18/94]
  68. o Made it so that the ^ command will allow listing all valid strings.
  69. [11/22/94]
  70. o It will now not display ANY strings until you approve of them.
  71. o Added (V)alidate command as subcommand to ^ from main prompt.
  72. o Beginday coding so that if 017H.$$$ gets inadvertantly deleted, the
  73.   beginday check will go through and re-examine the string file for any
  74.   unvalidated strings and recreate 017H.$$$ is any are found.
  75. [06/01/95]
  76. o 4.24 compatible coding.
  77. o Added another mode of operation -- perfect for above prompt use.
  78.  
  79. THANKS:
  80. Money-Mac (1@5084 WWIVnet) for the idea to let users input their own strings.
  81. Captain EJ (1@5057 WWIVnet) for the idea to make it fill in NULL strings.
  82. Lestat The Immortal (1@3325 WWIVnet) for pointing out that I had left a very
  83.   important step out.  And for E-Mailing me AGAIN with his information!
  84. Natas (1@2761.wwivnet) for suggesting the "read all strings" change *AND*
  85.   for the save (and not display) until approved idea!
  86. All the users of StarPort Valhalla who use and like this mod!
  87. ─────────────────────────────────────────────────────────────────────────────
  88. STEP 1: ADD the following line to BBSUTL.C
  89.  
  90. ==  set_strings_fn(2, languagedir, "YES.STR", 0);
  91. ==  set_strings_fn(3, languagedir, "NO.STR", 0);
  92. ++  set_strings_fn(RAN_FILENUMB, languagedir, RAN_FILENAME, 0);   // SPV-017H
  93. ==
  94. ==  strncpy(str_yes,get_string(1), sizeof(str_yes)-1);
  95. ─────────────────────────────────────────────────────────────────────────────
  96. STEP 2:  ADD these functions to the end of BBSUTL.C:
  97.  
  98. // START BLOCK COPY SPV-017H
  99. void ran_strings (int mode)
  100. {
  101.   char s[81],s1[81],s2[81];
  102.   int ls,i,Done;
  103.  
  104.   ls=(79-(strlen(thisuser.name)+4));
  105.   sprintf(s,"%s%s",syscfg.gfilesdir,RAN_FILENAME);
  106.   if (!exist(s)) {
  107.     if (thisuser.sl!=255) {
  108.       pl("6Random sayings file doesn't exist. Notifying sysop.0");
  109.       sprintf(s1,"%s does not exist -- need to create it!",RAN_FILENAME);
  110.       ssm(1,0,s1);
  111.       sysoplog(s1);
  112.     } else {
  113.       nl();
  114.       npr("2Please enter a saying to start your %s file.0",RAN_FILENAME);
  115.       nl();
  116.       add_ran_strings(ls);
  117.     }
  118.   } else {
  119.     switch (mode) {
  120.       case 0:
  121.         nl();
  122.         strcpy(s1,thisuser.name);
  123.         properize(s1);
  124.         npr("5A saying for 1%s 5from 1%s5:0",s1,syscfg.systemname);
  125.         nl();
  126.         do {
  127.           strcpy(s2,(getrandomstring(RAN_FILENUMB)));
  128.         } while ((s2[0]==NULL) || (s2[0]=='»'));
  129.         npr("9\"1%s9\"0\r\n",s2);
  130.         break;
  131.       case 1:
  132.         nl();
  133.         pl("3Do you want to enter your own saying?0");
  134.         npr("5[to be displayed, at random, with others] 0");
  135.         if (yn()) {
  136.           nln(2);
  137.           npr(
  138.    "9Please enter your saying [1%u9 characters].  2ENTER 9aborts0",ls);
  139.           nl();
  140.           add_ran_strings(ls);
  141.         } else {
  142.           nln(2);
  143.           pl("6Aborted0");
  144.         }
  145.         nl();
  146.         break;
  147.       case 2:
  148.         nl();
  149.         Done=0;
  150.         for (i=0;(i<num_strings(RAN_FILENUMB)) && (!Done);i++) {
  151.           strcpy(s,get_stringx(RAN_FILENUMB,i));
  152.           if ((s[0]) && (s[0]!='»'))
  153.             pl(s);
  154.           Done=inkey();
  155.         }
  156.         break;
  157.       case 3:
  158.         do {
  159.           strcpy(s2,(getrandomstring(RAN_FILENUMB)));
  160.         } while ((s2[0]==NULL) || (s2[0]=='»'));
  161.         pl(s2);
  162.         break;
  163.     }
  164.   }
  165.   close_strfiles();
  166. }
  167.  
  168. void add_ran_strings (int lenstr)
  169. {
  170.   char s[255],s1[255],s2[161],s3[81];
  171.   int entrynum;
  172.   FILE *note;
  173.  
  174.   if (num_strings(RAN_FILENUMB)>70)
  175.     npr("6>2Please be patient, I'm looking for a place for it!6<0");
  176.   entrynum=empty_slot();
  177.   if (num_strings(RAN_FILENUMB)>70) {
  178.     while (WhereX())
  179.       backspace();
  180.   }
  181.   set_strings_fn(RAN_FILENUMB,syscfg.gfilesdir,RAN_FILENAME,1);
  182.   mpl(lenstr);
  183.   inli(s,"",lenstr,1);
  184.   nl();
  185.   if (s[0]==0) {
  186.     pl("Aborted!");
  187.     if ((entrynum==1) && (num_strings(RAN_FILENUMB)<2)) {
  188.       sprintf(s3,"%s%s",syscfg.gfilesdir,RAN_FILENAME);
  189.       unlink(s3);
  190.     }
  191.     return;
  192.   } else {
  193.     npr("2Use this string?0 ");
  194.     if (ny()) {
  195.       nl();
  196.       strcpy(s2,thisuser.name);
  197.       sprintf(s1,"»%s - %s",s,s2);
  198.       put_string(RAN_FILENUMB,entrynum,s1);
  199.       if ((note=fsh_open("017H.$$$","wt"))!=NULL) {
  200.         fprintf(note,"There are unvalidated strings in %s...",
  201.                 RAN_FILENAME);
  202.         fputs("\n\n",note);
  203.         fprintf(note,"Do not delete this file!");
  204.         fsh_close(note);
  205.       } else {
  206.         sprintf(s,
  207.           "6%%% 2Unable to create 017H.$$$ in your main BBS directory!0");
  208.         ssm(1,0,s);
  209.         sysoplog(s);
  210.       }
  211.     } else {
  212.       nl();
  213.       pl("6Aborted!0");
  214.     }
  215.     nl();
  216.   }
  217. }
  218.  
  219. int empty_slot(void)
  220. {
  221.   int i;
  222.  
  223.   for (i=1;num_strings(RAN_FILENUMB);i++) {
  224.     if (strlen(get_stringx(RAN_FILENUMB,i))==NULL)
  225.       return(i);
  226.   }
  227.   return(num_strings(RAN_FILENUMB)+1);
  228. }
  229.  
  230. void ValidateStrings(void)
  231. {
  232.   int i=-1,i1=1;
  233.   char ch,s[81];
  234.  
  235.   nl();
  236.   npr("5Validate random saying strings in 1%s 5now?0 ",RAN_FILENAME);
  237.   if (yn()) {
  238.     nl();
  239.     pl("4Looking for unvalidated strings!0");
  240.     nl();
  241.     set_strings_fn(RAN_FILENUMB,syscfg.gfilesdir,RAN_FILENAME,1);
  242.     while ((!hangup) && (++i<=num_strings(RAN_FILENUMB))) {
  243.       strcpy(s,get_stringx(RAN_FILENUMB,i));
  244.       if (s[0]=='»') {
  245.         nl();
  246.         npr("9Entry number 1%d2:0",i);
  247.         nl();
  248.         pl(s);
  249.         npr("5Is this okay? 3(2Y1es3/1no3/1quit3)0 ");
  250.         ch=onek("\rYNQ");
  251.         switch (ch) {
  252.           case '\r':
  253.           case 'Y':
  254.             pl("5Saving this entry!  3(9Stripping 1»3)0");
  255.             put_string(RAN_FILENUMB,i,&s[1]);
  256.             break;
  257.           case 'N':
  258.             pl(
  259.           "6Deleting this entry!  3(2Position available for reuse.3)0");
  260.             put_string(RAN_FILENUMB,i,"");
  261.             break;
  262.           case 'Q':
  263.             pl("6Aborting before all entries have been validated!0");
  264.             i1=0;
  265.             break;
  266.         }
  267.       }
  268.     }
  269.     close_strfiles();
  270.   }
  271.   if (i1)
  272.     unlink("017H.$$$");
  273. }
  274. // END BLOCK COPY -- SPV-017H
  275.  
  276. NOTE: You'll notice at times that there is a file in your main BBS directory
  277.       called 017H.$$$.  DO NOT DELETE THIS FILE.  It is how the modification
  278.       know there are unvalidated strings.  It will be deleted just as soon
  279.       as you validate (or delete) ALL unvalidated strings.
  280.  
  281. NOTE: If viewing strings with an string manager program such as ESE or ESM,
  282.       you may notice that some begin with ».  This » is the marker that
  283.       indicates an unvalidated string.  Once validated the » is removed.  You
  284.       *CAN* do this with your string manager if you want, but it is not
  285.       required -- this mod will take of those.
  286. ─────────────────────────────────────────────────────────────────────────────
  287. STEP 3: ADD these three lines to FCNS.H
  288.  
  289. == int set_language(int n);
  290. == void cd_to(char *s);
  291. == void get_dir(char *s, int be);
  292. ++ void ran_strings (int mode);                                   // SPV-017H
  293. ++ void add_ran_strings (int lenstr);                             // SPV-017H
  294. ++ int empty_slot(void);                                          // SPV-017H
  295. ++ void ValidateStrings(void);                                    // SPV-017H
  296. ==
  297. == /* File: bbsutl1.c */
  298. ─────────────────────────────────────────────────────────────────────────────
  299. STEP 4: Add the following lines to VARDEC.H
  300.  
  301. == #ifndef _VARDEC_H_
  302. == #define _VARDEC_H_
  303. ==
  304. ++ #define RAN_FILENAME "RANSTR.STR"                             // SPV-017H
  305. ++ #define RAN_FILENUMB 5                                // SPV-017H  NOTE!!!
  306. ==
  307. == #ifndef __OS2__
  308. == #define RIPDRIVE
  309.  
  310. NOTE!!!: You can change this value to anything from 4 to 7 without having to
  311. modify anything other file.  If you change it to anything GREATER THAN 6,
  312. then you need to change this line in STRINGS.C to the number you have here,
  313. plus 1:  (So if you entered 8 for this step, you'd enter 9 here.)
  314.  
  315. #define MAX_STRFILES 8
  316. ─────────────────────────────────────────────────────────────────────────────
  317. STEP 5: Add the ^ command to MMENU.C
  318.  
  319. ==        } else
  320. ==          pl(get_string(8));
  321. ==        break;
  322. // START SPV-017H
  323.       case '^':
  324.         nln(2);
  325.         npr("5Do you want to 1R2)5ead0");
  326.         if ((exist("017H.$$$")) && (so())) {
  327.           npr("5, 1W2)5rite, 1V2)5alidate, or 6Q2)5uit? 0");
  328.           ch=onek("QRVW");
  329.         } else {
  330.           npr("5 a saying, 1W2)5rite a saying, or 6Q2)5uit? 0");
  331.           ch=onek("QRW/r");
  332.         }
  333.         nl();
  334.         switch(ch) {
  335.           case 'V':
  336.             ValidateStrings();
  337.             break;
  338.           case 'R':
  339.             npr("5View all the entries? 0");
  340.             if (yn())
  341.               ran_strings(2);
  342.             else
  343.               ran_strings(0);
  344.             break;
  345.           case 'W':
  346.             if (thisuser.sl>29)                                     // NOTE 1
  347.               ran_strings(1);
  348.             else
  349.               pl("6Your security access is too low for this command.0");
  350.             break;
  351.           case '/r':
  352.           case 'Q':
  353.             pl("6Aborted0");
  354.             break;
  355.         }
  356.         nl();
  357.         break;
  358. // END SPV-017H
  359. ==      case '.':
  360. ==        helpl=26;
  361. ==        write_inst(INST_LOC_CHAINS,0,INST_FLAGS_ONLINE);
  362.  
  363. NOTE 1: If you want SL 20 to access this, then change the 29 to 19. (This is
  364.   set up for SL 30 or greater to run.)
  365. ─────────────────────────────────────────────────────────────────────────────
  366. STEP 6: Place the following line wherever you want a random string to pop up:
  367.             ran_strings(0);
  368.         You can place this above your prompts, in LILO right before the user
  369.         stat screen, wherever...
  370. ─────────────────────────────────────────────────────────────────────────────
  371. STEP 7: Add this code into LILO.C, at the very end of the function:
  372.         void logon(void)
  373.  
  374. ==   rip_cls();
  375. ==   autox = -1;
  376. ++   if ((exist("017H.$$$")) && (so()))                           // SPV-017H
  377. ++     ValidateStrings();                                         // SPV-017H
  378. ++ }
  379. ==
  380. == void logoff(void)
  381. ─────────────────────────────────────────────────────────────────────────────
  382. STEP 8: Add this variable declaration to SYSOPF.C, void beginday(void)
  383.  
  384. ==   zlogrec z,z1;
  385. ==   int f,i;
  386. ++   FILE *note;                                                  // SPV-017H
  387. ==   double fk;
  388. ==   int    nus;
  389. . . .SKIPPING DOWN TO THE END OF THE FUNCTION . . .
  390. ==   if (syscfg.beginday_c[0]) {
  391. ==     stuff_in(s,syscfg.beginday_c,create_chain_file(),"","","","");
  392. ==     extern_prog(s, sysinfo.spawn_opts[2]);
  393. ==  }
  394. // SPV-017H START
  395.    if (!exist("017H.$$$")) {
  396.      outchr(12);
  397.      npr("5Searching for any unvalidated strings in 1%s5.0",
  398.           RAN_FILENAME);
  399.      nl();
  400.      for (i=0;i<=num_strings(RAN_FILENUMB);i++) {
  401.        npr("9%3d\b\b\b0",i);
  402.        sprintf(s,get_stringx(RAN_FILENUMB,i));
  403.        if (s[0]=='»') {
  404.          if ((note=fsh_open("017H.$$$","wt"))!=NULL) {
  405.            fprintf(note,"There are unvalidated strings in %s...",
  406.                          RAN_FILENAME);
  407.            fputs("\n\n",note);
  408.            fprintf(note,"Do not delete this file!");
  409.            fsh_close(note);
  410.          } else {
  411.            sprintf(s,
  412.           "6%%% 2Unable to create 017H.$$$ in your main BBS directory!0");
  413.            ssm(1,0,s);
  414.            sysoplog(s);
  415.          }
  416.          break;
  417.        }
  418.      }
  419.    }
  420. // SPV-017H END
  421. == }
  422. ─────────────────────────────────────────────────────────────────────────────
  423. STEP 9: Recompile the whole source.
  424. ─────────────────────────────────────────────────────────────────────────────
  425. There are 4 different calls to this modification.  They are as follows:
  426.  
  427.   ran_strings(0);  -- This will print a saying like:
  428.  
  429.   A saying for Papa Bear from StarPort Valhalla:
  430.   "No wanna work, wanna bang on keyboard!"
  431.  
  432.   ran_strings(1);  -- This will allow the user to enter their own saying.
  433.  
  434.   ran_strings(2);  -- This prints ALL the sayings in the STR file.
  435.  
  436.   ran_strings(3);  -- This prints ONE saying, perfect for above prompt use.
  437. ─────────────────────────────────────────────────────────────────────────────
  438.   If you use this, do me a favor and tell me (its a GREAT ego inflator!).
  439.   If you install this, and it doesn't work, E-Mail me and I'll try to help
  440. you figure out WHY it doesn't work.
  441.   If it prints strings out that apprear in OTHER .STR files besides the one
  442. you intended, MAKE SURE YOU HAVE THE #define RAN_FILENUMB SET CORRECTLY. You
  443. can set it to 5 just to be safe.
  444.  
  445.     This mod is copyright 1993-1995 by Tracy Baker, aka Papa Bear, and is
  446.  distributed as freeware.  Permission is granted to distribute and post this
  447.    mod on BBS systems and online services, provided no alterations are made
  448.   (removal of message headers/taglines allowed).  This mod may contain some
  449.   parts of WWIV source code, which is copyright 1988-1994 by Wayne Bell and
  450.     licensed only to registered users of WWIV.  Use of WWIV source without
  451.      registration constitutes a license violation and could lead to legal
  452.                         prosecution and certain doom.
  453.    Shareware distributors and CD-ROM publishers may not distribute this mod
  454.  without express written permission of the Author or WWIV Software Services.
  455.  
  456. 7-9=1*6>2Pâpâ ßêâr6<1*9=7-0
  457.  
  458. 8311579.wwivnet1· 2 ╪╫9≡8║7⌐¬4¥5╓╥╖1·     ·     2▒1 ·   2▒       3(510)522-35831    ·
  459. 732.sexnet  1∙   6 ·0░░▒▒▓▓6∞0▓▒░6·2 StarPort   ▒   ▒ 2 ▒1  ·2▒   ▒ ▒1 ·2 ▒   ▒1  ·2▒     ▒ 1·
  460. 6315061.wwivlink    0 ████1 ·     .       2  ▒ ▒  ▒ ▒  ▒1 · 2▒▒▒  ▒ ▒  ▒   ▒    ▒ ▒
  461. 535079.icenet 1.  .  0 │└6·0└6· 1     ∙         2 ▒  ▒   ▒ ▒▒▒ ▒ ▒ ▒1 ·2 ▒ ▒▒▒ ▒▒▒ ▒1 ∙ 2▒
  462. ---
  463. 1If at first you don't succeed, skydiving is not for you.
  464.