Ive created the Lua Script for this and its working except I need to have a 10 second delay between each trial. So after the first trial finishes (45 tones played) I need a 10 second rest time. The thing is Ive done this using the following Lua Code:
Code: Select all
function process(box) -
-- Delay Function for the loop so we shall insert a 10 second delay
local trial = t
local ti=0
local isi =10
-- Entering the "Busy Wait" function
function wait_until(box, t)
while box:get_current_time() <= t+isi do
box:sleep()
end
end
function wait_for(box, duration)
wait_until(box, box:get_current_time() + duration)
end
box:send_stimulation (1,OVTK_StimulationId_ExperimentStart,ti,0)
-- Time definition
ti=ti+2
box:send_stimulation (1,OVTK_StimulationId_TrialStart,ti,0)
t2=ti
for k=1,4 do
-- Testing if table values are 1(Stim A) or 2 (Stim B), out of the 52 values only 45 are tested.
for i=1,45 do
if trial[i]==1 then
box:send_stimulation(1,OVTK_StimulationId_Label_00 , t2, 0)
t2=t2+0.5
else
box:send_stimulation(2, OVTK_StimulationId_Number_01, t2, 0)
t2=t2+0.5
end
end
t_sleep=t2
wait_until(box, t_sleep+isi)
end
end
This code is giving me a time out in the box:send_stimulus function. Does anyone have an idea how can this be worked out? Sorry but Im not a very proficient progammer so any guidance is accepted. The error on console is the next one:
[ WARNING ] At time 44.508 sec <Box algorithm::(0x00004a4d, 0x000075c2) aka Odball Stim LUA> Ignored outdated stimulation 33024 43.000 sec 0.000 sec sent on output 1 - older than last chunk end time 44.500 sec -- And so on for each stim on the second iteration.
Thanks in Advanced for all the help.
Best Regards