[solved] Display rt in Feedback
Hi,
I have a very basic question.
If I want to display the trial response time in my feedback, how do I do it?
For instance:
draw textline 0 -164 "Temps4: [avg_rt]"
is working
But
draw textline 0 -164 "Temps4: [response_time]
is not (and I want the response time for the current trial)
I tried everything I could think about:
draw textline 0 -164 Temps1: [exp.get(response_time)]
draw textline 0 -164 Temps1: [exp.get(response_time_keyboard_response)]
etc.
Unfortunately nothing worked...
Best regards,
Comments
Hi Boris,
In your second piece of OpenSesame code
you don't end the to-be-displayed string with double quotes. It should be:
Could that just be it? Or is that a typo in the forum post and not in your actual script?
Another thing that comes to mind is that you're trying to use a sketchpad item (rather than a feedback item) to display the trial response feedback. A sketchpad is constructed during the prepare phase of the trial sequence, and its content can therefore not depend on what happens later on in the sequence (e.g. during response collection). Feedback items, on the other hand, are constructed during the run phase of the sequence and therefore can depend on values (such as 'response' and 'response_time') that are collected just before.
If those suggestions do not solve your problem, don't hesitate to post again!
Best,
Lotje
Did you like my answer? Feel free to

Another thing that comes to mind is that you're trying to use a sketchpad item (rather than a feedback item) to display the trial response feedback. A sketchpad is constructed during the prepare phase of the trial sequence, and its content can therefore not depend on what happens later on in the sequence (e.g. during response collection). Feedback items, on the other hand, are constructed during the run phase of the sequence and therefore can depend on values (such as 'response' and 'response_time') that are collected just before.
That was the crucial point ! As sketchpad are very often used in the examples, I used sketchpads and this was my mistake...
Another problem is that when I want to store the "response_time" in a variable in an inline (even in the "Run Phase" tab), it is not possible...
For instance
is returning:
NameError: name 'response_time' is not defined
Hi boris,
variables in your loop tables, or feedback variables like response_time are set in self.experiment. They are not immediately accessible within your inline_script items, but you can 'get' and 'set' them using the experiment object
or
Note that if you want 'somme' to be available throughout the experiment as well, you should consider setting it using exp.set(), or defining it as global.
see: http://osdoc.cogsci.nl/usage/variables-and-conditional-qifq-statements/#getting-and-setting
I think I found a solution to the previous problem
This code is passing (but I do not know if Somme is correctly update)
Somme = Somme + self.get('response_time')
Then, at the end of the block I compute
global CountMot, Somme, Moy
Moy = Somme / CountMot
And , finally in my feedback I'd like to display Moy but that is not possible
OS is returning:
My script is there:
https://docs.google.com/file/d/0B-sE9ac1ksCAS3V1Q3NtU1ZIcDA/edit?usp=sharing
Hi,
Making variables global is only useful for future use within another inline_script item. For future use of a given variable in the interface (such as feedback items, but also, importantly, your logger item), you should set the variable like so:
exp.set("moy", moy)After doing so, the square-bracket method in the interface will work.
As Wouter also pointed out, more info about getting and setting variables can be found here:
Does this help?
Best,
Lotje
Did you like my answer? Feel free to

It works perfectly. Thank you very much !
The idea that you need to separate "inline" and "graphical interface" is not easy to get for beginners...
Then I had a new very naive problem:
I want to have an "if statement" in my inline
I wrote:
and got
SyntaxError: invalid syntax on my if statement
I tried various things but nothing worked.
Hi Boris,
The first line of your if-statement should end with a colon, like so:
if exp.get('correct') == 1:For more info on conditional statements in Python, see:
Did you like my answer? Feel free to

Thank you !