Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How to randomize set boxes


mattt183
 Share

Recommended Posts

How do you make set boxes randomly come up when you hit a button? (making a question game)
EXAMPLE:
Question1
Question2
Question3

I press a button and Question2 pops up, Next Time I click Question1 comes up,next time Question 3 comes up (need to make it so the same question doesn't come up twice), also need to make it boxes with text, not just text because i need answers.
Link to comment
Share on other sites

@RyokuHasu:

> You would have to write a complete mini-game script….

No. Just no.

There are numerous simple ways you could do this. You could have a control array with different frames (each containing a question and 3 answer buttons) and then have a random number picked when the answer is correct to show the next question.

OR

You could create all different frames with the questions (the same as above) but have a sub that shows the next question that calls a random number and then selects a frame from a select case thingy to show the question.

Nothing too complex is needed.
Link to comment
Share on other sites

```
Function ReturnRandomQuestion() as string
    Select Case Rand(1, 3)
        Case 1
              ReturnRandomQuestion = "Hey do you like mudkipz?"
        Case 2
              ReturnRandomQuestion = "Oh sup bro, how are you?"
        Case Else
              ReturnRandomQuestion = "Yeah, i'm cool, aren't i?"
    End Select
End Function

```
Link to comment
Share on other sites

You would use the same format. So instead of storing text and having it as a function, you would have a sub that showed a picturebox or a frame. Eg:

```
Public Sub RandomQuestion as string
    Select Case Rand(1, 3)
        Case 1
              fraQuestion1.Visible = True
        Case 2
              fraQuestion2.Visible = True
        Case Else
              fraQuestion3.Visible = True
    End Select
End Sub
```
Link to comment
Share on other sites

But random would show the question twice so you also have to add a check somewhere shouldn't you? but well it shouldn't be that hard just store if the pic was opened or not somewhere and make it so if it already appeared won't.

If i m wrong about what i just said and you have already found the solution for that sorry just saying what i though i read
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...