pching
04-13-2021, 10:24 PM
Hello everyone!
I am in the process of making a PowerPoint Escape Room for an organization I'm in, and I've tried getting my feet wet in VBA to add interesting and complex puzzles to it.
I need help getting one such puzzle to work.
Simply put, clues would lead the players to come to the conclusion that they would need to input a Red-Gold-Green-Gold sequence into a pad of circles under a globe, at which point the globe would provide them a key to unlock a door. I have it set up where there is a palette of four colors off to the side that they click, and once they select a color from the palette, they click the respective circle that they want to fill with that color.
Here's the code for everything I've talked about so far:
Dim RGB As Variant
'player selecting the color
Sub ChooseColor(oSh As Shape)
RGB = oSh.Fill.ForeColor.RGB
End Sub
'player filling the circle with the color
Sub CircleColor(oSh As Shape)
oSh.Fill.ForeColor.RGB = RGB
End Sub
For its intended purpose, the above code works perfectly for me.
My question now is: is there a way that if each circle was the correct color, the presentation would move onto the next slide?
Below is my unsuccessful attempt at this:
Dim firstColorCorrect As Integer
Dim secondColorCorrect As Integer
Dim thirdColorCorrect As Integer
Dim fourthColorCorrect As Integer
Dim oSh As Shape
Dim oSl As Slide
Sub GlobeKey()
If oSh(1).Fill.ForeColor.RGB = RGB(255, 0, 0) Then firstColorCorrect = 1
If oSh(2).Fill.ForeColor.RGB = RGB(255, 192, 0) Then secondColorCorrect = 1
If oSh(3).Fill.ForeColor.RGB = RGB(0, 176, 80) Then thirdColorCorrect = 1
If oSh(4).Fill.ForeColor.RGB = RGB(0, 112, 192) Then fourthColorCorrect = 1
If firstColorCorrect + secondColorCorrect + thirdColorCorrect + fourthColorCorrect = 4 Then ActivePresentation.SlideShowWindow.View.Next
End Sub
I have the GlobeKey macro set onto an "Enter" button that I've placed below the circles.
I've attached a screenshot of the slide, just so you can see what everything looks like from a non-VBA standpoint.
Thank you in advance for your help!
I am in the process of making a PowerPoint Escape Room for an organization I'm in, and I've tried getting my feet wet in VBA to add interesting and complex puzzles to it.
I need help getting one such puzzle to work.
Simply put, clues would lead the players to come to the conclusion that they would need to input a Red-Gold-Green-Gold sequence into a pad of circles under a globe, at which point the globe would provide them a key to unlock a door. I have it set up where there is a palette of four colors off to the side that they click, and once they select a color from the palette, they click the respective circle that they want to fill with that color.
Here's the code for everything I've talked about so far:
Dim RGB As Variant
'player selecting the color
Sub ChooseColor(oSh As Shape)
RGB = oSh.Fill.ForeColor.RGB
End Sub
'player filling the circle with the color
Sub CircleColor(oSh As Shape)
oSh.Fill.ForeColor.RGB = RGB
End Sub
For its intended purpose, the above code works perfectly for me.
My question now is: is there a way that if each circle was the correct color, the presentation would move onto the next slide?
Below is my unsuccessful attempt at this:
Dim firstColorCorrect As Integer
Dim secondColorCorrect As Integer
Dim thirdColorCorrect As Integer
Dim fourthColorCorrect As Integer
Dim oSh As Shape
Dim oSl As Slide
Sub GlobeKey()
If oSh(1).Fill.ForeColor.RGB = RGB(255, 0, 0) Then firstColorCorrect = 1
If oSh(2).Fill.ForeColor.RGB = RGB(255, 192, 0) Then secondColorCorrect = 1
If oSh(3).Fill.ForeColor.RGB = RGB(0, 176, 80) Then thirdColorCorrect = 1
If oSh(4).Fill.ForeColor.RGB = RGB(0, 112, 192) Then fourthColorCorrect = 1
If firstColorCorrect + secondColorCorrect + thirdColorCorrect + fourthColorCorrect = 4 Then ActivePresentation.SlideShowWindow.View.Next
End Sub
I have the GlobeKey macro set onto an "Enter" button that I've placed below the circles.
I've attached a screenshot of the slide, just so you can see what everything looks like from a non-VBA standpoint.
Thank you in advance for your help!