Jeremy

Forum Replies Created

Viewing 15 posts - 1,486 through 1,500 (of 1,522 total)
  • Author
    Posts
  • in reply to: Trial templates & tables #4065
    Jeremy
    Keymaster

    You can turn off the debugger using PennController.DebufOff() in your script (e.g. place it at the very top or at the very bottom). I would recommend keeping it on until you’re ready to publish your experiment though, as it can provide you with very useful messages in case of errors.

    It is possible to code a timeout, but it’s not entirely straightforward as it means that the trial has two possible outcomes when, usually, the single outcome is “selection happens.” What you can do is launch a 4s timer and wait for it to end, and tell your slider to end your timer early when selection happens.
    Now, I just realized that PennController 1.3 introduced a bug with timer.stop so we’ll need a little trick: we’ll create a button that we never print, and we’ll wait for a click on it and make both the slider and the timer click it:

    in reply to: Font size of tex elements – length of slides #4062
    Jeremy
    Keymaster

    Hi Mogli,

    There is no dedicated command on Text elements for changing the size of the font. The command settings.size determines the size of the box surrounding the text, not the size of the font. But you can use this instead:

    newText(variable.SocStat_context)
        .settings.css("font-size", "xxem")
        .print()

    I’m not sure I understand your question about slider length. The following will produce a 500px wide slider, with only 10 points, which would ordinarily be much narrower:

    newScale(10)
        .settings.slider()
        .settings.size(500)
        .print()

    Jeremy

    in reply to: Trial templates & tables #4060
    Jeremy
    Keymaster

    You probably want to use the remove command. For example:

      newScale("akzeptabilität", 7)
        .settings.before( newText("left1", "1 
    (am unakzeptabelsten)") ) .settings.after( newText("right2", "7
    (am akzeptabelsten)") ) .settings.slider() .print() .settings.log() .wait() .remove() , getText("Skala2") .remove()
    in reply to: Trial templates & tables #4058
    Jeremy
    Keymaster

    Hey Mogli,

    I only inserted the backslash symbol because otherwise the forums would have printed a real comma in my code examples and that would have defeated my purposes. You can try without the backslash symbol, or with %2C instead.

    Alternatively, if you use a spreadsheet editor to modify your CSV file, you can try using normal commas in your sentences, but quote your text cells. In LibreOffice Calc for example, you can check “Edit filter settings” when saving your file and then you will be prompted with an option window where you can check “Quote all text cells.” Maybe that would work.

    Jeremy

    in reply to: Naming blocks #4056
    Jeremy
    Keymaster

    Hi Leo,

    I took the liberty of moving your topic in the Support subsection of the forums.

    The global PennController command works the same whether inside or outside the scope of a PennController.Template command. So you can simply do:

    PennController.Template(   PennController.GetTable("target.csv").filter("block", "1"),
        (item) => PennController( "block1" , 

    You could indeed also use the .label command on the closing parenthesis of the global PennController command (i.e. before the closing parenthesis of Template).

    If you don’t specify any label, the Template command will look for a column named Label in your table and, if it finds one, it will use the value in the Label cell to label the generated trials. If it finds no column named Label, it will label the generated trials Item-N, where N is a number (which means you could then end up with multiple trials sharing the same label if you use multiple Template commands with no explicit label).

    Hope things are clearer now!

    Jeremy

    in reply to: Trial templates & tables #4052
    Jeremy
    Keymaster

    Hi Mogli,

    Sorry for the late reply. In my example I use the command AddTable as a way to add a table directly from the script. This way, it should work no matter what table you have uploaded to your project otherwise.

    You can indeed delete the AddTable bit from the code I posted, and upload a CSV file instead as you mention. Just make sure to use the appropriate name to refer to your table in Template (or you can also just not refer to your table at all there if you updated only one).

    Jeremy

    in reply to: Trial templates & tables #4049
    Jeremy
    Keymaster

    Hi!

    This code works just fine for me:

    Note that I added a button on which to click so that each trial doesn’t end as soon as it starts, and I replaced the commas in your sentence with , so they don’t get misinterpreted as separating cells.
    I do see “yes” in my results file for all the trials (since it is the only value for grammaticallycorrect in your table).

    Let me know if you have questions

    Jeremy

    in reply to: Create a continue button #4044
    Jeremy
    Keymaster

    Hi Sahar,

    Since commands are executed in order, inserting a .wait command at the end of the first block of commands will pause the execution of the script until your first button is clicked, and only after that will the commands coming next, relating to your second button, be executed, which is why the second button wouldn’t appear until you click the first one.

    With the script you posted, however, you have a .wait command relating to the second button, so the execution of the script is paused until the second button is clicked.

    What you want is tell the script to pause until one of the two buttons is clicked. Put otherwise, you want people to make a selection out of a group of two buttons. Whenever you want to do that, you should consider using a Selector which you can use to group elements together and wait for your participants to make a choice. So your script should look like this:

    newText("question", "Is the above item a word?")
        .print()
    ,
    newButton("Word", "

    Word ✓

    ") .settings.color("green") .settings.size(150, 70) .print() , newButton("Not a Word", "

    Not a Word x

    ") .settings.color("red") .settings.size(150, 70) .print() , newSelector("WordOrNotaWord") .settings.log() .settings.add( getButton("Word") , getButton("Not a Word") ) .wait()

    I removed the commands .settings.log from the buttons themselves, and used it on the Selector element instead since you are interested in which one is selected.

    Let me know if you have any questions

    • This reply was modified 4 years, 9 months ago by Jeremy.
    in reply to: 3 slides for one item #4042
    Jeremy
    Keymaster

    Glad it worked! I release PennController 1.5 earlier this month, which no longer crashes from shared names (but still prompts a warning/error message). You can manually update your project with it, if you feel like it.

    Jeremy

    in reply to: 3 slides for one item #4027
    Jeremy
    Keymaster

    Hi Mogli,

    The problem seems to be coming from the names of your Text elements to the left and right of your Scale elements: they are duplicates in all three scales. Normally your code should still be functional but you should see an error message in the debugger, but as a matter of fact there I made an error when coding the error-throwing bit… I have fixed it for the next release.

    Replace “left” and “right” with “left2” and “right2” in the scale akzeptabilität and replace them with “left3” and “right3” in the scale Nutzen and it should work.

    Let me know if that solved your problem.

    Jeremy

    in reply to: .zip file problems #3785
    Jeremy
    Keymaster

    Hi Grusha, sorry for the late reply.

    Yes, CheckPreloaded will make sure that all the files used in your trials (or only in trials with matching labels if you pass a string) are preloaded before proceeding, regardless of whether the resources live in a ZIP file or are individually fetched on a server. If CheckPreloaded fails to preload all the resources in the allotted time though, it will proceed anyway and any trial whose resources were not preloaded will try to preload them again before starting. But that shouldn’t happen if everything is configured properly.

    Let me know if you have any questions.

    Jeremy

    in reply to: .zip file problems #3708
    Jeremy
    Keymaster

    Thanks. MP3 does make it work: https://expt.pcibex.net/ibexexps/example/grusha/experiment.html
    And you can see the content of main.js here.

    If using MP3s instead of OGGs is an option for you, I would recommend it for now. Fixing the OGG auto-identification problem will take me some time

    Jeremy

    • This reply was modified 4 years, 11 months ago by Jeremy.
    in reply to: .zip file problems #3706
    Jeremy
    Keymaster

    I suspect a problem with my code to automatically detect the type of the file. Can you try converting your audio file into a MP3 and updating the extension accordingly?

    I’m sorry for the inconvenience, I’ll see if I can fix the problem for the next release of PennController

    Jeremy

    in reply to: .zip file problems #3704
    Jeremy
    Keymaster

    Hi Grusha,

    I just tried preloading your ZIP file in a new experiment and it did download the archive, so you’re good on that front.

    The problem comes from the structure of your archive: I downloaded it manually and opened it, and it appears to embed a folder ogg_test which itself contains the resource that you want to access (your OGG file). Try re-creating the ZIP file, but instead of archiving the folder containing your resources, directly select the file(s) that you want to include. You should see your resource files as you open your ZIP file, they shouldn’t be embedded in a folder within the archive.

    Let me know if problems persist

    Jeremy

    in reply to: .zip file problems #3700
    Jeremy
    Keymaster

    Hi Grusha,

    I am not familiar with amazonaws, but it looks like you’re hosting your ZIP file on a cloud storage service rather than on an apache server. In that case, .htaccess files will be of no help.

    It seems that you can still configure your amazonaws space to accept CORS requests:
    https://aws.amazon.com/blogs/aws/amazon-s3-cross-origin-resource-sharing/
    https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html#how-do-i-enable-cors

    You probably want to add these rules to your bucket:

    
    <CORSConfiguration>
     <CORSRule>
       <AllowedOrigin>https://expt.pcibex.net</AllowedOrigin>
       <AllowedMethod>GET</AllowedMethod>
       <AllowedHeader>*</AllowedHeader>
        <ExposeHeader>Accept-Ranges</ExposeHeader>
        <ExposeHeader>Content-Range</ExposeHeader>
        <ExposeHeader>Content-Type</ExposeHeader>
        <ExposeHeader>Content-Encoding</ExposeHeader>
        <ExposeHeader>Content-Length</ExposeHeader>
     </CORSRule>
    </CORSConfiguration>
    

    Let me know if this solution worked

    Jeremy

Viewing 15 posts - 1,486 through 1,500 (of 1,522 total)