Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Variables

edited June 2016 in OpenSesame

Hello..I have a first variable ("give"). And I have a second variable that is the response to text input ("my_response_var"). I want to create a third variable that will be likewise: 50- [give]+ [my_response_var"] and then show the third variable at a sketchpad. How can I do that?

Thanks for your help 

Comments

  • edited 2:50AM

    Hi,

    You can use Python in text strings with the [= ... ] syntax, as shown here:

    In your case, it seems like the following text would do the job: "[=50-var.give+var.my_response_var]"

    Does that help at all?

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited 2:50AM

    Hi, thanks for your answer, but it's not working..
    this is the error:

    Details

    item-stack: experiment[run].new_loop_3[run].men_1[prepare].new_sketchpad_9[prepare]
    exception message: unsupported operand type(s) for -: 'int' and 'unicode'
    time: Tue Jun 14 11:05:35 2016
    exception type: TypeError

    What can I do?

    Thanks again

  • edited 2:50AM

    Hi,

    It seems that the second variable of that equation is a string type rather than a number type. You have to specify that the value of that second variable should count as a number. You can do that by means of using "int(my_response_var)".

    Cheers,

    Josh

Sign In or Register to comment.