Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Write-Char{ #this function grabs each character in a variable and writes it out to screen with a small delay, causing a very familiar Final Fantasy or Zelda affect.
- Param
- (
- #Specify the characters to write to screen
- [Parameter(Mandatory=$true)]
- [Alias("characters")]
- [string]$text,
- #Specify the delay between characters
- [Parameter(Mandatory=$false)]
- [Alias("pause","wait")]
- [string]$delay='15'
- )
- $i=0
- Do {
- If ($i -eq $host.ui.RawUI.BufferSize.Width){ #this logic detects if the current character would force the window to scroll, and if so will write to a new line
- Write-Host ($text.Substring($i,1))
- }
- else{ #if the current character won't cause the window to scroll horizontally, then add the current character to the line
- Write-Host ($text.Substring($i,1)) -NoNewline
- }
- Start-Sleep -Milliseconds $delay #amount of time to wait between each character
- $i++ #increment $i to move to the next character
- }
- Until ($i -eq ($text.Length - 1))
- }
- $intro = "Welcome to ISIS `nYour death begins here`n
- From the beginning of time man has sought its own destruction, in this time of despair only one hero may rise amongst the ranks to deter evil from`n taking
- its place in the world. Will you be this hero? Can you stand up for what is right? Can you protect the helpless from there own demise? You hero, our are only hope.`n"
- Write-Char -characters $intro
- # Show the user the information you want them to act on -ie. the choice
- Write-Host '********************'
- Write-Host ''
- Write-Host 'Select class:'
- Write-Host '1) Warrior'
- Write-Host '2) Mage'
- # Request the choice from the user
- $MenuChoice = Read-Host "Choice"
- # If the User doesn't choose 1 or 2, make them choose again:
- While ( $MenuChoice -ne '1' -and $MenuChoice -ne '2' )
- {
- Write-Host 'Invalid selection. Please choose 1 or 2'
- $MenuChoice = Read-Host 'Choice'
- }
- # Return the selection the user made based on $menuchoice
- switch ( $MenuChoice )
- {
- '1' { Write 'You have selected the Warrior' }
- '2' { Write 'You have selected the Mage' }
- }
- if ($MenuChoice -eq 1) {
- Write-Host 'Select A skill'
- Write-Host '1) For Mortal Strike'
- Write-Host '2) For Rage Strike'
- $skill = Read-Host 'Skill'
- While ($skill -ne '1' -and $skill -ne '2' )
- {
- write-host 'Invalid selection. Please choose 1 or 2'
- $skill = Read-Host"Choice"
- }
- switch ( $skill )
- {
- '1' { Write('You have selected Mortal Strike!`n') }
- '2' { Write('You have selected Rage Strike!`n') }
- }
- }
- if ($MenuChoice -eq 2) {
- Write-Host 'Select A skill'
- Write-Host '1) For Fireball'
- Write-Host '2) For Frostbolt'
- $skill = Read-Host 'Skill'
- While ($skill -ne '1' -and $skill -ne '2' )
- {
- write-host 'Invalid selection. Please choose 1 or 2'
- $skill = Read-Host 'Choice'
- }
- switch ( $skill )
- {
- "1" { Write-Host('You have selected Fireball!`n') }
- "2" { Write-Host('You have selected Frostbolt!`n') }
- }
- }
- $Name = Read-Host ( 'What is your name Hero?' )
- Write-Host ( 'Your journey has finally begun young $Name' )
Advertisement
Add Comment
Please, Sign In to add comment