#### "That story game where you mix up words" <# By Jen McCown, Jen@MidnightDBA.com http://MidnightDBA.com/Jen/ 11/15/2018 For funsies only. Run at your own risk. Don't blame me if people plug in swears and stuff. --- Walkthrough: Function Save-Story - if c:\temp exists, saves the story to a file there. Function Play-Alice - story 1 Function Play-Peter - story 2 Function Play-Martian - story 3 Main: ask if they want to save the story ask if they want story 1, 2, or 3 call the proper Play-* function based off the number #> cls ################################################################################################## function Save-Story { PARAM($Text) IF (Test-Path -Path "c:\temp") { $Text | out-file c:\temp\MadLibs_$Name.txt notepad.exe c:\temp\MadLibs_$Name.txt } } ################################################################################################## function Play-Alice { PARAM($SaveStory) "Answer these 10 questions: " "" $Name = Read-Host -Prompt '1. A name' $Family = Read-Host -Prompt '2. A family member (uncle, sister, etc)' $Verb1 = Read-Host -Prompt '3. Verb (past tense)' $Color = Read-Host -Prompt '4. Color' $Animal = Read-Host -Prompt '5. Animal' $Verb2 = Read-Host -Prompt '6. Verb (past tense)' $Food = Read-Host -Prompt '7. Food' $Container = Read-Host -Prompt '8. Container that can hold liquid' $PluralNoun = Read-Host -Prompt '9. Plural noun' $Number = Read-Host -Prompt '10. Number' cls "Here is your story:" "" $Text = "Once there was a girl named $Name. She was hanging out with her $Family when she $Verb1. Then a $Color $Animal ran past, and $Name followed. She $Verb2 down a rabbit hole and then she ate a $Food and grew very big. She drank from a $Container and shrank really small. She met lots of different $PluralNoun and had $Number adventures. THE END." $Text; IF ($SaveStory -like "Y*") { Save-Story $Text; } } #Play-Alice ################################################################################################## function Play-Peter { PARAM($SaveStory) "Answer these 9 questions: " "" $Name = Read-Host -Prompt '1. A name' $Family = Read-Host -Prompt '2. Plural family member (uncles, sisters, etc)' $Verb1 = Read-Host -Prompt '3. Verb (past tense)' $Adj = Read-Host -Prompt '4. Adjective' $Noun = Read-Host -Prompt '5. Noun' $Myth = Read-Host -Prompt '6. Mythical creature (plural)' $Animal = Read-Host -Prompt '7. Animal' $Sound = Read-Host -Prompt '8. Thing that makes sounds' $Verb2 = Read-Host -Prompt '9. Verb (ending -ing)' cls "Here is your story:" "" $Text = "Once there was this kid named $Name, who lived in Neverland. $Name ended up luring this girl Wendy and her $Family to Neverland, by teaching them how to $Verb1. Once they were there, they ran into pirates, and met the $Adj Boys, and lived in a home under the $Noun with them and with $Name. I mean, they lived with the $Adj boys, not the pirates tho. Their adventures included a brush with $Myth, something to do with a $Animal that made a sound like a $Sound, and a lot of $Verb2. Eventually Wendy and her $Family went home and grew up, but $Name never did. THE END." $Text IF ($SaveStory -like "Y*") { Save-Story $Text; } } #Play-Peter ################################################################################################## function Play-Martian { PARAM($SaveStory) "Answer these 11 questions: " "" $Name = Read-Host -Prompt '1. A first name' $Catastrophe = Read-Host -Prompt '2. A kind of catastrophe (like a flood)' $Adj = Read-Host -Prompt '3. Adjective' $Liquid = Read-Host -Prompt '4. Liquid one would actually want to drink' $Food = Read-Host -Prompt '5. A food' $Noun = Read-Host -Prompt '6. Noun' $Number = Read-Host -Prompt '7. Number' $Nouns = Read-Host -Prompt '8. Plural noun' $City = Read-Host -Prompt '9. A city name' $Machine = Read-Host -Prompt '10. Type of machine (e.g., blender)' $Ship = Read-Host -Prompt '11. A good name for a ship' cls "Here is your story:" "" $Text = "This guy $Name Watney got stuck on Mars all by himself because of a really strong $Catastrophe. It was so $Adj. He had plenty of air and $Liquid, but not enough food. So he grew $Food to eat. He also had to go get a Mars rover for the $Noun. He drove $Number kilometers to get it, and then dug the rover out from under $Nouns. He fixed the $Noun and talked to Mission Control in $City, on Earth. Long story short, $Name was really lonely and talked to himself a lot. He also broke his $Machine with electricity. Eventually, his crewmates rescued him with the spaceship $Ship III and he never had to eat $Food again. THE END." $Text IF ($SaveStory -like "Y*") { Save-Story $Text; } } #Play-Martian ################################################################################################## ################################################################################################## #### Main ################################################################################################## ################################################################################################## "LET'S PLAY A GAME!" "It's time for 'Mad Libs'. " $Text = ""; $SaveStory = Read-Host -Prompt 'Do you want to save your story? Y/N'; $Story = Read-Host -Prompt 'Do you want story 1, story 2, or story 3? Answer 1 or 2 or 3'; IF ($Story -eq 1) { Play-Alice $SaveStory; } ELSEIF ($Story -eq 2) { Play-Peter $SaveStory; } ELSE { Play-Martian $SaveStory; }