Howdy, Stranger!

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

Supported by

[solved] Randomize and take only one of three conditions

edited January 2016 in OpenSesame

Hi

I would like to presents words (every word only once) on a screen either on the left side, right side or in the middle.

So I created a loop for all words (variable = words (1,2,3,4,..) and in this loop is another loop with the word_positions: -350 (=left), 0 (=middle), 350 (=right).

But I want that every single word appears only once and either left, right or in the middle (not on all positions, only at one).
So I set the amount of cycles to 0,35 (1x0,35) of the seconds loop. This works. Every word only appears once left, right or in the middle and not in all three conditions like before.

But now, I want, that every condition (left, right, middle) appears balanced (for 30 words, 10 words right, 10 words left and 10 words in the middle). But randomized as before. How I can realise that?

My aim: every Participant sees 30 words. The words appear on a screen on the left, right or in the middle in random order. Every word should appear only once.

Thank you in advance :)

image

Comments

  • edited 6:23AM

    Hi,

    I think, a single loop that iterates over the words will be enough for your purposes.
    In this loop, add each of the words on a line. This makes sure that you will see each word only once (unless you repeat the entire list multiple times). In order to make the position were the word is presented counterbalanced, you need to do some inline_scripting. Add one inline_script before the word-loop. Inside this inline_script, you will create a list will all possible locations and how often they appear, like so:

    import random
    positions = [-350,0,350]*10
    random.shuffle(positions)
    

    Next, you have to place another inline_script in the sequence, which the word loop is iterating over (so the one, in which you are also going to present the words).
    In this inline_script, you will draw one position from your list of positions and use it to define, where the word will be drawn to.

    # takes the first value in that list without replacement
    position = positions(0)
    

    After that you can draw your stimuli, either with a sketchpad, or you can draw directly from within this same inline_script:

    # just a small example. Of course you have adapt it to your preferences
    cv = canvas()
    cv.text(var.word, x = position,y=0)
    cv.show()
    self.sleep(1000)
    

    I hope this helped.

    Eduard

    Buy Me A Coffee

  • edited 6:23AM

    Thank you a lot Eduard, this looks great :)

    But I have still one problem: when I run this, there occurs this error:
    "Error while executing inline script
    phase: run
    item: __script2
    line: 2
    exception message: 'list' object is not callable
    exception type: TypeError"

    So in the seconds script (# takes the first value in that list without replacement
    position = positions(0)) this occurs at line 2 =" position = position(0)".

    I've tried to set the list "positions" global. But this dont solve the problem. I dont get it

    image

  • edited 6:23AM

    Hi,

    My bet, I forgot something in the code.

    Instead of position = positions(0) it should have been position = positions.pop(0)

    Sorry for that.

    eduard

    Buy Me A Coffee

  • edited 6:23AM

    Ok, it works :) Thanks :)

    Still one question:

    If I use the canvas instead of the sketchpad, it shows me this error:
    "item: __script2
    line: 4 exception message: name 'canvas' is not defined
    exception type: NameErroras()"

    But canvas is a function...

    But if I use the sketchpad instead of the canvas-inline code, it tells me, there is no variable "position".

    Sorry for the questions again, I'm really a newbie.

    Thank you

  • edited 6:23AM

    Which version of OpenSesame do you use?

    Assuming that you use OpenSesame 3.0.x
    For the sketchpad use you have to make position a variable of the experiment. This works simply by storing it as var.position = positions.pop(0). Then later in the sketchpad, you set the position you want to draw as [position].

    If you use Opensesame 2.9.x, things are a bit different. Let me know if this is the case, and I will explain what you could do.

    Eduard

    Buy Me A Coffee

  • edited 6:23AM

    Ok, I used "exp.set("position", position)" and it works.

    Thank you a lot Eduard. Outstanding support.

  • edited 6:23AM

    Ah ok. Then 2.9 it was.

    You're welcome.

    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