multiColumnMenu() Demo

What is multiColumnMenu() Demo?

Feed 3 simpleTables into a joinPool, classy hillarity ensues

Example

Result:

How the Template Works

The code for this demo creates an object showcasing a feature of the RollPlayer.js library and returns it to the template as demo.rollable. Both when the page loads and when the button above is pressed the template code calls demo.rollable.roll() and the returned result is displayed above. This process is identicle for all the demos allowing the explanations below to focus on only the object being demoed.

Every result is also logged to the console if you want to see a history after a bunch of button clicks.

Version

1.0

Authors

  • Derek Pennycuff

Full source

  1. 1: var demo = function() {
  2. 2: var c1 = RollPlayer.simpleTable('artless', 'bawdy', 'beslubbering',
  3. 3: 'bootless', 'churlish', 'cockered', 'clouted', 'craven',
  4. 4: 'currish', 'dankish', 'dissembling', 'droning', 'errant',
  5. 5: 'fawning', 'fobbing', 'froward', 'frothy', 'gleeking',
  6. 6: 'goatish', 'gorbellied', 'impertinent', 'infectious',
  7. 7: 'jarring', 'loggerheaded', 'lumpish', 'mammering',
  8. 8: 'mangled', 'mewling', 'paunchy', 'pribbling', 'puking',
  9. 9: 'puny', 'qualling', 'rank', 'reeky', 'roguish', 'ruttish',
  10. 10: 'saucy', 'spleeny', 'spongy', 'surly', 'tottering',
  11. 11: 'unmuzzled', 'vain', 'venomed', 'villainous', 'warped',
  12. 12: 'wayward', 'weedy', 'yeasty');
  13. 13: var c2 = RollPlayer.simpleTable('base-court', 'bat-fowling',
  14. 14: 'beef-witted', 'beetle-headed', 'boil-brained',
  15. 15: 'clapper-clawed', 'clay-brained', 'common-kissing',
  16. 16: 'crook-pated', 'dismal-dreaming', 'dizzy-eyed',
  17. 17: 'doghearted', 'dread-bolted', 'earth-vexing',
  18. 18: 'elf-skinned', 'fat-kidneyed', 'fen-sucking',
  19. 19: 'flap-mouthed', 'fly-bitten', 'folly-fallen', 'fool-born',
  20. 20: 'full-gorged', 'guts-griping', 'half-faced',
  21. 21: 'hasty-witted', 'hedge-born', 'hell-hated', 'idle-headed',
  22. 22: 'ill-breeding', 'ill-nurtured', 'knotty-pated',
  23. 23: 'milk-livered', 'motley-minded', 'onion-eyed',
  24. 24: 'plume-plucked', 'pottle-deep', 'pox-marked',
  25. 25: 'reeling-ripe', 'rough-hewn', 'rude-growing', 'rump-fed',
  26. 26: 'shard-borne', 'sheep-biting', 'spur-galled',
  27. 27: 'swag-bellied', 'tardy-gaited', 'tickle-brained',
  28. 28: 'toad-spotted', 'unchin-snouted', 'weather-bitten');
  29. 29: var c3 = RollPlayer.simpleTable('apple-john', 'baggage', 'barnacle',
  30. 30: 'bladder', 'boar-pig', 'bugbear', 'bum-bailey',
  31. 31: 'canker-blossom', 'clack-dish', 'clotpole', 'coxcomb',
  32. 32: 'codpiece', 'death-token', 'dewberry', 'flap-dragon',
  33. 33: 'flax-wench', 'flirt-gill', 'foot-licker', 'fustilarian',
  34. 34: 'giglet', 'gudgeon', 'haggard', 'harpy', 'hedge-pig',
  35. 35: 'horn-beast', 'hugger-mugger', 'joithead', 'lewdster',
  36. 36: 'lout', 'maggot-pie', 'malt-worm', 'mammet', 'measle',
  37. 37: 'minnow', 'miscreant', 'moldwarp', 'mumble-news',
  38. 38: 'nut-hook', 'pigeon-egg', 'pignut', 'puttock', 'pumpion',
  39. 39: 'ratsbane', 'scut', 'skainsmate', 'strumpet', 'varlot',
  40. 40: 'vassal', 'whey-face', 'wagtail');
  41. 41: var thou = RollPlayer.simpleTable('Thou');
  42. 42: var bard = RollPlayer.joinPool(thou, c1, c2, c3).set_separator(' ');
  43. 43: return { rollable : bard };
  44. 44: }();

Explanations

We're creating a wrapper object called demo so that the template code can access the inner workings of this particular example.

  1. 1: var demo = function() {

We're using simpleTable() to create the columns for our joinPool, but technically any rollable object produced by the RollPlayer library would work.

These strings were taken from an image I found on Science Dump

  1. 2: var c1 = RollPlayer.simpleTable('artless', 'bawdy', 'beslubbering',
  2. 3: 'bootless', 'churlish', 'cockered', 'clouted', 'craven',
  3. 4: 'currish', 'dankish', 'dissembling', 'droning', 'errant',
  4. 5: 'fawning', 'fobbing', 'froward', 'frothy', 'gleeking',
  5. 6: 'goatish', 'gorbellied', 'impertinent', 'infectious',
  6. 7: 'jarring', 'loggerheaded', 'lumpish', 'mammering',
  7. 8: 'mangled', 'mewling', 'paunchy', 'pribbling', 'puking',
  8. 9: 'puny', 'qualling', 'rank', 'reeky', 'roguish', 'ruttish',
  9. 10: 'saucy', 'spleeny', 'spongy', 'surly', 'tottering',
  10. 11: 'unmuzzled', 'vain', 'venomed', 'villainous', 'warped',
  11. 12: 'wayward', 'weedy', 'yeasty');
  12. 13: var c2 = RollPlayer.simpleTable('base-court', 'bat-fowling',
  13. 14: 'beef-witted', 'beetle-headed', 'boil-brained',
  14. 15: 'clapper-clawed', 'clay-brained', 'common-kissing',
  15. 16: 'crook-pated', 'dismal-dreaming', 'dizzy-eyed',
  16. 17: 'doghearted', 'dread-bolted', 'earth-vexing',
  17. 18: 'elf-skinned', 'fat-kidneyed', 'fen-sucking',
  18. 19: 'flap-mouthed', 'fly-bitten', 'folly-fallen', 'fool-born',
  19. 20: 'full-gorged', 'guts-griping', 'half-faced',
  20. 21: 'hasty-witted', 'hedge-born', 'hell-hated', 'idle-headed',
  21. 22: 'ill-breeding', 'ill-nurtured', 'knotty-pated',
  22. 23: 'milk-livered', 'motley-minded', 'onion-eyed',
  23. 24: 'plume-plucked', 'pottle-deep', 'pox-marked',
  24. 25: 'reeling-ripe', 'rough-hewn', 'rude-growing', 'rump-fed',
  25. 26: 'shard-borne', 'sheep-biting', 'spur-galled',
  26. 27: 'swag-bellied', 'tardy-gaited', 'tickle-brained',
  27. 28: 'toad-spotted', 'unchin-snouted', 'weather-bitten');
  28. 29: var c3 = RollPlayer.simpleTable('apple-john', 'baggage', 'barnacle',
  29. 30: 'bladder', 'boar-pig', 'bugbear', 'bum-bailey',
  30. 31: 'canker-blossom', 'clack-dish', 'clotpole', 'coxcomb',
  31. 32: 'codpiece', 'death-token', 'dewberry', 'flap-dragon',
  32. 33: 'flax-wench', 'flirt-gill', 'foot-licker', 'fustilarian',
  33. 34: 'giglet', 'gudgeon', 'haggard', 'harpy', 'hedge-pig',
  34. 35: 'horn-beast', 'hugger-mugger', 'joithead', 'lewdster',
  35. 36: 'lout', 'maggot-pie', 'malt-worm', 'mammet', 'measle',
  36. 37: 'minnow', 'miscreant', 'moldwarp', 'mumble-news',
  37. 38: 'nut-hook', 'pigeon-egg', 'pignut', 'puttock', 'pumpion',
  38. 39: 'ratsbane', 'scut', 'skainsmate', 'strumpet', 'varlot',
  39. 40: 'vassal', 'whey-face', 'wagtail');

The first word is supposed to always be "Thou" so we need a rollable object that alwasy returns that string. A little weird, but hey, it works.

  1. 41: var thou = RollPlayer.simpleTable('Thou');

We can feed as many rollable objects into a joinPool as we want. We can mix types as well. If we have a use case for a joinPool built with a table(), an explodingDie() and another joinPool() we could pull that off.

joinPool defaults to giving us a comma separated list. But we can set whatever searator we want. In this case we just want spaces. We can chain the set_separator() call or split it across multiple lines.

  1. 42: var bard = RollPlayer.joinPool(thou, c1, c2, c3).set_separator(' ');

Return an object so that our template code can access the star of this example as demo.rollable

  1. 43: return { rollable : bard };
  2. 44: }();

Tutorial Builder is © Christian Heilmann, 2008. Licensed under the BSD license.