1. rpg routines

------=_NextPart_000_6e3fa5f4_76eb5530$1a23dcff

Hello,
    I haven't really contributed anything to the list this year so
far... I've always been interested in computer RPGs.  Since Paul Martin
and I have been colaborating on a RPG recently, my old unfinished ideas
have sprung up from the past to haunt me.  I like how RPGs work, the
hit/miss chance, armor class, character attributes, the whole shindig.
When Euphoria 2.1 came out it prompted me to write a few (3) RPG
functions.  They are just ways to use Euphoria's rand() function to
return values that could be meaningful in a roll playing game.  I think
that Paul has his own RPG mechanics figured out so I'm submitting these
routines to the list for the amusement of anyone that wants to take a
look at them.

The first one accepts an integer between 1 and 100 and uses it like a
percent, that percent is the chance that the function will return true.
example: hit = rand_per(53) -- 53% chance of returning true

The next one is a function that rolls VIRTUAL di and returns their total
sum.  It accepts 2 parameters; the first one is the number o di to roll
and the second is the number of sides on each di.
examples: damage = roll_di(2, 6) --could return integer from 2 to 12
          life_healed = roll_di(3, 5) --yes even odd number of sides

The last one retuns a random value between 2 range values inclusively.
The 2 values are min and max and are passed to the function in that
order. Make sure your min value is less than your max value. blink
example: weapon_base_damage = rand_range(7, 13)
         -- returns integer from 7 to 13.
         -- could be 7 or 13


I have virtually NO ERROR CHECKING for speed purposes.  If anyone finds
these routines useful and/but would like me to add error checking I can
do that easily enough.  This zip file includes a messy little
demonstration program that describes displays the results of the
functions.
Also if Rob wants to put it on the recent user's contribution page, I
wouldn't object :) and if anyone wants me to add any similar routines to
the "PACKAGE" I'd be glad to oblige.

later,
Lewis Townsend

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
------=_NextPart_000_6e3fa5f4_76eb5530$1a23dcff

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu