Jeremy

Forum Replies Created

Viewing 15 posts - 1,426 through 1,440 (of 1,522 total)
  • Author
    Posts
  • in reply to: Umlaut, opening link in new tab, select option key or click #4685
    Jeremy
    Keymaster

    Hi Akira,

    Giving the option to click anywhere on the screen is a little tricky in PennController: you need to create a Canvas that covers the entire surface o the window. Note that this will likely prevent any interactions with elements on the page until the Canvas is removed (which you should be fine with, in your case). Here’s an example:

    newText("instructions", "Please click anywhere on the screen or press the spacebar")
        .print()
    ,
    newCanvas("screen", "100vw", "100vh")
        .print("center at 50vw", "center at 50vh")
    ,
    newSelector("continue")
        .settings.add(getCanvas("screen"))
        .settings.keys( " " )
        .wait()
    ,
    getText("instructions").remove(),
    getCanvas("screen").remove()
    ,
    newText("thanks", "Thank you!")
        .print()

    Let me know if you have questions

    Jeremy

    in reply to: SetCounter("label", *number*) doesn't seem to work #4681
    Jeremy
    Keymaster

    Thank you Umesh, I have updated the wiki page accordingly.

    I had meant SetCounter to increment (or decrement) the counter by default, but it appears I got lost somewhere along the way… I will change the behavior of the command in the next version of PennController (1.7)

    Jeremy

    in reply to: Umlaut, opening link in new tab, select option key or click #4677
    Jeremy
    Keymaster

    Hi,

    1. Using HTML codes, as you mention, is probably the solution that is best in terms of cross-browser compatibility. You can find a useful table here: https://www.starr.net/is/type/htmlcodes.html
    An example of a script:

    PennController(
      newButton("grüßen")
        .print()
        .wait()
    )

    This is of course not ideal in terms of readability from the experimenter’s end. Another solution is to save your script using an UTF8 encoding. In order to do that, you need to edit your script file on your local device (using your own text editor) and make sure to save it with a UTF8 encoding, and then upload your script file back to your project. Note that opening the online editor and clicking “Save” will fall back to the old, non-UTF8 format, so you need to keep editing the file locally and uploading it later.

    2. You want to use the target attribute with the value '_blank', like this: <a href='https://expt.pcibex.net/' target='_blank'>Open the PCIbex Farm</a>

    3. You are right, you need to use a Selector element, but then you no longer need a Key element:

    newButton("continue", "Continue")
        .print()
    ,
    newSelector("next")
        .settings.add( getButton("continue") )
        .settings.keys( " " )
        .wait()

    Let me know if you still have questions

    Jeremy

    in reply to: Optional question after DashedSentence #4670
    Jeremy
    Keymaster

    Hi Adam,

    You were almost there: the problem indeed comes from your inserting a second label inside a single Ibex-item array, which is an illegal syntax. Your code works perfectly well if you get rid of "qst", before "Question"—if your sentences and questions are paired, they represent a single item and so you shouldn’t need a second label.

    You say that using spr only wouldn’t account for the questions: what exactly are you trying to do? If you don’t want the Question controllers (when they exist) to be paired with a respective DashedSentence controller, you should simply called Template twice on your table, first to generate the DashedSentence items, and then to generate the Question ones.

    Jeremy

    in reply to: Commas in results #4666
    Jeremy
    Keymaster

    Hi Leo,

    Thanks for reporting this problem, and sorry for the late reply. I was supposed to fix this issue some time ago, I’m sorry I haven’t taken care of it yet.

    The only solution I can see at the moment is to identify the list of sentences and perform a search&replace for each of them in your results file, to delete or replace the target commas with something else (e.g. %2C).

    Best,
    Jeremy

    in reply to: SetCounter("label", *number*) doesn't seem to work #4665
    Jeremy
    Keymaster

    Hi Umesh,

    Thank you for reporting this, and sorry for the late reply. There is a bug in how I coded the parser for the parameters of SetCounter—I just fixed it for the next release. In the meantime, you can do this instead:

    PennController.SetCounter("Setcounter", "inc", 4);

    and of course you can always use the native Ibex syntax, though it’s deprecated:

    var items = [
      ["Setcounter", "__SetCounter__", {inc: 4}]
    ];

    Note though that the intended meaning of SetCounter("label", 4) (and the way it will work in the next release) is to set the counter to 4, not increment it by 4.

    Best,
    Jeremy

    in reply to: Elements only appearing when called in certain order #4660
    Jeremy
    Keymaster

    The problem seems to be related to the way PennController handles cross-trial references to Var elements. In this case, a newVar command with .settings.global() inside a Header was causing an “undefined” error the first time the trials were run only—the second time, the Var element having already been created the first time seemed to “fix” the error, in a way.

    This bug, and other bugs related to Var elements, should be fixed in the next (and upcoming) release of PennController, version 1.7.

    Jeremy

    in reply to: Elements only appearing when called in certain order #4658
    Jeremy
    Keymaster

    I cannot seem to find it, did you send it to admin@pcibex.net?

    Jeremy

    in reply to: Elements only appearing when called in certain order #4656
    Jeremy
    Keymaster

    Hi!

    What you’re describing definitely sounds like a bug to me. Unfortunately I haven’t experienced or heard of anything similar before, so it’s a little hard to diagnose as such. Would you mind giving me a link to your experiment? Thank you.

    Jeremy

    in reply to: Ability to modify default ibex files #4654
    Jeremy
    Keymaster

    Hi Leo,

    Not entirely sure why it is so, maybe Alex would provide a better-informed answer on the original Ibex’s Google Groups:
    https://groups.google.com/forum/#!forum/ibexexperiments

    I think you should be able to overwrite files if you sync them from a git repository though. Might be worth a try.

    Jeremy

    in reply to: Data not getting saved #4651
    Jeremy
    Keymaster

    Hi Leo,

    How were your participants supposed to access the code? By reaching the last screen of the experiment? If so, does the last screen come after the results are sent to the servers?

    The whole experiment is run on the client-side, which means the servers could be down and the participants could still be running the experiment (as long as they started it when the servers were still up). But sending the results requires a functional connection, so if your screen with the confirmation code comes after that, it can’t be that the servers were down.

    If you include your confirmation code raw in your scripts though, maybe some tech-savvy participants accessed it by directly looking at the source code of your experiment. There exist methods for making (parts of) your source code less readable, but it will always be impossible to completely encrypt javascript code. Let me know if you’d like pointers on how to pseudo-encrypt your code.

    Jeremy

    in reply to: Unselect Scale #4648
    Jeremy
    Keymaster

    I forgot to update this thread sooner, but the unselect command was introduced in PennController 1.6.

    Jeremy

    in reply to: Auto-translator issue #4647
    Jeremy
    Keymaster

    Hi Leo,

    Thank you, it’s good to know that the method you describe is efficient against auto-translation issues! And since it is, maybe your Python script can be transposed into javascript, e.g. like this:

    function insertHtmlTags(s) {
      if (typeof(s) != "string" || s.length == 0) return s;
      return s.replace(/(.)(.)/g, '$1$2');
    }
    
    PennController(
        newText( insertHtmlTags("Hello world!") )
            .print()
        ,
        newButton("OK")
            .print()
            .wait()
    )

    Does this also break the auto-translation plugin?

    Jeremy

    in reply to: re-play audio file #4343
    Jeremy
    Keymaster

    Thanks Umesh!

    I guess you found this topic using the search form, since it was lacking a parent forums (it was imported from the old website)—I have just fixed that

    To expand on your answer, it’s better not to prefix getAudio with this (as this can have different meanings in different environments) and to make sure to replace audioName with the string you used to name your audio file. Here’s an illustration including an Audio element:

    newAudio("myAudio", "test.mp3")
      .play()
      .wait()
    ,
    newButton("Replay")
      .settings.callback( getAudio("myAudio").play() )
      .print()
    Jeremy
    Keymaster

    Hi Cory,

    It’s a known bug of sorts: you are storing the image element itself in the variable, rather than the name of the element, which is presumably what you want to get in your log command. I’ll see if I can fix it in the next release of PennController, because I think what you’re doing makes total sense.

    In the meantime, here is what you can do:

    newVar("Response")
        .settings.global()
    ,
    newSelector("SelectedResponse")
        .settings.add(getImage("HappyFace"), getImage("SadFace"))
        .settings.log()
        .settings.once()
        .wait()
        .test.selected(getImage("HappyFace"))
        .success( getVar("Response").set("HappyFace") )
        .failure( getVar("Response").set("SadFace") )

    I’m making the Var element global because you are accessing it from outside PennController(), even though it seemed to be working even without the .settings.global() line…

    Jeremy

Viewing 15 posts - 1,426 through 1,440 (of 1,522 total)