--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+u...@googlegroups.com.
To post to this group, send email to e-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/7ec6329b-240c-41ef-8f7f-0fa87cda04e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi,
Thanks! I had to look up what you were replying to – something I wrote about 4 years ago J
Anyway, happy that this helped someone. More tips can be found in our book, The E-Primer (which was probably published around the time I wrote the email…)
Best,
Michiel Spape
Lecturer in Psychology
Liverpool Hope University
From: e-p...@googlegroups.com [mailto:e-p...@googlegroups.com] On Behalf Of Richard Kirkden
Sent: 08 March 2018 11:51
To: E-Prime <e-p...@googlegroups.com>
Subject: Re: Displaying a countdown timer for participants
The code provided by Cognitology worked beautifully! The progress bar looks great and is easy to resize, and also quite easy to modify for different durations. I think it will be a very good way to give participants a feeling of time pressure.
Also, it was very easy to modify the progress bar code so that it counts down across a whole block of trials, instead of resetting on each trial. (I used clock.read to save the onset time of the block to a variable called blockOnsetTime and substituted this for PreText.OnsetTime.) This was particularly useful. There are other ways to implement a countdown on a single slide (e.g. adding a movie of a countdown timer to the slide), but I've never before come across a way to create a countdown display that continues across successive slides.
So thank you for a really useful bit of code!
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+u...@googlegroups.com.
To post to this group, send email to e-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/456bd459-2a8d-46f5-a229-a6e211e32880%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I have been using the CountDownClock.es code from PST to use for a 2 mins trial list to terminate after 2 mins and proceed to the next block to start again. But on the 2nd block the timer doesn't start again and the trials flick through without asking for user input (to answer sums). I can't see why it doesn't work for the 2nd block and thereafter, any ideas anyone please?
I tried using new variables thinking it's still set to zero so it doesn't run properly after the 1st block. Annoying problem but probably something silly I can’t see.
I terminate the current triallist/block when the countdown reaches zero.
Code -
Inline before slide, start the counter -
lnStartTime = Slide1.OnsetTime
Slide, then
Inline after slide
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' VARIABLE DECLARATIONS AND SETTINGS
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Declare variable for the end time
Dim lnEndTime As Long
'Declare variable for total duration
Dim lnTotDuration As Long
'Set the total duration of the trial
lnTotDuration = 30000
'Set the EndTime equal to the StartTime plus the TotDuration
lnEndTime = lnStartTime + lnTotDuration
'Set the variable that will start your count down clock
'in this case, the clock will start after 5000ms
Dim lnCountAfterTime As Long
lnCountAfterTime = lnStartTime + 0
'Initialize variables to zero
lnCountTime = 0
lnpreviousCountTime = 0
'Counter to debug the amount of times the screen is redrawn
Dim intDrawCount As Integer
'Get access to the Text2 SlideText object in order to
'place text and redraw the object
Dim T2 As SlideText
Set T2 = CSlideText(Slide1.States.Item("Default").Objects("Text2"))
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' LOOP AND DISPLAY COUNTER IF NECESSARY
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Loop until EndTime has been reached, or the subject has responded
Do While (Clock.Read <= lnEndTime) And (Slide1.InputMasks.Ispending())
'If the count down time has been reached, display the counter
If Clock.Read >= lnCountAfterTime Then
'Calculate the amount of time left in seconds
lnCountTime = (lnEndTime - Clock.Read) / 1000
'Convert to an integer
lnCountTime = CInt(lnCountTime)
'If a second has elapsed, previousCountTime will not be the same
'as CountTime, so draw the new counter
If lnpreviousCountTime <> lnCountTime Then
'Set the appropriate text
If lnCountTime = 60 Then
T2.Text = "Hurry Up, You have " & lnCountTime & " seconds left."
Else
T2.Text = "You have " & lnCountTime & " seconds left."
End If
'Force a redraw
T2.Draw
'Add 1 to the drawing counter
intDrawCount = intDrawCount + 1
End If
'Set the previousCountTime equal to the current CountTime
lnpreviousCountTime = lnCountTime
End If
Loop
If lnCountTime = 0 Then
T2.Text = "0 seconds left."
lnCountTime = Slide1.OffsetTime
TrialList.Terminate
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DEBUG AND RELEASE REFERENCES
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Calculate and debug.print the total time of the trial
'from the current time minus the StartTime
'Note: this value will only be close to 15000 when no
'response has been made for the entire trial; simply for error checking
Dim lnTotTime As Long
lnTotTime = Clock.Read - lnStartTime
Debug.Print "Total Trial Time = " & lnTotTime
'Debug the amount of times the screen was redrawn
'value should be the amount of seconds + 1 (to account for drawing zero)
Debug.Print "Redrawn " & intDrawCount & " times"
'Reset the .TEXT property of T2
T2.Text = ""
'Release references
Set T2 = Nothing