Howdy, Stranger!

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

Supported by

NameError: name 'correct' is not defined and creating a feedback loop

I keep getting this error, when trying to create a Stroop task like scenario:


NameError: name 'correct' is not defined


Also, how do I create a feedback loop that responds to a certain keyboard response for a certain colour to show the word correct or incorrect?


Thank you in advance

Comments

  • Hi Mojole,

    Could you prpvide more information on your code? An error message is a good start, but in order to solve a problem, we also need to know what you are actually trying to do.

    Also, how do I create a feedback loop that responds to a certain keyboard response for a certain colour to show the word correct or incorrect?

    I am not sure what you mean with feedback loop. Generally, the beginner's tutorial explains the logic that can be used to show feedback that depends on the response. See point 6. Basically you have two text fields on the feedback item. One says correct and has the run if parameter [correct]=1, the other says "incorrect" and has the run if parameter [correct]=0. Does that clear things up?

    Eduard

    Buy Me A Coffee

  •   File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libqtopensesame/misc/process.py", line 158, in run
        exp.run()
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/experiment.py", line 470, in run
        self.items.execute(self.var.start)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/item_store.py", line 103, in execute
        self.run(name)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/item_store.py", line 122, in run
        self[name].run()
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/sequence.py", line 51, in run
        self.experiment.items.run(_item)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/item_store.py", line 122, in run
        self[name].run()
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/loop.py", line 387, in run
        self.experiment.items.execute(self._item)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/item_store.py", line 103, in execute
        self.run(name)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/item_store.py", line 122, in run
        self[name].run()
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/sequence.py", line 50, in run
        if self.python_workspace._eval(cond):
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/base_python_workspace.py", line 141, in _eval
        return eval(bytecode, self._globals)
      File "
    

    Does this help? Sorry I am a beginner and don't understand much of the terminology

  • followed by

    NameError: name 'correct' is not defined
    


  • Yes, the problem is that you don't use feedback items but sketchpads. The difference is critical when you want to present feedback. See here for more information.

    tl;dr: Sketchpad items are created before the response is collected, and therefore before the variable "correct" is being produced. Feedback items are created after response collection, and should therefore work.

    Does that help?

    Eduard

    Buy Me A Coffee

  • I have changed it to feedback items, but it still isn't working? it is showing the same error

  • Okay, then I suppose you have no correct_response defined. Can you share the experiment here?

    Buy Me A Coffee

  • how do I do that?

  • If you click on the paper clip you can upload a file here in the forum. YOu can also drag&drop the file right into the edit window here.

    Buy Me A Coffee

  • Oh yeah, now I see. Your run_if statements are wrong. Only the variable must be placed within the brackets, not the boolean operators. Replace

    [correct=1] with [correct] = 1and accordingly, the other run if statement.

    Once changed, it runs for me. Also for you?

    Eduard

    Buy Me A Coffee

  • Thank you!

    Yes that runs the program, but it comes up with incorrect everytime?

  • That just means your response is never correct. So probably some part of the logic with which you collect responses doesn't work as you want it too.

    Looking at your script two things caught my eye.

    1. the sketchpad "word" has a duration of keypress (meaning that a key has to be pressed before the next item is executed)
    2. the keyboard item has a timeout of 100 ms

    To measure response times, the common approach is to set the duration of the sketchpad to 0 and rather control via the keyboard_item how long the stimulus is going to be presented. However, the timout of 100 ms is extremely short. I don't think it is possible to respond within 100 ms, which means there is no response, which essentially means the response is correct (and therefore you only see the incorrect feedback).

    If you increase the timeout to at least 500 ms (better even more, or "keypress"), you will see that the feedback procedure works.

    Good luck,

    Eduard

    Buy Me A Coffee

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