Howdy, Stranger!

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

Supported by

[open] Random Time Display for Sketchpad?

edited September 2012 in OpenSesame

Help...

I am trying to devise a flanker task in open sesame. I have created 1 experiment with 3 loops to hold a practice session (loop 1) and two trials (loop 2 and loop 3). Each loop contains a sketchpad with cross-hairs. I would like for each sketchpad to be displayed a random time between 800 - 2000 ms. (Can open sesame can do this?)

From browsing the web and the help of a colleague (Thank you, drogers!), I have tried to put together a script, but have not succeeded due to an alarming amount of pop-up errors. These are the sources I've used to create the script:
http://osdoc.cogsci.nl/python-inline-code/inlinescript-functions -- using 'self. experiment.set ()' for setting a variable
http://osdoc.cogsci.nl/python-inline-code/code-snippets -- example code
http://docs.python.org/library/random.html#random.randint -- brief description of how to generate a random integer N, a<=N<=b

And, here's the script:

# Set variable time
self.experiment.set("random820", "N, 800<=N<=2000") Setting variables to time self.experiment.set("cross_display", "random820") Getting variables print self.get("cross_display") Checking whether a variable exists if self.has("cross_display"):
print "cross_display exists" *** end of script ***

-- random820 is the random time value generated, between 800ms and 2000 ms.
-- cross_display is the variable to be assigned to time value.

I'm unable to run the experiment because of this error (or a variation of this error):
Error: Runtime error
Description: Variable 'random820' is not set in item 'crossp'.
You are trying to use a variable that does not exist. Make sure that you have spelled and capitalized the variable name correctly. You may wish to use the variable inspector (Control + I) to find the intended variable.

When I use the variable inspector, I am able to find the variable easily. After double-checking spelling and capitalization, there seems to be no error there. I'm not sure if the variable is correctly coded or if I'm placing the script in the correct location.

I've tried a few different variations on creating the variable, but they have not worked:


self.experiment.set("random820", "800<=random820<=2000")
self.experiment.set("random820", "800 <= N <= 2000")
self.experiment.set("random820", "800<=N<=2000")
self.experiment.set("random820", "N, 800<=N<=2000")

I have tried putting the inline-script immediately before the sketchpad (in the beginning of the loop) and immediately after the practice instructions (in the beginning of the experiment) with no success.

Link to open sesame file in dropbox: https://www.dropbox.com/s/6cjrbmikcjaibfb/flanker2.opensesame.opensesame.tar.opensesame.tar.gz

I hope that I have provided enough descriptions of my problem, but if not please feel free to message me back. Any kind of feedback would be great(!) Thank you.

Sarah

Comments

  • edited September 2012

    Hi Sarah,

    I think if you make the following changes your experiment will be good-to-go:

    • You can assign a random integer (number without decimals) between 800 and 2000 to the variable random820 by using the Python module random. In an inline script this works as follows:
    # Import the Python module random:
    import random
    
    # The random function randint() returns a random integer between a certain 
    # minimum and maximum value:
    random_time = random.randint(800,2000)
    
    # To set the variable for future use in the interface, the name of variable should
    # be a string (i.e. put between quotes), whereas the value should not:
    self.experiment.set("random820", random_time)
    • If you want this value to vary between trials you should set "random820" with an inline script in every trial sequence rather than the experimental sequence. (Otherwise a random value is picked once, and used for the remainder of the experiment.) Also, you should put your script in the Prepare phase of your inline script instead of in the Run phase. After applying all this, you can use "random820" to determine the duration of a sketchpad by setting the duration to [random820], like you did in the practice sequence (but not in the sequence1 and 2).

    • And finally, I noticed that for one of your images the extension was typed as ".png", whereas ".PNG" is expected since you used "[pic].PNG" in the sketchpad editor. Depending on your operating system this could be problematic.

    Does this solve your problems?

    Please let us know if you have any further questions.

    Best wishes,

    Lotje

    Did you like my answer? Feel free to 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