Re: Keeping score
- From: "David M. Marcovitz" <marcoNOSPAM@xxxxxxxxxx>
- Date: Tue, 11 Dec 2007 12:12:19 -0800
Aha. Now I get your issue. Sorry for misunderstanding the first time. In
this case, you need another array (that is why you were asking about the
number of arrays). Call it visited2 or something that makes sense to you.
Copy just about every line of code where you have visited and add one
just like it for visited2. Then use visited2 in my If statements and the
original visited in the Random statements. Make sure that you set
visited2 to True in WrongAnswer (and not visited) and both visited and
visited2 to True in Right Answer.
--David
--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
=?Utf-8?B?TW9Xb0w=?= <MoWoL@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
news:2DDCBC4C-2852-44B2-AC0C-F5967530F765@xxxxxxxxxxxxx:
Thank you for getting back to me so quickly. I have tried this and the
problem lies in WrongAnswer. When the user gets the question wrong the
first time it will count NumIncorrect. But in order to make the slide
come up again in the RandomNext, I can not then mark the slide as
visited. So the next time it comes up, if they again answer
incorrectly, visited is still false so it counts another incorrect. It
also will then count one for correct the next time because visited
will be false until the correct answer is reached. Once answered
correctly, the slide doesn't come up anymore, so the issue ends, but
in this situation, it would have counted twice incorrect and once
correct.
"David M. Marcovitz" wrote:
Within reason, you can have as many arrays as you want. Without
testing it out, I believe that what you want to do is VERY easy.
Right now, you are adding one to numCorrect or numIncorrect no matter
what. All you need to do is put those statements inside an If block
to ask if that question has been visited previously. It should be
something like this (in RightAnswer):
If visited(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex)
_
= False Then
numCorrect = numCorrect + 1
End If
Do the same for WrongAnswer (obviously using numIncorrect). The If
statement simply asks if the slide has not been visited. If it has,
it does nothing with the score. If it has not, it adds one to the
count of correct or incorrect answers.
--David
--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
=?Utf-8?B?TW9Xb0w=?= <MoWoL@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
news:689444FE-1157-497A-BA08-BC4F2385C6CE@xxxxxxxxxxxxx:
Many thanks to everyone who has helped me so far. I was hoping to
once again get pointed in the right direction. I have a power point
for user practice that gives the slides in random order, and when
the question is answered incorrectly, the slide will come up again,
once correct, it no longer comes up. This code was adapted from Mr.
Marcovitz's web site and works beautifuly. I have tried to
incorporate scoring on the power point, and want it to only count
the answer the first time it comes up. (If they get it wrong once,
it's counted as wrong even though they will face the question
again.) I have tried using the qAnswered array found on the site,
but it won't work. I think maybe because I already have the visited
array keeping the randomization working properly. (Can you have two
arrays in code?) I am new to VBA, but love playing with it. The
following code works but counts incorrect every time they may get
it wrong, not just the first. Thanks again for any input you may
have.
Dim visited() As Boolean
Dim numSlides As Long
Dim numRead As Integer
Dim NumCorrect As Integer
Dim NumIncorrect As Integer
Sub GetStarted()
Initialize
MakeAllNotVisible
RandomNext
End Sub
Sub Initialize()
Randomize
numRead = 0
NumCorrect = 0
NumIncorrect = 0
numSlides = ActivePresentation.Slides.Count
ReDim visited(numSlides)
For i = 2 To numSlides - 1
visited(i) = False
Next i
End Sub
Sub MakeAllNotVisible()
Dim oSld As Slide
Dim oShp As Shape
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.Name = "Missed" Then
oShp.Visible = False
End If
Next oShp
Next oSld
End Sub
Sub RightAnswer()
NumCorrect = NumCorrect + 1
visited(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex
) = True numRead = numRead + 1
RandomNext
End Sub
Sub WrongAnswer()
NumIncorrect = NumIncorrect + 1
ActivePresentation.SlideShowWindow.View.Slide.Shapes("Missed").V
isi ble =
True
ActivePresentation.SlideShowWindow.View.GotoSlide (2)
End Sub
Sub RandomNext()
Dim nextSlide As Long
If numRead >= numSlides - 3 Then
ActivePresentation.SlideShowWindow.View.Last
Else
nextSlide = Int((numSlides - 2) * Rnd + 2)
While visited(nextSlide) = True Or nextSlide = 2
nextSlide = Int((numSlides - 2) * Rnd + 2)
Wend
ActivePresentation.SlideShowWindow.View.GotoSlide
(nextSlide)
End If
End Sub
.
- Follow-Ups:
- Re: Keeping score
- From: MoWoL
- Re: Keeping score
- References:
- Keeping score
- From: MoWoL
- Re: Keeping score
- From: David M. Marcovitz
- Re: Keeping score
- From: MoWoL
- Keeping score
- Prev by Date: Re: Updating Link to Excel File oddity
- Next by Date: RE: Drawing Straight Line with Pen During Slide Show
- Previous by thread: Re: Keeping score
- Next by thread: Re: Keeping score
- Index(es):
Relevant Pages
|