Coded Routines

There should be a couple routines below that I coded way the bleep back in the dark ages (where the year began with a 1 instead of a 2?).

{{     * I just looked at this and the copy & paste routine didn’t translate well- (“Ack!”) Maybe I’ll find time to fix it… but not today, I’ve spent like 5 hours documenting and answering friends’ questions and maybe 15 minutes doing anything productive in the game world.  }}


(( & I may have added stuff to these posts to our Yahoo Group in 2001 so nobody could copy and paste my silly routines and take credit for it)) ( )


This first one was posted almost exactly 10 years before we got the word that we had our HeroCloud site to start working in.:

=—-> :

C code for yer basic race change operations. (don’t try this at home, kids…)

Message List

Reply | Delete

Message #8 of 200 < Prev  | Next >

Looky what I found? (slightly esoteric)


coded in like 1995 with a “teach yourself to program in C” book

in one hand and a pile of reference manuals on the floor next to me.

*** New to programming? Do not assume this code is good. I

learned with this generic C compiler (which promised it could handle

files as big as they could ever get and went app-solutely ape shit if

you got anywhere near 1 meg in size.) might have had other

idiosyncrasies not common to many compilers. I just retyped the

stuff below here. (Now, July 2001), wearing bifocals that I’m not

used to, and it is part of a larger program that might have had some

bizarre “includes” way up at the top somewhere. ***

I’ll explain some details about the variable strings after the code.


{{{Two Routines listed here: “duh()” and “shapechange()” }}}

duh() /* I wanna hear Mac voices, “Victoria” or “Cellos” sing this

one to me….*/


printf(“\n (You just had a brain fart : \*You’ve sent me a message

I cannot compute.\*) “);





if ((race != Dhalgger) && (race != Faer-Elf)) /* If you can’t

morph, this won’t work.*/

{ duh(); return; }

else { printf(“\n\n You can ‘Morph’ into the following shapes : “);

morphChoice() /* I forgot what this does. */

printf(“\n\n\t 1. %s”, raceA); /* Either Dhalgger or Faer-Elf *?

printf(“\n\t 2. %s”, raceB); /* Animal form. */

printf(“\n\t 3. %s”, raceC); /* Dhalgger’s humanoid form or

Faer-Cat options. */

printf(“\n\t (4. You can remain as you are.) : “);

printf(“\n\n Please Choose [ 1-4] : “);


scanf(“%d”, &go); /* Get input. */

switch (go) /* Apply choice to visible strings step one. */

{ case (1) : { raceNow = race1; apparentRace =

raceNow(raceName,raceA); break; }

case (2) : { raceNow = race2; apparentRace =

raceNow(raceName,raceB); break; }

case (3) : { raceNow = race3; apparentRace =

raceNow(raceName,raceC); break; }

case (4) : { printf(“\n Okay, you remain in your present

form.”); return; break; }


printf(“\n You feel your stomach pulled inside out and your

nerves burn. “);

printf(“\n Forces pull you apart molecule by molecule as your

body turns to putty. “);

printf(“\n But when it’s over you feel a massive influx of

relief and renewed vigor.”);

printf(“\n You have successfully morphed into your %s form.”,


expMorph++; /* Get credit for morphing. (a meaningless stat,

unless you want to peek in from time to time to see how often

characters morph. */

namelineRaceObvOcc(); /* reassemble the line that shows name,

age, race and obvious occupation */

printf(nameline); /* print the new name line so the character

knows what he/she looks like? */

fflush(stdin); /* clean out the stacked up variable memory

cache so the computer doesn’t lag to death? */



return; /* Go back to your regularly scheduled activities. */



It’s Eleven Oh Four, do you know where your parents are?

Okay. Dhalggers and Faer-Elves got to choose their morphable

forms at character generation time.

Dhalggers ‘Normal’ form was somewhere between “Goofy” (Mickey

Mouse’s buddy) and Chewbacca. Upright Humanoids with dog heads.

(Loyal as hell, great healers, but they were not at all suited for

military occupations.)

Faer-Elves were Mustard coloured or Green skinned, spindly

little guys who put the “P” in peevish. They invented ‘Faeromancy’,

the non-lethal but extreme nuisance school of Magick. (since citizens

of the ‘Faer Realms’ were, on the whole just about immune to death,

they got real creative, and taught people how to turn whole rooms

full of PCs and NPCs to sticky smelly gorp with “Chicken Soup”

spells. Noodly things would curl around everybody and sting them,

hold them immobile and zap one or two hp out of them every now and

then. ((I should have let them morph into life sized skunks who

could dance around in glee as their spells made ‘normals’ burn their

brains out in helpless anger. ))

=====raceB choices:

Dhalggers could choose from a pure dog shape for their raceB

string: /* Capitalized to distinguish from dog npcs */

(And the room description would read “Arnold the

Weener Dog is here”.)

Doberman Sheep Dog Hound Dog Wolf Hound Weener Dog

Beagle Husky Corgy Collie

Pointer Peekinese Poodle Spaniel Pug Setter

Chihuahua (or beg an Elder for your favourite)

Faer-Elves could turn into cats:

Alley Cat Calico Cat Siamese Cat Persian Cat

Himalayan Cat Manx Tiger Cat (or ask an Elder for your favourite)

=====raceC choices:

Dhalggers’ raceC came from in-game humanoids:

Ottahrian Human Highe-Elf Forest-Elf Dark-Elf

Half-Elf (( Not Mer, Mer have racial Stun powers, I let the

Dhalgger-Ottahrians believe they had claws, but couldn’t pick locks

with them.))

Faer-Elves (the hyphen’s there because a space signalled the

end of the string to the save function and all the other variables

that got saved were out of place. it got ugly) Faer Elves 3rd form

was something like Felix the cat with psychedelic fur:

blue Faer Cat, green Faer Cat, red Faer Cat, purple Faer

Cat, they could customize their descriptions to include blue and

yellow stripes; red, orange and pink day-glo patterns, whatever… I

think they all came with obligatory dark glasses and played the


Faer Elves were encouraged to be as strange as they could be.

Vegetarian Faer Elves were expected to torture and eat mice when they

were cats and everybody was warned that they didn’t want to know what

Faer Cats ate. (Faer Cats had claws. Dhalggers were canine monsters

in their dog forms (teeth=weapon of choice) Faer Cats and the

“Khatzen” were supposed to make each other nervous and curious about

each other but were emotionally and intellectually incompatible.


C code for robots’ fighting routine tomorrow? (I think it’s all here)



Sun Jul 29, 2001 12:00 am

Show Message Option

Jim Wellington <jimwellington@******.***t>


Send Email


More coming (“soon”) :




my ancient ‘gonzer combat routine’   Message List

Reply | Delete Message #16 of 200 < Prev  | Next >


I promised (or threatened?) to post this a while back. This is stuff I was working on in 1995?

I hadn’t figured out how to add the round-time ‘ticker’ or whatever to automate the NPCs’ combat routines so they would take their swipes, then wait for whatever their round time would be, and swipe again.

I *was* trying to figure out how to add fatigue into the routines and hadn’t gotten that far yet either.

The hard drive on my old 286 has so many bad sectors that a lot of the 5 part character generator stuff is permanently lost. I took extensive notes. My ‘filing system’ is such a freakin mess it might take me months to find everything and get it in an order that *I* can understand…

Here goes nothing:

This was written with “#include <dos.h>” & other not-Mac stuff. so it is probably not instant-port -able


/* weapa would be the ready weapon your character, gonz would be the

specific robot which just decided to attack you*/

/* srand(2) is the truly random number generator on most dos based

machines, srand() would call numbers in a predetermined order so

things could be tested with predictable results*/




int a, b, c, d;


+ if (gonz > -1){}

+ srand(2);

+ a = rand();

+ attRoll = ((a%20)+sklvl01);


+ if (attRoll < 4) { printf(“\n — You Missed –“);

+ goto GonzRE;

+ }

+ if (attRoll == 4){ printf(“\n — You Barely Missed –“);

+ goto GonzRE;

+ }

++++++++++++++++++++++++++++++++++++ the above activates the gonzer’s

defenses if you attack first+++++


++++++++++++++++++++++++++++++++++++++ decides where you whack the

gonzer with your weapon+++++

if ((attRoll > 4)&&(attRoll < 9))

{ printf(“\n – You take a decent swing at its %s -“, gnzPart); }

if ((attRoll > 8)&&(attRoll < 13))

{ printf(“\n – You take a good swing at its %s -“, gnzPart); }

if ((attRoll > 12)&&(attRoll < 17))

{ printf(“\n – You take a strong swing at its %s -“, gnzPart); }

if ((attRoll > 16)&&(attRoll < 20))

{ printf(“\n — You take a amazing swing at its %s

—“, gnzPart); }

if (attRoll > 19)

{ printf(“\n — You take a CRITICAL swing at its %s

—“, gnzPart); }

++++++++++++++++++++++tells you how wonderful a swing you made+++++++++++

b = rand();

defRoll = (b%24);

if (defRoll > attRoll) { printf(“\n — But the %s blocks

your blow with its %s –“, gonzer, gWeap); goto GonzRE; }

if ((attRoll – defRoll) < 5)

{ printf(“\n – The Blow is partially Blocked -“);


gonzerHealth(); goto GonzRE; }

if ((attRoll – defRoll) < 10)

{ printf(“\n – You land a decent blow -“);


gonzerHealth(); goto GonzRE; }

if ((attRoll – defRoll) < 15)

{ printf(“\n — You connect with a damaging blow –“);


gonzerHealth(); goto GonzRE; }

if ((attRoll – defRoll) < 20)

{ printf(“\n — You land a Terrific Blow ! —“);


gonzerHealth(); goto GonzRE; }

if ((attRoll – defRoll) > 19)

{ printf(“\n +++ You land an AMAZING Blow +++”);


gonzerHealth(); goto GonzRE; }

+++++++++++++++++++++ calculates whether your wonderful swing at the

gonzer actually hit it and how much damage you might have made+++++++

GonzRE: /*actual gonzer combat routine begins here*/

if (gonzHP < 0)

{ printf(“\n Your opponent has ceased functioning.”);

silver = (silver + bounty);

gonz = 101;

strcpy (gonzer, “disabled-gonzer”);



printf(“\n — The %s swings its %s at you!”, gonzer, gWeap);

if (flyHeight > 20) { tooHigh(); return; }


c = rand();

gAttRoll = (c%20);

d = rand();

gDefRoll = (d%20);

if (gAttRoll < 4) { printf(“\n — It missed! — “);



if (gAttRoll == 4) { printf(“\n — It barely missed! — “);



gonzerParts(); /* see above in this case I cheated and let

the computer think you had the same body parts the gonzers had so it

swung its gonzerweapon at your gonzer[body]part */

if ((gAttRoll > 4) && (gAttRoll < 9))

{ printf(“\n – It’s made a decent swing at your %s – “,

gnzPart); }

if ((gAttRoll > 8) && (gAttRoll < 13))

{ printf(“\n – It’s made a good swing at your %s – “, gnzPart); }

if ((gAttRoll > 12) && (gAttRoll < 17))

{ printf(“\n – It’s made a strong swing at your %s – “,

gnzPart); }

if ((gAttRoll > 16) && (gAttRoll < 19))

{ printf(“\n – It’s made an Amazing swing at your %s –

“, gnzPart); }

if (gAttRoll > 18)

{ printf(“\n – It’s made a Critical swing at your %s –

“, gnzPart); }

if (gDefRoll > gAttRoll)

{ printf(“\n — But you’ve blocked its attack with

your %s — “, weapa); return; }

if ((gAttRoll – gDefRoll) < 5)

{ printf(“\n — You’ve partially blocked its attack

with your %s — “, weapa); goto FigureDamage; }

if ((gAttRoll – gDefRoll) < 10)

{ printf(“\n — It’s landed a decent blow — “); goto

FigureDamage; }

if ((gAttRoll – gDefRoll) > 9)

{ printf(“\n — it’s landed a damaging blow — “);

goto FigureDamage; }


else { printf(“\n Huh??? There aren’t any gonzers here…”); /* if

you try to attack something that isn’t there, you get this */




gonzerDam = ((gAttRoll – gDefRoll) + gonzDam + gonzWeapDam);

gonzerDam = (gonzerDam – armorProtection);

if (gonzerDam < 0) { gonzerDam = 0; }

if (gonzerDam < 1) { printf(“\n — But your armor absorbs all

the damage! — “); return; }

if (gonzerDam > 0) { printf(“\n — Your armor absorbs some of

the damage! — “); }

gonzerDam = (gonzerDam – bodyArmor);

if (bodyArmor > 0)

{ if (gonzerDam < 0) { gonzerDam = 0;

printf(“\n — But your thick hide

absorbs all the damage! — “); return; }

else { printf(“\n — Your thick hide absorbs some of the

damage. –“); }


printf(“\n *** You have sustained %d Points of Damage *** “, gonzerDam);

tempHP = (tempHP – gonzerDam);

printf(“\n *** You now have %d Hit Points *** “, tempHP);





printf(“\n — It glares and snorts and flails at the air –“);

printf(“\n — But it can’t quite reach you! –“);




Gonzers = Robots (from the Ymmpish language) (“Fonzers” are computers. anybody who knows German well enough to know what they call a television probably thinks the jump from [phonetic:] ‘Fonz Apparat’ to Fonzer is worth groaning about. I didn’t even realize I was subconsciously patterning lots of Ymmpish Humour after (more than slightly warped) Yiddish humour until years later. ((I’ve had dreams in which I thought I was being in informed that I had lived in Egyptian times as some kind of priest class initiate, meditating in pitch blackness under the great pyramid, was some kind of ascetic Jew in a commune something like the guys who wrote the dead sea scrolls, and I was also a Hindu Indian who was conquered by Moslems and initiated into some kind of Sufi Group and was sort of presented to some kind of a Sheik’s daughter at some kind of banquet. she danced for me? (and later she told me about how her family had been persecuted by various religious groups, and she was cute so I was sympathetic as hell.) I was staring at hills that look like Afghanistan and feeling wonderful that I belonged to a new culture that believed that everybody was equal, where the caste system was seen as a ridiculous waste of human potential)).

No more aside stuff: (well, almost….)

I **did not** get far enough to figure out how local variables and global variables would figure into the combat routines. (A lot of things came to a grinding halt when my father died that year) (—> and since then, I have felt this near-paranoia, like everything I wanted to do was being pulled just a couple silly millimeters beyond my grasp. If I had the $500.00 I needed to buy something, it was suddenly repriced to $550.00, If I got a bargain on some kind of software, all of a sudden that software was worse than obsolete, it would crash whatever I wanted to do… stuff like that.)

the “tooHigh()” routine was based on feet, not meters. any flying creature more than 20 feet above the ground would frustrate the “gonzers”, be beyond reach, but could swoop in and slash with talons or stay in the air and try to hit the ‘gonzers’ with crossbows or other ranged weapons (with a % disadvantage that vanished when the character reached xbow or bow skills above level 5, –> figured the flying characters had to concentrate extra hard and work extra hard to get experience so they would be as good in the air as most characters were on the ground by the time they made it to level 5) (and they would have to know more about subtle air currents than ‘walkers’ and would learn to take advantage of that by level 5. I thought about tossing another disadvantage to flying characters’ ranged weapons abilities by like giving them another variable to roll against until their flying skills were above level 10. but there was darned little they could do with their flying skills besides show off, fly in figure 8’s above the ground, take off and land… it was much more cosmetic than real skill stuff.

*****If I had figured out how to tell the game to count to whatever the “gonzer’s” round time was and swing again that would have gone in between the *** You now have %d Hit Points *** and “return;” ***The npcs would continue to fight until they were killed, passed out from lack of fatigue points or won. I never thought of having some of them knock characters out and rob them until just now. (walk off with their readied weapon? steal a couple gold coins?)

I think I mentioned that most PC’s would have been bitten by a ‘fen dragon’ an aquatic mammal (glorified water rat?) with semi functional wings and narcotic breath, whose bodies were usually infested with a very strange virus that brought most characters who survived the fever and hallucinations back to health more quickly than npcs who hadn’t been bitten and would even bring them back from clinical death (with loss of exp and possibly a level) (or a hit point or two, which they would get back next time they trained for a higher level and made it.)

Meanwhile, the PC routine would be almost identical, but the active weapon level would have been added to the character’s Attack roll (I found it intriguing to think that most characters and NPCs were fighting against themselves with the attack roll and the defense roll being part of each character’s routine, as opposed to the robot rolls an attack roll and the PC rolls a defense roll. I really wanted to be able to conjure up a robot that would attack a PC character who might be “razzing” another PC Character for being a wimp and fighting robots instead of the real thing. I could drag out an NPC that ‘looked’ normal, but would have a fifty percent better chance of pounding the cement out of anyone it attacked, and could be set to attack certain players by invisible elders <evil grin> & the elders would (of course) be able to whisper to any potential defenders of karmic targets that they would be rendered unconscious if they tried to enter this fight.

GoodGuy steps forward to defend PottyMouth the Whiner.

Low-level-gonzer whacks GoodGuy on the head with the hilt of its Humongous Claymore.

GoodGuy flies several feet through the air and lands with a thud.

GoodGuy is unconscious.

PottyMouth tries to sneak away.

His exit is blocked.

low-level-gonzer makes an incredible swing with its humongous claymore.

PottyMouth suffers three hundred Hit Points worth of damage.

low-level-gonzer leaks putrid smelling fluids on PottyMouth’s unconscious body, grabs his fabulous wonderful amazing sword and creaks as it rolls away, sweeping up trash and looking for victims.



maybe more later?

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s