Howdy, Stranger!

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

Supported by

How to access higher-level objects (scripts, loops, sequences, etc.) in javascript?

Hi everyone,

I noticed in the documentation (https://osdoc.cogsci.nl/4.0/manual/javascript/about/) that we can easily access the experimental variables and files from the pool in js scripts. I was wondering whether it is possible or not to similarly access higher level objects of the experiment such as scripts, loops, sequences, etc.

In particular, what I want to do is having a js script that says which part of the experiment will be run based, for instance, on conditional statements, without relying on the GUI. See my non-working example code below.

// Tell OpenSesame to not run my_other_script
[my_other_script] = false 
var my_var = "ok"

// If my_var is "ok", please tell OpenSesame it is ok to run my_other_script.
if (my_var == "ok") {
    [my_other_script] = true
}

I think something similar is possible with a python script, but is it with a js script (using OpenSesame 4.0)? If it is possible, how to do that? Thanks!

Silk--

Comments

  • Hi Silk,

    I don't think it is as easy as it is for Python, but I am not sure as I am not very familiar with Osweb. @Fab do you know whether this is possible?

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.