Wierd Results when passing parameters

So I have created a random generator that passes some parameters. Everything seems to be in order, however I am noticing about 70% of the I am getting numerical values (when there should be none) from a parameter variable that I am passing. It makes no sense to me.

Use: Common\Eberron\Treasure\Magic Items\Magic Item Files.ipt
// Magic Items results
Table: Hoard Magic 5-10
25: [@[|{1d6}|{1d8}] MagicLoot with both, Item, [|Common|Uncommon]]
Endtable:

// Find the proper magical item subtables to pull mahic items from
Table: MagicLoot
Define: ItemFrequency =[@Magic Item {$3}]
Define: ItemLevel = [when] {$1} = both [do][@Magic Item Level][else]{$1}[end] 
8:<li>[@{ItemLevel}{$2} {ItemFrequency} >> implode </li><li>]</li>
Endtable:

Table:Magic Item Common
2:Common
Uncommon
Endtable:

Table:Magic Item Uncommon
2:Uncommon
Rare
Endtable:

Table: Magic Item Level
Minor
Major
Endtable:

What I am noticing is that about 70% of the time the result of the {$1} variable (the parameter that is passed as both) it shows up as a numerical value from 1 to 5. This also happens when I change it to pass as either minor or major. I am not sure why this is happening.

So the result that comes out should be looking up for a value in either Minor Item (Un)Common or Major Item (Un)Common. About 70% of the time it is trying to look up 1 item common or 3 item common. I have no idea how that is happening.

Can anyone help me out with this?

Here are some info that is in the Magic Item Files.ipt

Table: Minor Item Common
[@Minor Potion Common]
Endtable:

Table: Minor Potion Common
Potion of Climbing <i>(DMG)</i>
Potion of Healing <i>(DMG)</i>
Endtable:

Table: Minor Item Uncommon
[@Minor Armor Uncommon]
Endtable:

Table: Minor Armor Uncommon
Mariner's Armor <i>(DMG)</i>
Mithral Armor <i>(DMG)</i>
Endtable:

Table: Major Item Common
[@Major Wand Common]
Endtable:

Table: Major Wand Common
Wand of Magic Missiles <i>(DMG)</i>
Wand of the War Mage, +1 <i>(DMG)</i>
Wand of Web <i>(DMG)</i>
Endtable:

Table: Major Item Uncommon
[@Major Armor Uncommon]
Endtable:

Table: Major Armor Uncommon
adamantine armor <i>(DMG)</i>
sentinel shield <i>(DMG)</i>
shield, +1 <i>(DMG)</i>
Endtable:

Comments

  • I can give it a look in a day or two.

  • I was able to figure out what was going on. I gave abbreviated info from the Magic Items Files. And there was some parameters being passed that was resetting the first one.

    I was able to find a different way to code to to avoid that happening.

Leave a Comment