Howdy, Stranger!

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

Supported by

Question about exp.set function

edited February 2017 in OpenSesame

For my experiment, I am trying to set up the basic response counterbalancing, such as the one in the lexical decision example experiment. I made the inline_script object at the very start of the experiment (see picture)

Then I put up a sketchpad called Instructions, with the following text:
If the face is HAPPY, press [happy_response]
If the face is FEARFUL, press [fear_response]

However, when I attempt to run this, I get an error message, informing me that variable "happy_response" does not exist. The variable is present in the variable inspector, and its source listed as this inline_script (again, see picture), however in spite of my using exp.set function, OpenSesame does not assign the value to the variable, nor does it recognise it when it's called in the sketchpad.

Any ideas? I tried different order of the commands, checked a hundred times that the spelling is identical all over, but nothing changes. I am new to the software, but I read the manual and I really can't tell that I did anything wrong.

Comments

  • Hi,

    To understand the problem, you need to understand the prepare-run strategy that OpenSesame uses. Every item from a sequence is called twice: first to prepare, and then to run. In your case, you define your variables in the run phase of your inline_script. Because the sketchpad is prepared during the prepare phase (which comes first) the variables don't exist yet. Does that make sense?

    So the solution is to move your code to the prepare tab of the inline_script.

    See also:

    Incidentally, exp.set() is outdated. The modern way to interact with experimental variables is to use the var.var_name syntax. See:

    Cheers,
    Sebastiaan

  • edited February 2017

    Hi,

    thank you, that worked like a charm! :smile:
    However, now I have a different problem, again with the inline script. I tried to create a script to tell the program which response is correct, which looks like this:

    However, as you can see in the variable inspector, no matter what I do the accuracy is 0.
    What did I mess up this time? :dizzy:

  • Hi,

    There are a few things wrong here. The first has to do with Python syntax:

    var.emotion = 'Happy' or 'Fear'
    

    As they say, I don't think this means what you think it means. You can find some background information about using and and or with strings here:

    But basically, if you want to make a random choice, you can do something like this:

    var.emotion = 'Happy' if sometimes() else 'Fear'
    

    Regarding setting var.correct_response: The expected value is a semicolon-separated string, not a list. So you'll simply want to do:

    var.correct_reponse = var.happy_response
    

    Cheers,
    Sebastiaan

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games