I have taken your code recommendations and attempted to apply them, however, it appears that the image field "Photo" is not changing the image during the cycleup / cycle down (the thumbposition does move however). Further the image does not load in when scrolling the "Slider2".
The images themselves are located in a folder called "Figures", and are sequentially named, 1-0.bmp, 1-1.bmp.... 1-50.bmp.... 144-0.bmp, 144-1.bmp, 144-100.bmp .
I am not sure why this problem is occurring, I tried making "ImageNum" a global.
Other than the not loading of the images, the program does what it is supposed to from what I can see (Timeouts are appropriate, the pressing of the mousedown to initiate Validresponse etc)
For now I am running participants without the timeouts being called and it is running stable enough.
I will tinker some more,
Thank you for the time and effort,
I appreciate it,
-Brandon
I will now post the code I am tinkering with
Code: Select all
global stimlist, photopath, trialnum, imagenameexp
on scrollbardrag 
  put the thumbpos of scrollbar "slider2" into x
   set the itemdelimiter to tab
  set the filename of image "photo" to photopath&imagenameexp&"-"&x&".bmp"
end scrollbardrag
Code: Select all
global thepath, photopath, datapath, imagelist, Data, voicelist, response, soundpath, listened, responseTime, fName, stimlist, trialnum, responseVal, TimeOutID, ImagenameExp, StartNum, Endnum, t1, stimlist, imagenum
ValidResponse
local maxTrial, maxTrial2 
on preopenCard 
   hide image "Photo" 
   hide player "Voices" 
   hide scrollbar "Slider" 
   hide scrollbar "Slider2" 
   hide button "Next"
   hide button "Next2" 
   hide button "Replay" 
   hide image "fixation" 
   hide fld "EndofTime" 
   hide fld "EndofExperiment" 
   hide fld "Break" 
   hide fld "Break2" 
   hide button "Resume" 
end preopencard 
on opencard 
   put 72 into maxTrial 
   put 144 into maxTrial2 
   put 1 into trialnum 
    
   beginExperiment 
    
end openCard 
on beginExperiment 
   
   get flushevents("all")
   put 0 into response 
   put 0 into listened 
   if trialnum <= maxTrial then 
      
      show image "fixation" 
      wait 1 second 
      hide image "fixation" 
      
      set the itemdelimiter to tab 
      -- this setting remains in force within this handler, but only in this handler (locally) 
      set the filename of player "Voices" to soundpath&item 7 of line trialnum of stimlist&".wav" 
      set the filename of player "Voices2" to soundpath&item 7 of line trialnum of stimlist&".wav" 
      set the filename of player "Voices3" to soundpath&item 7 of line trialnum of stimlist&".wav" 
      set the filename of player "Voices4" to soundpath&item 7 of line trialnum of stimlist&".wav" 
      set the filename of player "Voices5" to soundpath&item 7 of line trialnum of stimlist&".wav" 
      
      
      set the filename of image "Photo" to empty 
      
      set the lockscreen to true 
      show image "photo" 
      show scrollbar "Slider" 
      disable button "Next" 
      disable button "Next2"
      disable button "Replay" 
      set the lockscreen to false 
      
      put random (2) into donkey 
      /* It is more efficient to extract item 6 into a variable, for use in the repeats and scrolls, as well as making the script easier to follow. It is used by CycleImages and scrolllbardrag. */ 
      put item 6 of line trialNum of stimList into imageName 
      if donkey = 1 then 
         TestPath1 
      end if 
      
      if donkey = 2 then 
         TestPath2 
      end if 
      
      put donkey into item 20 of line trialnum of stimlist 
      
      set the lockscreen to true 
      show button "Next" 
      show button "Replay" 
      
      hide scrollbar "slider" 
      set the thumbpos of scrollbar "slider2" to 25 
      enable scrollbar "slider2" 
      show scrollbar "slider2" 
      enable button "Next" 
      enable button "Replay" 
      set the lockscreen to false 
      
      put the milliseconds into t1 
      send "timeout" to me in 15 seconds 
      put the result into timeOutID 
   else 
      hide scrollbar "Slider" 
      hide scrollbar "Slider2" 
      hide button "Next" 
      hide button "Replay" 
      show field "Break" 
      wait 60 seconds 
      hide field "Break" 
      show field "Break2" 
      show button "Resume" 
   end if 
end beginExperiment 
on TestPath1 
   global startNum, endNum 
   play stop 
   start player "Voices2" 
   disable scrollbar "Slider2" 
   disable scrollbar "Slider" 
   -- display image 25 up to 50 
   put 25 into startNum 
   put 50 into endNum 
   CycleImagesUp 
   -- display image 49 down to 25 
   put 49 into startNum 
   put 25 into endNum 
   CycleImagesDown 
    
   play stop 
   start player "Voices3" 
   -- display from image 24 down to 0 
   put 24 into startNum 
   put 0 into endNum 
   CycleImagesDown 
   -- display from image 1 up to 25 
   put 1 into startNum 
   put 25 into endNum 
   CycleImagesUp 
    
   play stop 
   start player "Voices4" 
end TestPath1 
on TestPath2 
   global startNum, endNum 
   play stop 
   start player "Voices2" 
   disable scrollbar "Slider2" 
   -- display from image 25 down to 0 
   put 25 into startNum 
   put 0 into endNum 
   CycleImagesDown 
   -- display from image 1 up to 25 
   put 1 into startNum 
   put 25 into endNum 
   CycleImagesUp 
    
   play stop 
   start player "Voices3" 
   --display from image 26 up to 50 
   put 26 into startNum 
   put 50 into endNum 
   CycleImagesUp 
   -- display from image 49 down to 25 
   put 49 into startNum 
   put 25 into endNum 
   CycleImagesDown 
    
   play stop 
   start player "Voices4" 
end TestPath2 
on CycleImagesUp 
   global startNum, endNum, photoPath, trialNum, stimList 
   repeat with imageNum = startNum to endNum 
      set the fileName of image "Photo" to photopath&imageNameExp&"-"&imageNum&".bmp" 
      set the thumbPosition of scrollbar "Slider" to imageNum 
      wait 8 milliseconds with messages 
      /* "with messages" is added here, as Bernd suggests. */ 
   end repeat 
end CycleImagesUp 
on CycleImagesDown 
   global startNum, endNum, photoPath, trialNum, stimList 
   repeat with imageNum = startNum down to endNum 
      set the fileName of image "Photo" to photopath&imageNameExp&"-"&imageNum&".bmp" 
      set the thumbPosition of scrollbar "Slider" to imageNum 
      wait 8 milliseconds with messages 
   end repeat 
end CycleImagesDown 
on ValidResponse
   global t1, timeOutID, trialnum, stimlist 
   put the milliseconds into t2 
   put t2 - t1 into responseTime 
    
   cancel timeOutID 
    
   set the itemdelimiter to tab 
   saveData responseTime 
   saveChoice 
   set the lockscreen to true 
   hide image "Photo" 
   hide player "voices" 
   hide scrollbar "Slider" 
   hide scrollbar "slider2" 
   hide button "Next" 
   hide button "Replay" 
   hide image "fixation" 
   hide fld "EndofTime" 
   hide fld "EndofExperiment" 
   set the lockscreen to false 
    
   put trialnum into item 1 of line trialnum of stimlist 
    
   add 1 to trialnum 
   send "beginExperiment" to me in 10 milliseconds 
end ValidResponse 
on timeout 
   set the lockscreen to true 
   hide image "Photo" 
   hide player "voices" 
   hide scrollbar "Slider" 
   hide scrollbar "Slider2" 
   hide button "Next" 
   hide button "Replay" 
   set the lockscreen to false 
    
   show field "EndofTime" 
   wait 3 seconds 
   hide field "EndofTime" 
    
   set the itemdelimiter to tab 
   put trialnum into item 1 of line trialnum of stimlist 
   put listened into item 15 of line trialnum of stimlist 
   put "T-O" into item 16 of line trialnum of stimlist 
   put "T-O" into item 17 of line trialnum of stimlist 
   put "T-O" into item 18 of line trialnum of stimlist 
   put "T-O" into item 19 of line trialnum of stimlist 
   add 1 to trialnum 
    
   send "beginExperiment" to me in 10 milliseconds 
end timeout
on beginExperiment2 
   
   get flushevents("all")
   put 0 into response 
   put 0 into listened 
   if trialnum <= maxTrial then 
      
      show image "fixation" 
      wait 1 second 
      hide image "fixation" 
      
      set the itemdelimiter to tab 
      -- this setting remains in force within this handler, but only in this handler (locally) 
      set the filename of player "Voices" to soundpath&item 7 of line trialnum of stimlist&".wav" 
      set the filename of player "Voices2" to soundpath&item 7 of line trialnum of stimlist&".wav" 
      set the filename of player "Voices3" to soundpath&item 7 of line trialnum of stimlist&".wav" 
      set the filename of player "Voices4" to soundpath&item 7 of line trialnum of stimlist&".wav" 
      set the filename of player "Voices5" to soundpath&item 7 of line trialnum of stimlist&".wav" 
      
      
      set the filename of image "Photo" to empty 
      
      set the lockscreen to true 
      show image "photo" 
      show scrollbar "Slider" 
      disable button "Next" 
      disable button "Next2"
      disable button "Replay" 
      set the lockscreen to false 
      
      put random (2) into donkey 
      /* It is more efficient to extract item 6 into a variable, for use in the repeats and scrolls, as well as making the script easier to follow. It is used by CycleImages and scrolllbardrag. */ 
      put item 6 of line trialNum of stimList into imageNameExp 
      if donkey = 1 then 
         TestPath1 
      end if 
      
      if donkey = 2 then 
         TestPath2 
      end if 
      
      put donkey into item 20 of line trialnum of stimlist 
      
      set the lockscreen to true 
      show button "Next2" 
      show button "Replay" 
      
      hide scrollbar "slider" 
      set the thumbpos of scrollbar "slider2" to 25 
      enable scrollbar "slider2" 
      show scrollbar "slider2" 
      enable button "Next2" 
      enable button "Replay" 
      set the lockscreen to false 
      
      put the milliseconds into t1 
      send "timeout2" to me in 15 seconds 
      put the result into timeOutID 
   else 
     
  show field "EndofExperiment"
  wait 5 seconds with messages
  put stimlist into field "Data" of cd "data"
  put stimlist into data
  go to card "data"
  
  put the internet date into y
  put return&"Trialnum"&tab&"Condition"&tab&"Age"&tab&"Language"&tab&"Sex"&tab&"ImageName"&tab&"WordName"&tab&"Con1"&tab&"Vow1"&tab&"Con2"&tab&"Vow2"&tab&"Wordtype"&tab&"1stcontype"&tab&"RealWord?"&tab&"#Replays"&tab&"RT"&tab&"ResponseValue"&tab&"ResponseType"&tab&"Magnitude"&tab&"MvDirection" after y
  put "file:"&DataPath&"D"&the ticks into fName
  put y&return&Data into URL fName
end if
end beginExperiment2 
on ValidResponse2
   global t1, timeOutID, trialnum, stimlist 
   put the milliseconds into t2 
   put t2 - t1 into responseTime 
    
   cancel timeOutID 
    
   set the itemdelimiter to tab 
   saveData responseTime 
   saveChoice 
   set the lockscreen to true 
   hide image "Photo" 
   hide player "voices" 
   hide scrollbar "Slider" 
   hide scrollbar "slider2" 
   hide button "Next" 
   hide button "Next2"
   hide button "Replay" 
   hide image "fixation" 
   hide fld "EndofTime" 
   hide fld "EndofExperiment" 
   set the lockscreen to false 
    
   put trialnum into item 1 of line trialnum of stimlist 
    
   add 1 to trialnum 
   send "beginExperiment" to me in 10 milliseconds 
end ValidResponse2 
on timeout2 
   set the lockscreen to true 
   hide image "Photo" 
   hide player "voices" 
   hide scrollbar "Slider" 
   hide scrollbar "Slider2" 
   hide button "Next2" 
   hide button "Next"
   hide button "Replay" 
   set the lockscreen to false 
    
   show field "EndofTime" 
   wait 3 seconds 
   hide field "EndofTime" 
    
   set the itemdelimiter to tab 
   put trialnum into item 1 of line trialnum of stimlist 
   put listened into item 15 of line trialnum of stimlist 
   put "T-O" into item 16 of line trialnum of stimlist 
   put "T-O" into item 17 of line trialnum of stimlist 
   put "T-O" into item 18 of line trialnum of stimlist 
   put "T-O" into item 19 of line trialnum of stimlist 
   add 1 to trialnum 
    
   send "beginExperiment2" to me in 10 milliseconds 
end timeout2
on saveChoice
  set the itemdelimiter to tab
  if response = 1 then
    put the thumbpos of scrollbar "slider2" into item 17 of line trialnum of stimlist
    put the thumbpos of scrollbar "slider2" into ResponseVal
put listened into item 15 of line trialnum of stimlist
put ResponseVal-25 into item 19 of line trialnum of stimlist
if ResponseVal=25 then
  put "M" into item 18 of line trialnum of stimlist
  end if
if ResponseVal>25 then 
put "R" into item 18 of line trialnum of stimlist
  end if
  if ResponseVal<25 then 
  put "J" into item 18 of line trialnum of stimlist
  end if
end if  
end saveChoice
on saveData x
  set the itemdelimiter to tab
  put x into item 16 of line trialnum of stimlist
end saveData x
