This may be off topic (if so you can remove).

I am creating a random item generator for my new gaming library RPG (thanks to monks for help with package yesterday). I have the program up and running, which works great, but I have a question on the data logic, if its one of the better ways?. The format/file storage is based from Andy Gryc's AutoRealm program and is detailed below.

I have not included the entire file, but the sample below easily gives its formating:

PARSEITEMNAME [wgt] => make-up-expression => make-up-expression
Where PARSEITEMNAME is the key, wgt is a weight out of 100, and the make-up-expression is an expression. The expression can contain option items in brackets [], and dice expressions in curly's {}. It can also contain markup, which I am converting over to XML.

Data Format
DAGGER [75] => <table><tr><td><b>Dagger: </b></td></tr><tr><td>POMMEL +, BLADE</td></tr></table> => <table><tr><td><b>Knife: </b></td></tr><tr><td>POMMEL, + BLADE</td></tr></table> POMMEL => with a pommel that has a POMMELTIP and a GRIP with a HILT POMMELTIP => [ANIMAL head ][with 2 GEMTYPES for eyes ]tip made of META +L, => {GEMTYPES}s set in METAL, => {1d3+1} GEMTYPES set around a METAL base, GRIP => grip made of [ADJS] SOFTMATERIAL => grip made of [ADJH] METAL HILT => hilt made of METAL[ and 2 GEMTYPES set on the ends] => a pair of {ANIMAL}s forming the hilt made of METAL

The program is passed a Key which then gets the appropriate expression, and then parses that. If it finds another Key it then parses that and returns the results in place of the key.

Other features I would like to add is the ability to determine top level Keys, so I can create a list from the data file, along with the ability to create {1d3GEMS} and rather than returning {1d3}GEMS it returns 1 to 3 GEMS.
Example:
- 2 Opals
.vs.
- Opal
- Diamond

The runtime script can be found at the following URL http://209.15.98.213/cgi-bin/items.pl

RPG is a library to aid Role Playing Gamers in creating, enhancing and running thier games. Modules under construction are RPG::Dice, RPG::RULGen, RPG::Name and RPG::Char. The data is for the RULGen module.


In reply to Data and Perl Logic by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.