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 >
Wrap
Text File
|
1993-04-10
|
12KB
|
400 lines
───────────────┬─────────────────────────────────────────────┬───────────────
│ Filo's Mod of the Month │
│ by Filo (1@5252) │
└─────────────────────────────────────────────┘
The Mod-of-The-Month Selection represents my choice of what appears to be a
useful, practical mod to WWIV. It does not mean it is the best mod posted or
even that it works as I may not have tested it. Given the limitations of this
media, uuencoded mods are NOT eligible for selection as mod-of-the-month.
The offerings for February contained many mods as people were updating mods
for v4.22. The one that I have selected will PROBABLY be a standard feature
in v4.23 in one form or another.
┌────────────────────────────────────────────────────────────────────────────┐
│ Mod Name: SPV-012.MOD Mod Authors: Papa Bear 1@5079 (WWIVNet) │
│ Difficulty: Pretty darn easy 1@15061 (WWIVlink) │
│ WWIV Version: 4.21, 4.21a, 4.22 1@5079 (IceNET │
│ Files Affected: XINIT,BBSUTL1,VARDEC Date: February 6, 1993 │
│ Description: Allow any number of chains (stock code is limited to 50) │
└────────────────────────────────────────────────────────────────────────────┘
Long Description:
Well, I had an urge on night, and I decided to add EVERY on-liner I had on my
archive floppies to the BBS. I already had 40 odd on-line when I decided to
do this.
When I got to #50, I found that I couldn't add anymore, so I wrote this mod to
allow for ANY number of chains. At one time I was running 130 (until I found
that some wouldn't run properly remotely <sigh>) chains. Now I'm right at 85.
A note here. Just like 4.22 will allow up to 999 subboards and message bases,
you can have 999 chains. But, just as Wayne suggests, only define as many as
you need. Each chain defined takes up memory. So keep it close to what you
have (in other words, don't define 999 chains if you are only gonna run 60.
Instead, define maybe 70 [to give you some leeway]).
LEGEND:
== unchanged, search for
+= modify line
-- delete line
++ add line
-------
STEP 0: Backup yer source. You installed it, yer responsible.
-------
STEP 1: Open XINIT.C and change the following lines
== num_dirs=(read(i,directories, (max_dirs*sizeof(directoryrec))))/
== sizeof(directoryrec);
== close(i);
==
=+ chains=(chainfilerec *) mallocx(MAX_CHAINS * sizeof(chainfilerec), "chains"
);
== numextrn=0;
== numchain=0;
== numed=0;
== sprintf(s,"%sCHAINS.DAT",syscfg.datadir);
== i=open(s,O_RDWR | O_BINARY);
== if (i>0) {
=+ numchain=(read(i,(void *)chains, MAX_CHAINS*sizeof(chainfilerec)))/sizeof
(chainfilerec);
== numchain=numchain;
== close(i);
== }
(Change the 50 in those to lines to MAX_CHAINS.)
-------
STEP 2: Open BBSUTL1.C and change the line
==void do_chains(void)
=={
=+ int map[MAX_CHAINS],mapp,i,i1,ok,done; /* change 50 to MAX_CHAINS */
== char s[81],s1[81],*ss;
== chainfilerec c;
-------
STEP 3: Still in BBSUTL1.C, you *may* want to change these lines
== show_chains(&mapp,map);
== done=0;
== do {
== prt(2,get_string(621));
=+ mpl(3); /* NOTE 1 */
-- ss=mmkey(0); /* NOTE 2 */
++ input(ss,3); /* NOTE 3 */
== i=atoi(ss);
== if ((i>0) && (i<=mapp)) {
== done=1;
== run_chain(map[i-1]);
NOTES:
-----
NOTE 1 - If running more than 99 chains change the 2 to a 3 in the mpl(2);
statement. *This mpl(2); may note be there.* I have a habit of adding mpl's
before all my input and mmkey lines. If it is not in yours, ignore this. (Or
add it, it'll work.)
NOTE 2 - Again, if more than 99 chains, this has got to go. Otherwise you'll
never be able to run any chain over 99.
NOTE 3 - Here's the line if using more than 99 chains. Effectively replaces
the mmkey line above it. You'll now have to press enter to execute any chain.
(Where mmkey would do it for you in certain circumstances.)
-------
STEP 4: Open VARDEC.H and add this line
== #define max_buf 1024
== #define MSG_COLOR 0
== #define MAX_FILES 61
== #define MAX_BATCH 50
++ #define MAX_CHAINS 96 /* NOTE */
==
== #define INT_REAL_DOS 0x21
NOTE - this is where you specify the number of chains you want. You can
increase or decrease this as needed (although you'll suffer through a complete
recompile each time you do). Remember, in the interests of saving memory, keep
this reasonably close to the number of chains you actually plan on having. I
have it set to 86, and I run 85 chains. You do not have to do this in 32 chain
increments like the subboards and directories. You can put 90 if you wanted,
but I would stick to a 32 chain increment (32,64,96,128, etc.) just in case.
-------
STEP 5: Do a complete recompile.
I've been using this mod for over a month now with ZERO problems. I waited to
release it to see if Wayne changed the way the chains were handled, and he
didn't. So this will definitely work on 4.21, 4.21a, 4.22 and even possibly
for versions before those.
As always, if you use this I'd like to hear from you. If you are having
problems, I'll give you all the help I can.
─────────────────────────────────────────────────────────────────────────────
The selection for March comes from Frank Reid in Spain. Frank has adapted Doug
Field's logoff lottery to v4.22, and improved it significantly.
┌───────────────────────────────────────────────────────────────────────────┐
│ Mod Name: FR016.MOD Mod Author: Frank Reid 1@870 │
│ Difficulty: Novice Modder Date: March 14, 1993 │
│ WWIV Version: 4.22 │
│ Files Affected: BBS.C BBSUTL1.C FCNS.H │
│ Description: The Lucky Lotto! Four number lottery to play at logoff or │
│ wherever else you might want! │
└───────────────────────────────────────────────────────────────────────────┘
This mod is based (loosely) upon Doug Field's Logoff Lottery of many moons
ago. It incorporates some routines from The Flying Chicken's TFC019.MOD Slot
Machine mod. As provided, the mod is very simple, and usable by both ANSI and
non-ANSI users. Using the functions from Tolkien's enhance.c you can really
spruce this one up, but I'll leave that to you!
Okay, on with the mod.
The following notations are used:
== Existing
=+ Modified
++ Added
-- Deleted
─────────────────────────────────────────────────────────────────────────────
** Step 1 **
Open <BBS.C>
Search for void mainmenu(void), then search for "case 'O'" and make the
indicated changes:
== case 'O':
== nl();
== nl();
== prt(5,get_string(28));
== helpl=12;
== if (yn()) {
++ prt(5,"Try the Lucky Lotto? ");
++ if (yn())
++ lotto();
== outchr(12);
== outstr(get_string(29));
Hop down to void dlmainmenu(void), find "case 'O'" again and change:
== case 'O':
== helpl=12;
== nl();
== nl();
== prt(5,get_string(28));
== if (yn()) {
++ prt(5,"Try the Lucky Lotto? ");
++ if (yn())
++ lotto();
== outchr(12);
Save <BBS.C>
*** Step Two ***
File <BBSUTL1.C>
At the top of the file, search and add the following #include:
== #pragma hdrstop
++ #include <ctype.h>
== int ok_local(void)
Ctrl-PgDn to the very bottom of the file, and add the following function:
/* Begin Block Read */
void lotto(void)
{
char s[5], sr[5], stemp[5], s1[81], s2[81], ch;
int i, j, matches, any, done, bet, l0, l1, l2, l3;
matches = any = done = 0;
if (thisuser.gold > 10) {
while (!done && !hangup) {
done = 1;
nl();
pl("------= Lucky Lotto =------");
pl("| Jackpot: 5000 Gold |");
pl("| Four Any Order: 16 to 1 |");
pl("| Three Numbers: 9 to 1 |");
pl("| Two Numbers: 4 to 1 |");
pl("| One Number: Returns Bet |");
pl("--------------------------- ");
nl();
prt(5, "Enter your Lucky Lotto number: ");
mpl(4);
input(s, 4);
if (strlen(s) < 4)
done = 0;
for (i = 0; i <= 3; i++)
if (!isdigit(s[i]))
done = 0;
if (!done) {
ansic(6);
pl("Enter a four digit number only!");
wait(1.0);
}
}
done = 0;
do {
bet = 0;
sprintf(s1, "Gold Remaining: %d", (int) thisuser.gold);
ansic(3);
pl(s1);
prt(5, "Enter Your Wager: ");
mpl(4);
input(s1, 3);
bet = atoi(s1);
if ((thisuser.gold / 2) >= bet)
done = 1;
else {
ansic(6);
pl("You may bet up to half your gold!");
}
} while ((!done) && (!hangup));
thisuser.gold -= bet;
ansic(2);
pl("Dropping the Balls...");
ansic(3);
npr("* * * *\b\b\b\b\b\b\b");
for (i = 0; i <= 3; i++)
sr[i] = (rand() % 10) + '0';
sr[4] = 0;
strcpy(stemp, sr);
l3 = atoi(&(stemp[3]));
stemp[3] = 0;
l2 = atoi(&(stemp[2]));
stemp[2] = 0;
l1 = atoi(&(stemp[1]));
stemp[1] = 0;
l0 = atoi(&(stemp[0]));
stemp[0] = 0;
j = 0;
do {
ansic(0);
i = (random(10));
npr("%d\b", i);
j++;
} while (j < 1000);
ansic(2);
npr("%d ", l0);
j = 0;
do {
ansic(0);
i = (random(10));
npr("%d\b", i);
j++;
} while (j < 1000);
ansic(2);
npr("%d ", l1);
j = 0;
do {
ansic(0);
i = (random(10));
npr("%d\b", i);
j++;
} while (j < 1000);
ansic(2);
npr("%d ", l2);
j = 0;
do {
ansic(0);
i = (random(10));
npr("%d\b", i);
j++;
} while (j < 1000);
ansic(2);
npr("%d ", l3);
for (i = 0; i <= 3; i++) {
if (sr[i] == s[i])
matches++;
}
for (i = 0; i <= 3; i++)
for (j = 0; j <= 3; j++)
if (sr[i] == s[j])
any++;
nl();
sprintf(s1, "Number: %s, Wager: %d, Lotto: %s, Matches: %d.",
s, bet, sr, matches);
ansic(3);
pl(s1);
if (matches)
if (matches == 4) {
sprintf(s1, "J-A-C-K-P-O-T! You just won 5000 gold pieces!");
thisuser.gold += 5000;
sprintf(s2, "*** Hit Lucky Lotto Jackpot. Received 5000 gold.");
} else {
if (any != 16) {
if (matches == 1) {
sprintf(s1, "You saved your bet of %d gold pieces!",
(matches * matches * bet));
thisuser.gold += (float) (matches * matches * bet);
sprintf(s2, "*** Played Lucky Lotto: Won: %d, Net gain: %d.",
(matches * matches * bet), (matches * matches * bet) - bet);
} else {
sprintf(s1, "You've just won %d gold pieces!",
(matches * matches * bet));
thisuser.gold += (float) (matches * matches * bet);
sprintf(s2, "*** Played Lucky Lotto: Won: %d, Net gain: %d.",
(matches * matches * bet), (matches * matches * bet) - bet);
}
} else {
sprintf(s1, "Got all four in any order! You win %d gold pieces!",
(any * bet));
thisuser.gold += (float) (any * bet);
sprintf(s2, "*** Played Lucky Lotto: Won: %d, Net gain: %d.",
(any * bet), (any * bet) - bet);
}
} else
sprintf(s1, "Sorry, you didn't win any gold");
ansic(2);
pl(s1);
pausescr();
sysoplog(s2);
return;
} else
pl("Sorry, you need at least 10 gold to play the Lucky Lotto!");
}
/* End Block Read */
*** Step Three ***
This is not necessary if you can/do use "MAKE FCNS" from the command line.
Open <FCNS.H>
Search for /* File: bbsutl1.c */ and add the new function:
== void show_chains(int *mapp, int *map);
== void run_chain(int cn);
== void do_chains(void);
++ void lotto(void);
Your done. Recompile and drop me a note to say "Hi!"