Am trying to get this code to work where the user enters n rock,paper,or scissors and the computer randomly picks as well, it then states what each choose, once u click ok it tells who won the match but my code once it shows the 1st winner result have to keep clicking ok to get thru the rest of the winner messageboxes. what am i missing? this is a .vbs extension that i am writing up using wordpad then testing the file where it is located by dbl clicking the file and playing the game. please help.

'Formally declare variables used by the script before typing to use them

Dim WshShl, Answer, CardImage, GetRandomNumber

'Create an instance of the WScript object in order to later use the

'Popup method

Set WshShl = Wscript.CreateObject("WScript.Shell")

'Display the rules of the game

WshShl.Popup "Welcome to Rock, Paper and Scissors game. Here are the " & _
"rules for playing the game: 1. Guess the same thing as the " & _
"computer to tie. 2. Paper covers Rock and wins. 3. Rock breaks " & _
"Scissors and wins. 4. Scissors cut Paper and wins."

'Prompt the user to select a choice

Answer = InputBox("Type Paper, Rock, or Scissors.", _
"Let's play a game!")

'Time for the computer to randomly pick a choice

Randomize

GetRandomNumber = Round(FormatNumber(Int((3 * Rnd()) + 1)))

'Assign a value to the randonly selected number

If GetRandomNumber = 3 then CardImage = "Rock"
If GetRandomNumber = 2 then CardImage = "Scissors"
If GetRandomNumber = 1 then CardImage = "Paper"

'Display the game's results so that the user can see if he or she won

WshShl.Popup "You picked: " & Answer & Space(12) & "Computer picked: " & CardImage

If Answer = "Rock" & CardImage <> "Paper" Then MsgBox "Paper Covers Rock: Computer Wins!"

If Answer = "Paper" & CardImage <> "Scissors" Then MsgBox "Scissors Cuts Paper: Computer Wins!"

If Answer = "Scissors" & CardImage <> "Rock" Then MsgBox "Rock Breaks Scissors: Computer Wins!"

If CardImage = "Rock" & Answer <> "Paper" Then MsgBox "Paper Covers Rock: You Win!"

If CardImage = "Paper" & Answer <> "Scissors" Then MsgBox "Scissors Cuts Paper: You Win!"

If CardImage = "Scissors" & Answer <> "Rock" Then MsgBox "Rock Breaks Scissors: You Win!"

If CardImage = "Rock" & Answer <> "Rock" Then MsgBox "TIE!"

If CardImage = "Paper" & Answer <> "Paper" Then MsgBox "TIE!"

If CardImage = "Scissor" & Answer <> "Scissor" Then MsgBox "TIE!"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.