Howdy, Stranger!

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

Supported by

NameError: name 'Keyboard' is not defined AND problems with sketchpad show if

I have one piece of feedback and one question
FEEDBACK:
I spent a long time being confused because I tried to create a keyboard with

my_keyboard = Keyboard ()

and got the error "NameError: name 'Keyboard' is not defined". I just figured out that they K of keyboard() should be lower case, unlike it is shown in the examples in the python section of the documentation of Opensesame.

QUESTION:
I am trying to show instructions A on a canvas item if the subject number is multiple of four and instructions B if it is not. For that I created an inline script at the begining of the experiment:

byfour = var.subject_nr/4

if float(byfour).is_integer():
var.Ginstructions = True
else:
var.Ginstructions = False

and then I wanted to use the show if field of the sketch pad item. I have tried to set show if:

[Ginstructions]
[Ginstructions] = True
[Ginstructions] == True
=var.Ginstructions
=var.Ginstructions == True
=var.Ginstructions = True
var.Ginstructions == True
var.Ginstructions = True
var.Ginstructions

And it always returns that the variable Ginstructions does not exist and I should open the variable explorer. When I do, Ginstructions is there and it has a value. I have also tried giving Ginstructions other type falues like 0 and 1 or 'yes' and 'no'. I have tried to initialize Ginstructions before the if loop as var.Ginstructions = 0. I suppose what hapens is that Ginstructions is not a global variable. How do I create a global variable that can be taen by the show if of sketchpad?

Comments

  • edited February 2018

    Hi Andrea,

    , unlike it is shown in the examples in the python section of the documentation of Opensesame.

    The default documentation that you use when you go on www.osdoc.cogsci.nl, is for the most recent version of Opensesame, which is currently 3.2. I suppose you are still using 3.1.9? The change from lower to uppercase was introduced in the last update of Opensesame, so that's why the documentation appears to be incorrect to you. At the top of the page, you can actually change for which version you want to have the documentation. Just select 3.1 and you should get all information that are relevant for you (or just update your Opensesame).

    I am trying to show instructions A on a canvas item if the subject number is multiple of four and instructions B if it is not.

    Did you put the script in the prepare phase of the inline_script? It might be a little simpler if you used the modulo operator:

    var.Ginstructions = var.subject_nr%4
    

    Can you then try [Ginstructions]== 0 in the show-if field? Does is still not work then?

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    thanks for your help. In the end I put the instruction sketchpads inside of a sequence and set the show if conditions on the sequence table. It worked that way so I never tried the modulo operator, but I will keep it in mind.

    Also, I didnt know how to change the version for which I see documentation, thank you!

  • edited March 2018

    Hi Andrea,

    Also, I didnt know how to change the version for which I see documentation, thank you!

    See the attached screenshot.

    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