BART, active and passive task

22 views
Skip to first unread message

Jacky Kuo

unread,
Jun 30, 2021, 10:31:35 AMJun 30
to E-Prime
Hi everyone, 

Don't know if there's any Balloon task experts out there, but any help with the Autoresponse would be helpful too. 

I have an experiment that need to start 15th of July and I am struggling with the last hurdle, I attached the two BART task files with the post and both of them are for Eprime 3:

1. Autoresponse in the Passive task, the program will run but the Autoresponse doesn't happen. Here's the script:

Rte.AutoResponseEnabled = True

'Refer to the User Script for Global variable declarations
Do While BalloonTask.InputMasks.IsPending()

'Only automate response after 1st trial
If c.GetAttrib(c.GetAttrib("Running") & ".Sample") > 1 Then
'Set time window for auto-response so we don't wait potentially for inifinite duration
'Specify .RT to occur between 1500 - 2500 ms of Stimulus.OnsetTime
WaitForAutoResp = Random(1500,2500)
'Wait for auto-response
Sleep WaitForAutoResp
'Use Random function to randomly assign responses
RandomAnswer = Random(1,2)
'Assign RandomAnswer to a response
If RandomAnswer = 1 Then
Keyboard.InsertResponse "LEFTARROW"
Else
Keyboard.InsertResponse "RIGHTARROW"
End If
End If
Loop

Debug.Print BalloonTask.RESP
'Loop while there are input masks pending.  This will return TRUE so long 
'as the EndNumber isn't reached and the participant doesn't press Left Arrow.

Do  
Rte.AutoResponseEnabled = True

'Refer to the User Script for Global variable declarations
Do While BalloonTask.InputMasks.IsPending()

'Only automate response after 1st trial
If c.GetAttrib(c.GetAttrib("Running") & ".Sample") > 1 Then
'Set time window for auto-response so we don't wait potentially for inifinite duration
'Specify .RT to occur between 1500 - 2500 ms of Stimulus.OnsetTime
WaitForAutoResp = Random(1500,2500)
'Wait for auto-response
Sleep WaitForAutoResp
'Use Random function to randomly assign responses
RandomAnswer = Random(1,2)
'Assign RandomAnswer to a response
If RandomAnswer = 1 Then
Keyboard.InsertResponse "LEFTARROW"
Else
Keyboard.InsertResponse "RIGHTARROW"
End If
End If
Loop

Debug.Print BalloonTask.RESP
'If the counts do not match, there are responses to process.
If nResponseCount <> theResponseObject.InputMasks.Responses.Count Then

'Increment response count.
nResponseCount = nResponseCount + 1

'Access the current response information so that it can be used
'later in the script for logging and determining which action to take.
Set theResponseData = theResponseObject.InputMasks.Responses(nResponseCount)
If Not theResponseData Is Nothing Then

'Log the response to the context
c.SetAttrib theResponseObject.Name & ".RESP_" & nResponseCount, theResponseData.RESP
c.SetAttrib theResponseObject.Name & ".RT_" & nResponseCount, theResponseData.RT
'Assess the subject's response.
'If the right arrow is pressed, inflate the balloon, add points and change the balloon image
'If the left arrow is pressed, end this task.
If theResponseData.RESP = "{RIGHTARROW}" Then
'Inputting PumpN, number of inflation on screen.
theSlideText.Text = nResponseCount
'Inputting Reward on screen as currency.
theSlideText2.Text = Format$(nResponseCount*5/100, "Currency")
theSlide.Draw
BalloonSize = BalloonSize + 1
'random number draw to compare against probability later 
g_pop = Random(0.0, 1000.0)
c.SetAttrib "Pop", g_pop
'Add one or two 0's to the beginning of the file name in order to match the name of the files
If BalloonSize < 10 Then
c.SetAttrib "Increment", "00" & BalloonSize
ElseIf BalloonSize >=10 Then
c.SetAttrib "Increment", "0" & BalloonSize
End If

'Update the balloon image
theSlideButton.Theme.Normal.ImgFilename = c.GetAttrib("BalloonName") & c.GetAttrib("Increment") & ".bmp"
'add pause and set a random Inter Stimulus Interval duration
Debug.Print "pause accepting input: " & CStr(Clock.Read)
'Change textbox color during pause
theSlideText4.Text = "Please wait until next response becomes available" 
theSlideText.BackColor = CColor("gray")
theSlideText2.BackColor = CColor("gray")
theSlideText3.BackColor = CColor("gray")
theSlide.Draw
'Suspend processing from the Keyboard
Keyboard.Suspend 
' Pause time between 1.5 secs to 2.5 secs
pauseTime = Random(1500, 2500)
'right-and-left arrow responses are ignored
Debug.Print "pauseTime is " & pauseTime
Sleep pauseTime
'Processing from keyboard resume
Keyboard.Resume
Debug.Print "return to accepting input at: " & CStr(Clock.Read)
'Change textbox color back to normal
theSlideText4.Text = ""
theSlideText.BackColor = CColor("white")
theSlideText2.BackColor = CColor("white")
theSlideText3.BackColor = CColor("lime")
theSlide.Draw
'Probability for balloon explosion 
If BalloonSize = 2 Then 
c.SetAttrib "Probability", 0
End If
If BalloonSize = 3 Then 
c.SetAttrib "Probability", 21
End If
If BalloonSize = 4 Then 
c.SetAttrib "Probability", 42
End If
If BalloonSize = 5 Then 
c.SetAttrib "Probability", 63
End If
If BalloonSize = 6 Then 
c.SetAttrib "Probability", 146
End If
If BalloonSize = 7 Then 
c.SetAttrib "Probability", 239
End If
If BalloonSize = 8 Then 
c.SetAttrib "Probability", 313
End If
If BalloonSize = 9 Then 
c.SetAttrib "Probability", 438
End If
If BalloonSize = 10 Then 
c.SetAttrib "Probability", 563
End If
If BalloonSize = 11 Then 
c.SetAttrib "Probability", 688
End If
If BalloonSize = 12 Then 
c.SetAttrib "Probability", 792
End If
If BalloonSize = 13 Then 
c.SetAttrib "Probability", 896
End If
If BalloonSize = 13 And g_pop > c.GetAttrib ("Probability") Then
BoolEndTask = True
End If
If BalloonSize >13 Then 
BoolEndTask = True
End If
ElseIf theResponseData.RESP = "{LEFTARROW}" Then
BoolEndTask = True

End If

'''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''

End If

End If

Loop Until Balloonsize >1 And g_pop <= c.GetAttrib ("Probability") Or BoolEndTask = True

'Change the state of the Feedback object based on whether or not the participant popped the balloon
If BoolEndTask = True Then
g_payTotal = g_payTotal + (nResponseCount-1)*0.05*100 
c.SetAttrib "PayTotal", g_payTotal
Feedback.ActiveState = "RewardState"
Else
c.SetAttrib "ExplodedBalloon", c.GetAttrib("BalloonName") & "exp_" & c.GetAttrib("Increment") & ".bmp"
g_payTotal = g_payTotal + 0
Feedback.ActiveState = "ExplodeState"
End If

'Release references
Set theState = Nothing
Set theResponseObject = Nothing
BoolEndTask = False

'Use the Timeout method to remove the balloon from the screen
BalloonTask.InputMasks.Timeout

-------------------------------------------------------------------------------------------------------------------------------------------
2. Next thing I struggled with is the probability, I am not sure if this is done right. Its suppose to be a replicate of the Rao, et al paper 2008. I attached a pdf of BART logic and the following table is from their paper:
Rao2008.PNG
Would greatly appreciate any help with this!!!!!

Many thanks

Jacky 
BART passive with Pause.es3
BART logic.pdf
BART with Pause.es3
Reply all
Reply to author
Forward
0 new messages