home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / HATCH / WWIVNEWS.ZIP / 9304_4.NWS < prev    next >
Text File  |  1993-04-10  |  12KB  |  400 lines

  1. ───────────────┬─────────────────────────────────────────────┬───────────────
  2.                │          Filo's Mod of the Month            │
  3.                │              by Filo (1@5252)               │
  4.                └─────────────────────────────────────────────┘
  5.  
  6. The Mod-of-The-Month Selection represents my choice of what appears to be a 
  7. useful, practical mod to WWIV. It does not mean it is the best mod posted or 
  8. even that it works as I may not have tested it. Given the limitations of this
  9. media, uuencoded mods are NOT eligible for selection as mod-of-the-month.
  10.  
  11. The offerings for February contained many mods as people were updating mods 
  12. for v4.22. The one that I have selected will PROBABLY be a standard feature 
  13. in v4.23 in one form or another.
  14.  
  15. ┌────────────────────────────────────────────────────────────────────────────┐
  16. │ Mod Name: SPV-012.MOD      Mod Authors: Papa Bear 1@5079 (WWIVNet)         │
  17. │ Difficulty: Pretty darn easy                      1@15061 (WWIVlink)       │
  18. │ WWIV Version: 4.21, 4.21a, 4.22                   1@5079 (IceNET           │
  19. │ Files Affected: XINIT,BBSUTL1,VARDEC  Date: February 6, 1993               │
  20. │ Description: Allow any number of chains (stock code is limited to 50)      │
  21. └────────────────────────────────────────────────────────────────────────────┘
  22.  
  23.   Long Description:
  24.  
  25. Well, I had an urge on night, and I decided to add EVERY on-liner I had on my
  26. archive floppies to the BBS. I already had 40 odd on-line when I decided to 
  27. do this.
  28.  
  29. When I got to #50, I found that I couldn't add anymore, so I wrote this mod to
  30. allow for ANY number of chains. At one time I was running 130 (until I found 
  31. that some wouldn't run properly remotely <sigh>) chains. Now I'm right at 85.
  32.  
  33. A note here. Just like 4.22 will allow up to 999 subboards and message bases,
  34. you can have 999 chains. But, just as Wayne suggests, only define as many as 
  35. you need. Each chain defined takes up memory. So keep it close to what you 
  36. have (in other words, don't define 999 chains if you are only gonna run 60. 
  37. Instead, define maybe 70 [to give you some leeway]).
  38.  
  39. LEGEND:
  40. == unchanged, search for
  41. += modify line
  42. -- delete line
  43. ++ add line
  44.  
  45. -------
  46. STEP 0:  Backup yer source. You installed it, yer responsible.
  47.  
  48. -------
  49. STEP 1:  Open XINIT.C and change the following lines
  50.  
  51. ==  num_dirs=(read(i,directories, (max_dirs*sizeof(directoryrec))))/
  52. ==           sizeof(directoryrec);
  53. ==  close(i);
  54. ==
  55. =+  chains=(chainfilerec *) mallocx(MAX_CHAINS * sizeof(chainfilerec), "chains"
  56. );
  57. ==  numextrn=0;
  58. ==  numchain=0;
  59. ==  numed=0;
  60. ==  sprintf(s,"%sCHAINS.DAT",syscfg.datadir);
  61. ==  i=open(s,O_RDWR | O_BINARY);
  62. ==  if (i>0) {
  63. =+    numchain=(read(i,(void *)chains, MAX_CHAINS*sizeof(chainfilerec)))/sizeof
  64. (chainfilerec);
  65. ==    numchain=numchain;
  66. ==    close(i);
  67. ==  }
  68.  
  69.   (Change the 50 in those to lines to MAX_CHAINS.)
  70.  
  71. -------
  72. STEP 2:  Open BBSUTL1.C and change the line
  73.  
  74. ==void do_chains(void)
  75. =={
  76. =+  int map[MAX_CHAINS],mapp,i,i1,ok,done;  /* change 50 to MAX_CHAINS */
  77. ==  char s[81],s1[81],*ss;
  78. ==  chainfilerec c;
  79.  
  80. -------
  81. STEP 3:  Still in BBSUTL1.C, you *may* want to change these lines
  82.  
  83. ==  show_chains(&mapp,map);
  84. ==  done=0;
  85. ==  do {
  86. ==    prt(2,get_string(621));
  87. =+    mpl(3);                /* NOTE 1 */
  88. --    ss=mmkey(0);           /* NOTE 2 */
  89. ++    input(ss,3);           /* NOTE 3 */
  90. ==    i=atoi(ss);
  91. ==    if ((i>0) && (i<=mapp)) {
  92. ==      done=1;
  93. ==      run_chain(map[i-1]);
  94.  
  95. NOTES:
  96. -----
  97. NOTE 1 - If running more than 99 chains change the 2 to a 3 in the mpl(2); 
  98. statement. *This mpl(2); may note be there.*  I have a habit of adding mpl's 
  99. before all my input and mmkey lines. If it is not in yours, ignore this. (Or 
  100. add it, it'll work.)
  101.  
  102. NOTE 2 - Again, if more than 99 chains, this has got to go. Otherwise you'll 
  103. never be able to run any chain over 99.
  104.  
  105. NOTE 3 - Here's the line if using more than 99 chains. Effectively replaces 
  106. the mmkey line above it. You'll now have to press enter to execute any chain.
  107. (Where mmkey would do it for you in certain circumstances.)
  108.  
  109. -------
  110. STEP 4:  Open VARDEC.H and add this line
  111.  
  112. == #define max_buf 1024
  113. == #define MSG_COLOR 0
  114. == #define MAX_FILES 61
  115. == #define MAX_BATCH 50
  116. ++ #define MAX_CHAINS 96        /* NOTE */
  117. ==
  118. == #define INT_REAL_DOS 0x21
  119.  
  120. NOTE - this is where you specify the number of chains you want. You can 
  121. increase or decrease this as needed (although you'll suffer through a complete
  122. recompile each time you do). Remember, in the interests of saving memory, keep
  123. this reasonably close to the number of chains you actually plan on having. I 
  124. have it set to 86, and I run 85 chains. You do not have to do this in 32 chain 
  125. increments like the subboards and directories. You can put 90 if you wanted, 
  126. but I would stick to a 32 chain increment (32,64,96,128, etc.) just in case.
  127.  
  128. -------
  129. STEP 5:  Do a complete recompile.
  130.  
  131.  
  132. I've been using this mod for over a month now with ZERO problems. I waited to 
  133. release it to see if Wayne changed the way the chains were handled, and he 
  134. didn't. So this will definitely work on 4.21, 4.21a, 4.22 and even possibly 
  135. for versions before those.
  136.  
  137. As always, if you use this I'd like to hear from you. If you are having 
  138. problems, I'll give you all the help I can.
  139.  
  140. ─────────────────────────────────────────────────────────────────────────────
  141.  
  142. The selection for March comes from Frank Reid in Spain. Frank has adapted Doug
  143. Field's logoff lottery to v4.22, and improved it significantly.
  144.  
  145. ┌───────────────────────────────────────────────────────────────────────────┐
  146. │ Mod Name: FR016.MOD         Mod Author: Frank Reid 1@870                  │
  147. │ Difficulty: Novice Modder         Date: March 14, 1993                    │
  148. │ WWIV Version: 4.22                                                        │
  149. │ Files Affected: BBS.C BBSUTL1.C FCNS.H                                    │
  150. │ Description: The Lucky Lotto!  Four number lottery to play at logoff or   │
  151. │ wherever else you might want!                                             │
  152. └───────────────────────────────────────────────────────────────────────────┘
  153.  
  154. This mod is based (loosely) upon Doug Field's Logoff Lottery of many moons 
  155. ago. It incorporates some routines from The Flying Chicken's TFC019.MOD Slot 
  156. Machine mod. As provided, the mod is very simple, and usable by both ANSI and 
  157. non-ANSI users. Using the functions from Tolkien's enhance.c you can really 
  158. spruce this one up, but I'll leave that to you!  
  159.  
  160. Okay, on with the mod.
  161. The following notations are used:
  162.  
  163. ==  Existing 
  164. =+  Modified 
  165. ++  Added 
  166. --  Deleted
  167.  
  168. ─────────────────────────────────────────────────────────────────────────────
  169.  
  170. ** Step 1 **
  171.  
  172. Open <BBS.C>
  173.  
  174. Search for void mainmenu(void), then search for "case 'O'" and make the 
  175. indicated changes:
  176.  
  177. ==      case 'O':
  178. ==        nl();
  179. ==        nl();
  180. ==        prt(5,get_string(28));
  181. ==        helpl=12;
  182. ==        if (yn()) {
  183. ++          prt(5,"Try the Lucky Lotto? ");
  184. ++          if (yn())
  185. ++            lotto();      
  186. ==          outchr(12);
  187. ==          outstr(get_string(29));
  188.  
  189. Hop down to void dlmainmenu(void), find "case 'O'" again and change:
  190.  
  191. ==      case 'O':
  192. ==        helpl=12;
  193. ==        nl();
  194. ==        nl();
  195. ==        prt(5,get_string(28));
  196. ==        if (yn()) {
  197. ++          prt(5,"Try the Lucky Lotto? ");
  198. ++          if (yn())
  199. ++            lotto();
  200. ==          outchr(12);
  201.  
  202. Save <BBS.C>
  203.  
  204. *** Step Two ***
  205.  
  206. File <BBSUTL1.C>
  207.  
  208. At the top of the file, search and add the following #include:
  209.  
  210. == #pragma hdrstop
  211.  
  212. ++ #include <ctype.h>
  213.  
  214. == int ok_local(void)
  215. Ctrl-PgDn to the very bottom of the file, and add the following function:
  216.  
  217. /* Begin Block Read */
  218. void lotto(void)
  219. {
  220.   char            s[5], sr[5], stemp[5], s1[81], s2[81], ch;
  221.   int             i, j, matches, any, done, bet, l0, l1, l2, l3;
  222.  
  223.   matches = any = done = 0;
  224.   if (thisuser.gold > 10) {
  225.     while (!done && !hangup) {
  226.       done = 1;
  227.       nl();
  228.       pl("------= Lucky Lotto =------");
  229.       pl("| Jackpot:      5000 Gold |");
  230.       pl("| Four Any Order: 16 to 1 |");
  231.       pl("| Three Numbers:   9 to 1 |");
  232.       pl("| Two Numbers:     4 to 1 |");
  233.       pl("| One Number: Returns Bet |");
  234.       pl("--------------------------- ");
  235.       nl();
  236.       prt(5, "Enter your Lucky Lotto number: ");
  237.       mpl(4);
  238.       input(s, 4);
  239.       if (strlen(s) < 4)
  240.      done = 0;
  241.       for (i = 0; i <= 3; i++)
  242.      if (!isdigit(s[i]))
  243.        done = 0;
  244.       if (!done) {
  245.      ansic(6);
  246.      pl("Enter a four digit number only!");
  247.      wait(1.0);
  248.       }
  249.     }
  250.     done = 0;
  251.     do {
  252.       bet = 0;
  253.       sprintf(s1, "Gold Remaining: %d", (int) thisuser.gold);
  254.       ansic(3);
  255.       pl(s1);
  256.       prt(5, "Enter Your Wager: ");
  257.       mpl(4);
  258.       input(s1, 3);
  259.       bet = atoi(s1);
  260.       if ((thisuser.gold / 2) >= bet)
  261.      done = 1;
  262.       else {
  263.      ansic(6);
  264.      pl("You may bet up to half your gold!");
  265.       }
  266.     } while ((!done) && (!hangup));
  267.     thisuser.gold -= bet;
  268.  
  269.     ansic(2);
  270.     pl("Dropping the Balls...");
  271.     ansic(3);
  272.     npr("* * * *\b\b\b\b\b\b\b");
  273.  
  274.     for (i = 0; i <= 3; i++)
  275.       sr[i] = (rand() % 10) + '0';
  276.  
  277.     sr[4] = 0;
  278.     strcpy(stemp, sr);
  279.     l3 = atoi(&(stemp[3]));
  280.     stemp[3] = 0;
  281.     l2 = atoi(&(stemp[2]));
  282.     stemp[2] = 0;
  283.     l1 = atoi(&(stemp[1]));
  284.     stemp[1] = 0;
  285.     l0 = atoi(&(stemp[0]));
  286.     stemp[0] = 0;
  287.  
  288.     j = 0;
  289.     do {
  290.       ansic(0);
  291.       i = (random(10));
  292.       npr("%d\b", i);
  293.       j++;
  294.     } while (j < 1000);
  295.     ansic(2);
  296.     npr("%d ", l0);
  297.  
  298.     j = 0;
  299.     do {
  300.       ansic(0);
  301.       i = (random(10));
  302.       npr("%d\b", i);
  303.       j++;
  304.     } while (j < 1000);
  305.     ansic(2);
  306.     npr("%d ", l1);
  307.  
  308.     j = 0;
  309.     do {
  310.       ansic(0);
  311.       i = (random(10));
  312.       npr("%d\b", i);
  313.       j++;
  314.     } while (j < 1000);
  315.     ansic(2);
  316.     npr("%d ", l2);
  317.  
  318.     j = 0;
  319.     do {
  320.       ansic(0);
  321.       i = (random(10));
  322.       npr("%d\b", i);
  323.       j++;
  324.     } while (j < 1000);
  325.     ansic(2);
  326.     npr("%d ", l3);
  327.  
  328.  
  329.     for (i = 0; i <= 3; i++) {
  330.       if (sr[i] == s[i])
  331.      matches++;
  332.     }
  333.  
  334.     for (i = 0; i <= 3; i++)
  335.       for (j = 0; j <= 3; j++)
  336.      if (sr[i] == s[j])
  337.        any++;
  338.  
  339.  
  340.     nl();
  341.     sprintf(s1, "Number: %s, Wager: %d, Lotto: %s, Matches: %d.",
  342.          s, bet, sr, matches);
  343.     ansic(3);
  344.     pl(s1);
  345.     if (matches)
  346.       if (matches == 4) {
  347.      sprintf(s1, "J-A-C-K-P-O-T! You just won 5000 gold pieces!");
  348.      thisuser.gold += 5000;
  349.      sprintf(s2, "*** Hit Lucky Lotto Jackpot. Received 5000 gold.");
  350.       } else {
  351.      if (any != 16) {
  352.        if (matches == 1) {
  353.          sprintf(s1, "You saved your bet of %d gold pieces!",
  354.               (matches * matches * bet));
  355.          thisuser.gold += (float) (matches * matches * bet);
  356.          sprintf(s2, "*** Played Lucky Lotto: Won: %d, Net gain: %d.",
  357.           (matches * matches * bet), (matches * matches * bet) - bet);
  358.        } else {
  359.          sprintf(s1, "You've just won %d gold pieces!",
  360.               (matches * matches * bet));
  361.          thisuser.gold += (float) (matches * matches * bet);
  362.          sprintf(s2, "*** Played Lucky Lotto: Won: %d, Net gain: %d.",
  363.           (matches * matches * bet), (matches * matches * bet) - bet);
  364.        }
  365.      } else {
  366.        sprintf(s1, "Got all four in any order!  You win %d gold pieces!",
  367.             (any * bet));
  368.        thisuser.gold += (float) (any * bet);
  369.        sprintf(s2, "*** Played Lucky Lotto: Won: %d, Net gain: %d.",
  370.             (any * bet), (any * bet) - bet);
  371.      }
  372.     } else
  373.       sprintf(s1, "Sorry, you didn't win any gold");
  374.     ansic(2);
  375.     pl(s1);
  376.     pausescr();
  377.     sysoplog(s2);
  378.     return;
  379.   } else
  380.     pl("Sorry, you need at least 10 gold to play the Lucky Lotto!");
  381. }
  382. /* End Block Read */
  383.  
  384. *** Step Three ***
  385.  
  386. This is not necessary if you can/do use "MAKE FCNS" from the command line.
  387.  
  388. Open <FCNS.H>
  389.  
  390. Search for /* File: bbsutl1.c */ and add the new function:
  391.  
  392. == void show_chains(int *mapp, int *map);
  393. == void run_chain(int cn);
  394. == void do_chains(void);
  395. ++ void lotto(void);
  396.  
  397. Your done. Recompile and drop me a note to say "Hi!" 
  398.  
  399.  
  400.