Register Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
MR_Riley

Junior Member
Registered:
Posts: 5
Reply with quote  #1 
Hello to all.

We are trying to implement a task where we display a background image that covers the entire touchscreen monitor while a cue is displayed on the center of the image and a black bar at the bottom of the image. After a delay period, the black bar goes away and two targets are revealed for the monkey to choose one.

When I run this script, only the background image appears on the monitor. All images are pngs (for the transparent background/odd shapes).

if ~exist('eye_','var'), error('This task requires eye signal input. Please set it up or try the simulation mode.'); end
showcursor(false);  % remove the joystick cursor


% give names to the TaskObjects defined in the conditions file:
background = 1;
cue = 2;
monkey1 = 3;
monkey2 = 4;
bgbar = 5;
CorrectSound = 6;
ErrorSound = 7;

% define time intervals (in ms):
wait_for_fix = 5000;
sample_time = 5000;
max_reaction_time = 2000;


% touch window (in degrees):
hold_radius = 2.5;

% toggleobject(background,'Status','on','eventmarker',10);
toggleobject(cue,'Status','on');
toggleobject(bgbar,'Status','on');
idle(sample_time);
toggleobject(bgbar,'Status','off','eventmarker',20);
toggleobject([monkey1 monkey2],'Status','on');
ontarget = eyejoytrack('touchtarget', monkey1, hold_radius, max_reaction_time);
if (ontarget == 1) % if stimulus is touched
    toggleobject([background cue monkey1 monkey2], 'Status', 'off'); % turn off all stimulus
   goodmonkey(100, 'juiceline',1, 'numreward',2, 'pausetime',500, 'eventmarker',50); % 100 ms of juice x 2
    toggleobject(CorrectSound);
    trialerror(0); eventmarker(50) % Correct trial
    toggleobject(Square2, 'Status', 'off'); % take away touched stimulus
end
if (ontarget == 0) % if stimulus is not touched
    toggleobject([background cue monkey1 monkey2], 'Status', 'off'); % turn off initial stimulus
    trialerror(1); eventmarker(60)% monkey did not touch
    toggleobject(ErrorSound);
end

Nothing happens if I change the order of background, cue, and bgbar. The background image remains present on the screen and no other objects are shown. I've tried running it without that image and everything still pops up; it's just appearing under the background image.

If anyone has any idea how to correct this, I would be very appreciative.

Thank you all.
0
Jaewon

Administrator
Registered:
Posts: 577
Reply with quote  #2 
You need to change the order of TaskObjects in the conditions file, not in the timing script. See the online manual of the conditions file in the following link.

http://www.brown.edu/Research/monkeylogic/conditionsfiles.html#arguments

At the bottom of the TaskObjects section, it says, "For visual stimuli, a TaskObject with a lower number (towards the left of the list) will layer atop those to its right. Therefore, most users will want fixation point images, for example, to be the first item listed, so that it will remain visible over any images that might appear at the same location."

So your code should be like this:

background = 5;
cue = 1;
monkey1 = 2;
monkey2 = 3;
bgbar = 4;
CorrectSound = 6;
ErrorSound = 7;

% Do not call toggleobject multiple times. Just one call will do.
toggleobject([background cue bgbar],'eventmarker',10);
idle(sample_time);
% This will turn off bgbar and turn on monkey1 and monkey2 simutaneously
toggleobject([bgbar monkey1 monkey2],'eventmarker',20);
0
MR_Riley

Junior Member
Registered:
Posts: 5
Reply with quote  #3 
Thank you for your help. That solved the problem I was encountering.

On another topic, would you know how best to track two different areas of the touchscreen for presses?

For example, could we run two different eyejoytrack scripts simultaneously to detect which target was touched rather than wait for one to finish the duration?
0
Jaewon

Administrator
Registered:
Posts: 577
Reply with quote  #4 
You can set multiple targets for eyejoytrack. See the manual below.

http://www.brown.edu/Research/monkeylogic/timingscripts.html#eyejoytrack
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.