Using if..else statements to calculate custom values


Author
Message
Blazer
Blazer
Esteemed Member (1.9K reputation)Esteemed Member (1.9K reputation)Esteemed Member (1.9K reputation)Esteemed Member (1.9K reputation)Esteemed Member (1.9K reputation)Esteemed Member (1.9K reputation)Esteemed Member (1.9K reputation)Esteemed Member (1.9K reputation)Esteemed Member (1.9K reputation)
Group: Forum Members
Posts: 11, Visits: 94
Hello,

I've been having some trouble getting Inquisit to automatically calculate and output custom variables. It may be that I just don't understand the basic notation for if...else statements in Inquisit. The experiment involves participants watching a video and reacting to a stimulus that appears during the video by pressing the spacebar (scancode 57). However, I also want to record if they may make an erroneous response and react too early to an incorrect stimulus in the video. If they make an erroneous response, they will still watch until the end of the video. Supposing the video lasts 6 seconds and the correct stimulus appears 3 seconds in, here is how I was trying to make Inquisit output a "reactiontime" which would be the difference between the latency and when the correct stimulus appeared:

<values>
/ reactiontime1 = if (trial.trial1.response == 57 && block.block1.latency >= 3000) (block.block1.latency - 3000)  else -8
</values>

<summarydata>
/ columns = [values.reactiontime1]
</summarydata>

<video Video1>
/ items = ("Video1.wmv")
</video>

<trial Trial1>
/ beginresponsetime = 0
/ inputdevice = keyboard
/ validresponse = (57)
/ responseinterrupt = trial
/ timeout = 6000
/ stimulusframes = [1=Video1]
</trial>

<block Block1>
/ preinstructions = (instructions)
/ trials = [1=Trial1]
</block>

<expt Expt1>
/ blocks = [1=(Block1)]
</expt>

When I test the experiment, all I've ever gotten for "values.reactiontime1" is "-8" How can I get to it to actually subtract the 3000 milliseconds from the recorded latency, thus giving me the reaction time for the correct stimulus?

Also, it seems like ever since I started trying these values, the data report of other variables has been affected. It seems it will only record a trial.trial1.response as 57 if I hit spacebar before the correct stimulus appears. If I wait to react to the stimulus, it outputs the response as 0. Why would other variables be affected when I'm just creating new ones and not altering the way the experiment accepts responses?

Lastly, unrelated to this particular issue, but I wouldn't mind someone confirming my understanding of Inquisit 4. There is no possible way to get Inquisit 4 to record two or more valid responses in one trial, right? For instance, if someone reacts too early to an erroneous stimulus in the video, I won't be able to record if they hit spacebar a second time once the correct stimulus appeared, correct?

Please advise.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Reading This Topic

Explore
Messages
Mentions
Search