Thanks a lot for the reply David! That worked exactly--thanks for helping me clarify what I needed to do. <br>~Holly<br><br><br><br>On Thursday, September 20, 2012 3:25:51 PM UTC-4, McFarlane, David wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Well, just reading this over, and based upon your earlier post, I
<br>gather that all you really want to do is vary MaxCount based on some
<br>computation, is that right? Then why not do it simply with an
<br>attribute reference? E.g., in the Advanced input mask properties for
<br>you stimulus object, for MaxCount enter "[MaxCount]". Then, in
<br>inline code just before your stimlus, put something like
<br>
<br> c.SetAttrib "MaxCount", your_computed_value_goes_here
<br>
<br>I had never thought before about controlling MaxCount through an
<br>attribute reference myself, so before I wrote this I tested it to
<br>make sure it all works, and it does. So thanks for posing this.
<br>
<br>-----
<br>David McFarlane
<br>E-Prime training
<br>online: <a href="http://psychology.msu.edu/Workshops_Courses/eprime.aspx" target="_blank">http://psychology.msu.edu/<wbr>Workshops_Courses/eprime.aspx</a>
<br>Twitter: @EPrimeMaster (<a href="https://twitter.com/EPrimeMaster" target="_blank">https://twitter.com/<wbr>EPrimeMaster</a>)
<br>
<br>/----
<br>Stock reminder: 1) I do not work for PST. 2) PST's trained staff
<br>take any and all questions at
<br><a href="http://support.pstnet.com/e%2Dprime/support/login.asp" target="_blank">http://support.pstnet.com/e%<wbr>2Dprime/support/login.asp</a> , and they
<br>strive to respond to all requests in 24-48 hours -- this is pretty
<br>much their substitute for proper documentation, so make full use of
<br>it. 3) In addition, PST takes questions at their Facebook page
<br>(<a href="http://www.facebook.com/pages/Psychology-Software-Tools-Inc/241802160683" target="_blank">http://www.facebook.com/<wbr>pages/Psychology-Software-<wbr>Tools-Inc/241802160683</a>
<br>), and offers several instructional videos there and on their YouTube
<br>channel (<a href="http://www.youtube.com/user/PSTNET" target="_blank">http://www.youtube.com/user/<wbr>PSTNET</a> ) (no Twitter feed yet,
<br>though). 4) If you do get an answer from PST staff, please extend
<br>the courtesy of posting their reply back here for the sake of others.
<br>\----
<br>
<br>
<br>At 9/20/2012 12:39 PM Thursday, free_operant_task wrote:
<br>>I am trying to create a free operant task in which multiple button
<br>>presses are rewarded at a variable rate. I have inserted the sample
<br>>script from the eprime website that collects the RESP and RT for
<br>>multiple responses; on its own, this is working well and collects
<br>>data for each response according to the "max count" for the stimuli
<br>>and after the max count is reached, the trial moves on to the feedback.
<br>>
<br>>However, I want the rate of presses to be rewarded (move to the
<br>>feedback object) at a variable, random (between 1 & 20) rate of
<br>>presses. To accomplish this, I have tried adding an inline script
<br>>before the stimuli, which generates a random number and an inline
<br>>script after the stimuli (below the script that collects multiple
<br>>responses taken from the eprime website) with a loop that requires
<br>>repeated button presses until the number of button presses equals
<br>>the random number (generated on the inline before the stimuli) and
<br>>then the trial moves to the feedback. The loop is working in and of
<br>>itself but only if the "max count" is set to 1. When I try to
<br>>increase the max count, or when I try to make the max count
<br>>reference the random number attribute (generated before the
<br>>stimuli), then my script stops working.
<br>>
<br>>Any help would be greatly appreciated! Here is a screen shot of the
<br>>trial structure and a copy of the second inline code. Everything
<br>>within the two long lines is taken from the eprime website; below
<br>>the line is the bit of code I added.
<br>>
<br>>
<br>>_____________________________<wbr>______________________________<wbr>______________________________<wbr>__
<br>> Dim theResponseObject As RteRunnableInputObject
<br>> Set theResponseObject =
<br>> CRteRunnableInputObject(Rte.<wbr>GetObject("FreeOperantFrac"))
<br>>
<br>> 'If the assert below fires, then the object named in the line
<br>> above does not exist
<br>> Debug.Assert Not theResponseObject Is Nothing
<br>>
<br>> 'Counter variable for the number of responses made
<br>> Dim nPressCount As Long
<br>>
<br>> 'Counter variable
<br>> Dim nIndex As Integer
<br>>
<br>> 'Used to set attributes for statistics
<br>> Dim strStatistic As String
<br>>
<br>> 'Enumerate through the response collection
<br>> 'If any of the responses were made by the keyboard, display
<br>> 'the statistics to the user.
<br>> For nIndex = 1 To theResponseObject.InputMasks.<wbr>Responses.Count
<br>>
<br>> 'Set theKeyboardResponseData equal to the current keyboard response
<br>> Dim theKeyboardResponseData As KeyboardResponseData
<br>> Set theKeyboardResponseData =
<br>> CKeyboardResponseData(<wbr>theResponseObject.InputMasks.<wbr>Responses(nIndex))
<br>> If Not theKeyboardResponseData Is Nothing Then
<br>>
<br>> 'Increment the press count
<br>> nPressCount = nPressCount + 1
<br>>
<br>> 'Log reaction time and response for each key press.
<br>> c.SetAttrib "KeyPress" & nIndex & "RT",
<br>> theKeyboardResponseData.RT
<br>> c.SetAttrib "KeyPress" & nIndex & "RESP",
<br>> theKeyboardResponseData.RESP
<br>>
<br>> End If
<br>>
<br>>
<br>> Next 'nIndex
<br>>_____________________________<wbr>______________________________<wbr>______________________________<wbr>__
<br>>
<br>>Do
<br>> If nPressCount <> RewardProb Then
<br>> GoTo Label2
<br>> End If
<br>>
<br>>Loop Until (nPressCount = RewardProb )
<br>> If nPressCount = RewardProb Then
<br>> GoTo RewardLabel
<br>> End If
<br>
<br></blockquote>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To post to this group, send email to e-prime@googlegroups.com.<br />
To unsubscribe from this group, send email to e-prime+unsubscribe@googlegroups.com.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msg/e-prime/-/wXSW94iwQOQJ">https://groups.google.com/d/msg/e-prime/-/wXSW94iwQOQJ</a>.<br />
For more options, visit <a href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out</a>.<br />
<br />
<br />