Forum Replies Created
-
AuthorPosts
-
Jeremy
KeymasterHi,
Your
Sequence
references the labels “test1” and “test2” when it should reference the labels “practice1” and “practice2”:Sequence( "intro", "instructions", "test1", "test2", randomize("experiment"), randomize("part2"), randomize("part3"), SendResults() , "bye" );
You
remove
your Text element immediately after youprint
it (onlyprint
ing a TextInput element in the meantime):newText("Answer", "How far is this word from English?") .center() .print() , newTextInput("TextInput2") .center() .print() , getText("Answer") .remove()
In the lines that come just after, you create a new TextInput element that you named “TextInput2”, just like the one you create before, so PennController won’t know which one you mean when you use
getTextInput("TextInput2")
later on:getTextInput("TextInput2") .remove() , newTextInput("TextInput2")
Jeremy
Jeremy
KeymasterHi Elias,
There are several different and somewhat advanced questions in your message, I won’t be able to fully address them at the moment. Maybe other users of the forums might be able to help you with them. In the meantime, let me give you pointers:
– The command
GetTable().filter
lets you subset your tables. You could add a column to your table where you number your items from 1 to 60 and usefilter
in three differentTemplate
commands to generate trials with formats specific to each block in phase 2– You can use
.substring(0,3)
on a string to return just the three first characters, e.g.row.Word.substring(0,3)
. You can use the TextInput element to have people type in text, and thebefore
/after
commands to place the Text and TextInput next to each other, or place them on a Canvas element if you need more control on the visual layout– The Audio element will let you play audio files (which you’ll need to upload to your project or to a host space first, of course). The tutorial illustrates how to use it
Jeremy
Jeremy
KeymasterHi Ana,
The numbers are not random, they match exactly the text from the table’s
token
column, eg:3eak,beak-peak_1_VOT_1.wav,438 5eak,beak_peak_2_VOT_2.wav,438
Using a custom font is more involved than just uploading a font file to a project’s Resources folder. It requires using the
@font-face
CSS rule to fetch the font file. The PCIbex Farm won’t allow background access to the font file, it will result in a CORS error (you can, however, download it manually by directly entering the URL in the address bar, but that’s of no help here)My suggestion is to upload the font file on a domain that won’t throw a CORS error and insert this in the project’s global_main.css file under the Aesthetics folder:
@font-face { font-family: "Arial Modified"; src: url("https://url.toward.the/font.otf") format("opentype"); } .PennController-wordtoken { font-family: "Arial Modified"; }
I should note, however, that the Arial font is not under an open license, which means you cannot modify it legally
Jeremy
November 5, 2021 at 1:39 pm in reply to: html layout/event times/selector vs. scale/ compatibility #7485Jeremy
KeymasterHi,
1) If you want the time between the sentence and the scale, you should place the
newVar
command before the second key press (the one just before the sentence appears) and thegetVar
command after the third key press (the one that precedes the scale appearing)2) That “RT” column will only be included in the lines that correspond to that
newTrial
command. If you have lines in your results file coming from, say, intro/welcome/end/etc. trials, they won’t include an “RT” column because their correspondingnewTrial
s don’t have the same.log
command (because there’s no RT to compute for those trials). Is the RT column missing from the lines corresponding to thenewTrial
that was embedded inTemplate
too?3) You can find an example of how to analyze data in R in the advanced tutorial: in this example, reaction times are calculated post-hoc by subtracting event times coming from different lines from the same trial. Note that the table resulting from the piece of code below (copied from the tutorial page) follows the one-line/one-trial format that you seek:
tidied_results <- tidied_results %>% mutate(reaction_time = selection_time - canvas_time, correct = if_else(condition == selection, 1, 0))
Jeremy
Jeremy
KeymasterYou are using version 1.6 of PennController (not sure where you found it). Update to the latest version (currently 2.0)
Jeremy
Jeremy
KeymasterDo you have a link to your experiment that I could check?
Jeremy
Jeremy
KeymasterHi Jones,
Did you include
PennController.ResetPrefix(null)
in your script? (it should be on the very first line)Jeremy
Jeremy
KeymasterGreat! Just in case the problem recurs, you should know that I’m actively working on the next version of PennController. It is still work in progress, but you can find my most recent build here. I improved the way zip files are downloaded and resources are preloaded
Jeremy
Jeremy
KeymasterHi Jana,
You should always stop Recorder elements. Try adding
getMediaRecorder(row.model+"-words").stop()
aftergetText("instructions").remove()
andgetMediaRecorder(row.prompt+"-words").stop()
afternewButton("Done").center().print().wait().remove()
Jeremy
Jeremy
KeymasterHi Ana,
The
shuffle
command actually re-prints elements that were shuffled, which can cause glitches for elements positioned relatively to another element. My suggestion is to have theshuffle
command executed early on when the Canvas element is hidden, and only reveal that element later. Here is a rewrite of one of your twoTemplate
commands:Template( "TestWordList.csv" , row => newTrial("block1", newText("fix", "+") // create a fixation cross .css("font-size","80px") .print("center at 50%" , "center at 50%") .log() , newTimer("fixtime",300).log().start().wait() // present the fixation cross , getText("fix").remove() // remove the fixation cross , newImage("pic", row.Image1) .size(200,200) .print("center at 50vw", "center at 50vh") , newCanvas("words", 820, 820) .add("center at 35%", "middle at 38%", newText("1",row.Word1).css("font-size", "40px") ) .add("center at 65%", "middle at 38%", newText("unrel",row.Unrelated).css("font-size", "40px") ) .hidden() .center() .print() , newSelector("words") .disableClicks() .add( getText("1") , getText("unrel") ) .shuffle() .keys("F", "J") .log() .disable() , newTimer("pictime",1000).log().start().wait() , getImage("pic").remove() , newTimer(50).start().wait() , getCanvas("words").visible() , getSelector("words").enable().wait() ) )
Note that I name and
log
the Timer elements rather than the visual elements (which are now printed early on) and I moved thekeys
command below theshuffle
one, because I presume you want to preserve the left-F/right-J associationJeremy
Jeremy
KeymasterHello Marisol,
Here is a suggestion:
var n_question = 1; Template("myTable.csv", row => newTrial("experimento", newText("*").center().css("font.size", "x-large").print() , newKey(" ").wait().log("all").disable() , getText("*").remove() , newController("DashedSentence", {s : row.Oracion}).center().print().wait().remove() , n_question = 1+Math.floor(Math.random()*4) , newText("q", row['Q'+n_question]) .center() .print() , newKey("pressOnArrow", "ArrowLeft", "ArrowRight").log().wait() ) .log("n_question", n_question) .log("question", row['Q'+n_question]) )
Jeremy
Jeremy
KeymasterHi Philip,
I don’t get any error for this:
PreloadZip("https://yoojun.dreamhosters.com/eyetracking/pictures.zip") newTrial( newImage("Picture1.png").print() , newButton("Next").print().wait() )
Did you happen to fix the issue in the meantime?
Jeremy
Jeremy
KeymasterHi Jana,
The behavior you see with the OralProduction (MediaRecorder) project is the default behavior: if the upload request fails, participants will see a link to download an archive with their recordings. If you want to force that to happen, you can use
DownloadRecordingButton
(there’s a code piece that illustrates its use on the documentation page)Jeremy
Jeremy
KeymasterHi,
Add these two lines just after your SCRIPT tag:
const hideEm = ()=>{ if (document.getElementById("numlang")===null) return window.requestAnimationFrame(hideEm);
and these two just before
function getVal(){
:}; hideEm();
This will make sure that the hiding commands will only be run after the elements were added to the page
Jeremy
November 2, 2021 at 12:54 pm in reply to: How to test whether multiple elements were selected? #7463Jeremy
KeymasterHello Ana-Maria,
Your reasoning is on the right track, but things work slightly differently: tests embedded in a
success
command won’t count as conjoined to the main test. For that, you have theand
command. You can do this:newTrial( newScale("comprehensibility_prac1", 8).print(), newScale("comprehensibility_prac2", 8).print(), newScale("comprehensibility_prac3", 8).print() , newButton("validation", "Confirm") .center() .print() .wait( getScale("comprehensibility_prac3" ).test.selected() .and( getScale("comprehensibility_prac2").test.selected() ) .and( getScale("comprehensibility_prac1").test.selected() ) .failure( newText("timedout","<b>Please use all the scales!</b>") .css("font-size", "19px") .css("font-family","times-new") .color("red") .center() .print() ) ) )
Note that the error message will appear whenever any scale is unselected
If you want scale-specific messages, you could conjoin all three tests to a main test, so you can apply test-specific failures:
newTrial( newScale("comprehensibility_prac1", 8).print(), newScale("comprehensibility_prac2", 8).print(), newScale("comprehensibility_prac3", 8).print() , defaultText .css("font-size", "19px") .css("font-family","times-new") .color("red") .center() , newButton("validation", "Confirm") .center() .print() .wait( newVar("dummy", 1).test.is(1) .and( getScale("comprehensibility_prac3" ).test.selected().failure( newText("timedout3","<b>Please use scale 3!</b>").print() ) ) .and( getScale("comprehensibility_prac2" ).test.selected().failure( newText("timedout2","<b>Please use scale 2!</b>").print() ) ) .and( getScale("comprehensibility_prac1" ).test.selected().failure( newText("timedout1","<b>Please use scale 1!</b>").print() ) ) ) )
Jeremy
-
AuthorPosts