Howdy, Stranger!

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

Supported by

Disappearing code

edited December 2019 in OpenSesame

Code I type into the script of a sketchpad disappears when I leave the sketchpad item. For example,

A. first, in the sketchpad I type the four lines


set duration "[duration]"
set description "Displays experimental stimuli"
var.left_file = "BM10Neutral.png"
draw image center=1 file="[left_file]" scale=1 show_if=always x=-288 y=-192 z_index=0


B. Then I click on "Apply and close". If I select "View script" the four lines are still there.

C. If I click on a different item in the Overview pane and then click back on the sketchpad item in that pane, the third line is no longer there, i.e., the three lines in the sketchpad script are:


set duration "[duration]"
set description "Displays experimental stimuli"
draw image center=1 file="[left_file]" scale=1 show_if=always x=-288 y=-192 z_index=0


If I try to run the experiment it fails saying that left_file does not exist (of course).

Saving the experiment file after pressing "Apply and close" does not help - the problem remains.

I'm running OpenSesame 3.2.8 on Windows 10.

Any suggestions? This may be related to the problem described at

which doesn't seem to have been resolved.

Thanks.

Greg Reese

Comments

  • Hi Greg,

    The issue here is that you're mixing two different languages: OpenSesame script and Python.

    • OpenSesame script is the simple language that is used for defining items. So if you're viewing the script of a sketchpad , you're looking at OpenSesame script.
    • Python is a full-fledged programming language. It's what you use in an inline_script item.

    You're typing Python script where OpenSesame excepts OpenSesame script. This is invalid, and the Python script is therefore removed again. Does that make sense?

    Cheers!

    Sebastiaan

  • Thanks Sebastiaan. I'll give it a try.

    Greg Reese

Sign In or Register to comment.