Howdy, Stranger!

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

Supported by

Newbie questions: Variables, Positions, Scripts, Forum

Hi all, I am completely new to Open Sesame and in my first 30 min of it, I ran into several dead ends. Maybe someone could help me.


1

I would like to use variable in my scripts. Just easy stuff like setting the width of several objects to the same variable. So I don't think this is what you'd call an experimental variable that potentially changes with every loop or trial, I just want to make my scripts more efficient and easy to adapt by using in-script variables.

According to [1] this should work kinda like this:

exp.set('wi', 300)

draw rect color="#e6e6e6" fill=1 h=200 penwidth=0 show_if=always w=self.get("wi") x=-330 y=-267 z_index=0

But I am told that the width self.get(wi) is unknown or variably defined. Why does this not work?


2

When I change the script and then change anything in the GUI, my entire script is overwritten. How can I prevent that from happening?


3

Is there a way to define the positions of objects by their center instead of their upper left corner?


4

Why can't I more easily search for posts in a specific forum on this site? Do I really have to type

site: https://forum.cogsci.nl/index.php?p=/categories/opensesame

into a google search window in order to search the forum? I'm sure there is a better way :)


Thanks and all the best,

Jens


[1]

https://osdoc.cogsci.nl/2.9.3/usage/variables-and-conditional-statements/#getting-and-setting-variables-in-inline_script-items

Comments

  • Additional comment on 1:

    Also exp.set('wi', '300') does not work.


    5

    Is it intended behavior that whitespace and brackets are not parsed the way they would be in Python?

    x=-260 -100 does not work

    x=-260-100 works

    x= -260-100 does not work

    x=-(260-100) does not work


    6

    Do others also have the problem that not all actions are revertible with the Undo option? Sometimes, steps are missing for me.

  • Hi Jens,

    I would recommend you take a step back and familiarize yourself with the software (for example via the tutorial: https://osdoc.cogsci.nl/3.2/tutorials/beginner/)

    Most of your problems are related to the fact that you are mixing Openseame internal syntax (draw rect color="#e6e6e6" fill=1...) with python code (exp.set()). They don't work together. You either do one or the other in a single window (depending on which you activate).

    From what I understand, I think you want to use Python code. To do so, I recommend you put your code into inline_scripts which are items in which you can use regular Python scripting. If you get a feel for that, your others problems will solve accordingly. For example, defining objects based on their center can be done in python (depending on what object you want: https://osdoc.cogsci.nl/3.2/manual/python/canvas/).

    You can search on the forum. On the top left, there is a search window.

    More generally, what do you want to accomplish, I am a bit confused by the commands you used.


    Eduard

    Buy Me A Coffee

Sign In or Register to comment.