//________________________________________________________________________________________________________ ; Deck Pick Test.ipt ; created 1/11/2014 10:20:22 AM // Purpose: this generator is supposed to select an animal with a random number of distinct // adjectives that describe it. This example is similar in form to a loot generator I am // making. // Note: This code runs an example of the issue I am having in a larger generator. // some of this code may not be 100% relevant but I provided it as it is a skeleton of my // greater generator's format. If run, sometimes you will see duplicates in what should be a // deck pick. Is this due to using a variable as the number of repetitions or due to the fact // that it is rolling on a deck that is a Lookup table? I can't figure out why it isn't working // and would appreciate any guidance. // *subnote- I weighted the numbers as to create more duplicates/deck picks in the calculate table. //________________________________________________________________________________________________________ Set: var = 0 // declare a global variable for the number of times to make the deck pick // makes 15 rolls on the table that makes the deck picks Table: main [@15 deck_pick_call] // this table calculates the number of adjectives, then makes variable number deck picks Table: deck_pick_call Set: var = 0 // intended to reset the variable, may be redundant shuffle: subtable // seems to be the correct usage but I cant tell since the deck picks aren't working Type: Lookup Roll: 1d100 1-50: [@calculate][when] {$var} > 0 [do][!{$var} deck >> sort >> implode]; [end]Antelope\n{var == 0} 51-100: [@calculate][when] {$var} > 0 [do][!{$var} deck >> sort >> implode]; [end]Rabbit\n{var == 0} // this is the deck to draw adjectives from from Table: deck Type: Lookup Roll: 1d100 1-30: fast 31-36: tired 37-50: slow 51: hungry 52-60: flying 61-63: eating 64-70: sneaky 71-72: slippery 73-80: round 81: dead 82-86: lively 87-99: short 100: tall // adds 2 to var until 1-60 is rolled Table: calculate Type: Lookup Roll: 1d100 1-60: \z 61-100: {var == {var} + 2}[@calculate] // add 2 and roll again