Gwith

Game Update

May 20th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. 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.
  2.  
  3. Param
  4. (
  5. #Specify the characters to write to screen
  6. [Parameter(Mandatory=$true)]
  7. [Alias("characters")]
  8. [string]$text,
  9.  
  10. #Specify the delay between characters
  11. [Parameter(Mandatory=$false)]
  12. [Alias("pause","wait")]
  13. [string]$delay='15'
  14. )
  15. $i=0
  16. Do {
  17. 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
  18. Write-Host ($text.Substring($i,1))
  19. }
  20. else{ #if the current character won't cause the window to scroll horizontally, then add the current character to the line
  21. Write-Host ($text.Substring($i,1)) -NoNewline
  22. }
  23.  
  24.  
  25. Start-Sleep -Milliseconds $delay #amount of time to wait between each character
  26. $i++ #increment $i to move to the next character
  27. }
  28. Until ($i -eq ($text.Length - 1))
  29. }
  30.  
  31.  
  32. $intro = "Welcome to ISIS `nYour death begins here`n
  33. 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` taking
  34. 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"
  35.  
  36. Write-Char -characters $intro
  37.  
  38.  
  39. # Show the user the information you want them to act on -ie. the choice
  40. Write-Host '********************'
  41. Write-Host ''
  42. Write-Host 'Select class:'
  43. Write-Host '1) Warrior'
  44. Write-Host '2) Mage'
  45. # Request the choice from the user
  46. $MenuChoice = Read-Host "Choice"
  47. # If the User doesn't choose 1 or 2, make them choose again:
  48. While ( $MenuChoice -ne "1" -and $MenuChoice -ne "2" )
  49. {
  50. Write-Host "Invalid selection. Please choose 1 or 2"
  51. $MenuChoice = Read-Host "Choice"
  52. }
  53. # Return the selection the user made based on $menuchoice
  54. switch ( $MenuChoice )
  55. {
  56. "1" { Write "You have selected the Warrior" }
  57. "2" { Write "You have selected the Mage" }
  58.  
  59. }
  60. if ($MenuChoice -eq 1) {
  61. Write-Host "Select A skill"
  62. Write "1) For Mortal Strike"
  63. Write "2) For Rage Strike"
  64. $skill = Read-Host "Skill"
  65. While ($skill -ne "1" -and $skill -ne "2" )
  66. {
  67. write-host "Invalid selection. Please choose 1 or 2"
  68. $skill = Read-Host"Choice"
  69. }
  70. switch ( $skill )
  71. {
  72. "1" { Write("You have selected Mortal Strike!`n") }
  73. "2" { Write("You have selected Rage Strike!`n") }
  74. }
  75. }
  76. if ($MenuChoice -eq 2) {
  77. Write-Host "Select A skill"
  78. Write-Host "1) For Fireball"
  79. Write-Host "2) For Frostbolt"
  80. $skill = Read-Host "Skill"
  81. While ($skill -ne "1" -and $skill -ne "2" )
  82. {
  83. write-host "Invalid selection. Please choose 1 or 2"
  84. $skill = Read-Host"Choice"
  85. }
  86. switch ( $skill )
  87. {
  88. "1" { Write-Host("You have selected Fireball!`n") }
  89. "2" { Write-Host("You have selected Frostbolt!`n") }
  90. }
  91. }
  92. $Name = Read-Host ( "What is your name Hero?" )
  93. Write-Host ( "Your journey has finally begun young $Name" )
Advertisement
Add Comment
Please, Sign In to add comment