Howdy, Stranger!

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

Supported by

Possibility of converting inline_script (Python) in OpenSesame interface

Hello!

I would like to know if there is a chance to use this script in OpenSesame without Python (to be able to run the experiment in OSWeb and Jatos).

My structure is that I have in block loop set of pictures as Pic1 and Pic2 and also two positions - Pos1 and Pos2. Positions are shaffled, so I can not suggest that press 'w' will always be the right answer and etc.

And also I have a timeout for a participant response.

my_keyboard = Keyboard(keylist=[u'w', u'p'], timeout=2000)
start_time = clock.time()
key, end_time = my_keyboard.get_key()
var.response = key
var.response_time = end_time - start_time

var.response_timeout = int(var.response is None)

if var.pos1 == "centerleft":
    correct_answer = "w"
else:
    correct_answer = "p"

if correct_answer == var.response:
    var.total_correct  += 1

Thank you all in advance!

Comments

  • Hi @Daria ,

    Based on this code, it doesn't seem to me that you need any script at all. You can simply use a keyboard_response to replace the first part of the code, which collects a key press and does some basic bookkeeping. And then, in the block_loop (or wherever pos1 is defined) also create a column for the variable correct_response and set it to 'w' whenever pos1 is 'centerleft', and to 'p' if pos1 has a different value.

    Hope this helps!

    -- Sebastiaan

    Buy Me A Coffee

  • Thank you, @sebastiaan . Still can not understand completely.

    Right now my block_loop looks like this.

    I am shuffling pos1 and pos2 randomly.

    You suggesting creating just pos instead of pos1 and pos2? and it will be centertight and centerleft and so on? and create correct_response with 'w' and 'p'?

    pic1 is always the correct answer in my experiment.


    Thank you!

  • edited July 21

    Hi @Daria ,

    I am shuffling pos1 and pos2 randomly.

    If you mean that you're shuffling these columns independently, with a shuffle operation in the script of the loop item, then my suggestion indeed won't work because the shuffling will break the correspondence between the columns. (Or, to put it differently, values from the same row won't be kept together.)

    In that case, you can use a simple inline_javascript item the start of the trial sequence with the following code in the prepare phase:

    if (vars.pos1 === "centerleft") {
        vars.correct_response = "w"
    } else {
        vars.scorrect_response = "p"
    }
    

    This will set the correct_response variable based on pos1 with the same logic as your previous script.

    -- Sebastiaan

    Buy Me A Coffee

  • @sebastiaan

    Yes, but that would mean that I won't be able to run my experiment online :(


    Thank you

  • Yes, but that would mean that I won't be able to run my experiment online :(

    No you would be able to do that! You can include JavaScript in an OSWeb experiment as described on this page:

    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