Forum Replies Created
-
AuthorPosts
-
Jeremy
KeymasterHi Cory,
There seems to be a bug where re-printing the DropDown element causes the script to ignore selections. In your case, the DropDown element gets re-printed in the before command on your BLand.Text.2 Text element. Barely one day after releasing PennController 1.9, we find a bug to fix for the next release 🙂
Meanwhile, the workaround I recommend consists in not re-printing the DropDown element, and printing your Text elements around it instead:
newTrial( defaultText.css("white-space", "nowrap") // prevent linebreaks , newDropDown("BLand.Select", "Bitte wählen Sie") .add("Baden-Württenmberg", "Bayern", "Berlin", "Brandenburg", "Bremen", "Hamburg", "Hessen", "Niedersachsen", "Mecklenburg-Vorpommern", "Nordrhein-Westfalen", "Rheinland-Pfalz", "Saarland", "Sachsen", "Sachsen-Anhalt", "Schleswig-Holstein", "Thüringen") .before(newText("BLand.Text.1","4. Sie haben den Großteil Ihrer ersten 10 Lebensjahre in")) .after(newText("BLand.Text.2","gelebt")) .css("margin", "0px 25px") .print() .wait() , newButton("Weitermachen") .settings.css("margin", "25px auto") .print() .wait() )
Let me know if you have questions
Jeremy
Jeremy
KeymasterHi Cory,
Yes, this is part of the new aesthetics conventions in PennController 1.9, basically all the elements are now displayed as flex on 100% of the page’s width
You can use center on any element to display it centered on the page, or directly manipulate its CSS or its container CSS using css or cssContainer
You can control the overall aesthetics of your experiment more globally by using a CSS file, as described on this documentation page, for example you could upload a PennController.css file with this to replicate the old aesthetics:
.PennController { max-width: 40em; left: 50vw !important; transform: translateX(-50%); }
Let me know if you have questions
Jeremy
Jeremy
KeymasterHi Yanru,
Try replacing this line from the definition of SepWith:
newArray.push(main.pop());
with this instead:
newArray.push(main.shift());
Let me know whether that worked for you
Jeremy
Jeremy
KeymasterHi Giorgio,
I’m not sure why you encounter this specific problem, but I can suggest a few edits that hopefully will help with it:
Template("recotask", row => newTrial("Reco", defaultImage.size("25vw","35vh") , newImage("TARGET",row.FIGURATARGET).print("center at 50vw", "middle at 20vh"), newImage("SECOND",row.IMA2).print("center at 50vw", "middle at 80vh"), newImage("THIRD",row.IMA3).print("center at 25vw", "middle at 50vh"), newImage("FOURTH",row.IMA4).print("center at 75vw", "middle at 50vh") , newSelector("objeto") .add(getImage("TARGET"), getImage("SECOND"), getImage("THIRD"), getImage("FOURTH") ) .shuffle() .disable() .log() , newButton("escucha").print("center at 50vw","middle at 50vh").wait().remove() , newAudio(row.audio).play().wait() , getSelector("objeto").enable().wait() , clear() , getImage("TARGET").print("center at 50vw", "middle at 50vh") , newTimer(1000).start().wait() , clear() , newVar("correct").global().set(true) , getSelector("objeto").test.selected(getImage("TARGET")) .failure(getVar("correct").set(false)) , newButton("Next").print().wait() ) .log("correctChoice", getVar("correct")) )
First I got rid of the recognizz newTrial, which improperly embedded a Template command. I replaced all the percentage coordinates with viewport coordinates, and got rid of the intermediate up/left/down/right Canvas elements. Since Selector elements have a shuffle command, I used that instead of the fisherYates method. I also replaced the .test.selected part: I test getImage("TARGET") instead of simply "TARGET". I also use a global Var element to report whether the choice was correct as an additional column in the results file
Let me know if you have questions, and whether that solved the problem
Jeremy
Jeremy
KeymasterHi Aliona,
I can’t seem to reproduce the floating-word problem as long as I use the Courier font: because Courier is a monospaced font, the underscores take as much space as the characters they replace, so if there’s room to fit one variant there’s room to fit the other.
In any case, you can add white-space: nowrap to your Text element’s CSS to prevent it from inserting linebreaks. So you can replace your two .settings.css commands (the .settings prefix is deprecated) with this:
.css({"font-family":"courier","font-size":"20px","white-space":"nowrap"})
Note that if your page/screen is not wide enough, the text will overflow to the right, forcing your participant to scroll in order to see the end of the text
Let me know if you have questions
Jeremy
Jeremy
KeymasterHi,
Let me know whether I understood your design correctly: you have a first block of trials labeled task_A and a second block of trials labeled task_B. In case your participant takes more than 4 minutes completing the first block (task_A) you want to prematurely end whichever trial the participant is currently on and skip all the remaining task_A trials, and jump directly to the first task_B trial.
What you can do to that end is set a global Var element before starting block task_A to a timecode corresponding to four minutes later. Then at the beginning of each trial of block task_A, you look up the current timecode and skip the trial if it’s over the timecode from the global Var element. Otherwise, you launch a Timer element that will check again later and either end the trial prematurely or re-launch itself.
Here is an example:
newTrial("pre_task_A", newVar("four_minutes_later").global().set(v=>Date.now()+4*60*1000) ) Template( row => newTrial( "task_A" , getVar("four_minutes_later").test.is(v=>Date.now()>=v).success(end()).failure( newTimer("check_end", 100).callback( getVar("four_minutes_later").test.is(v=>Date.now()>=v) .success( end() ) .failure( getTimer("check_end").start() ) ).start() , newText("Task A").print(), newButton(row.stim).print().wait() ) ) ) Template( row => newTrial( "task_B" , newText("Task B").print(), newButton(row.stim).print().wait() ) )
Let me know if you have any questions
Jeremy
Jeremy
KeymasterHi Elena,
What’s the name of the file you’re trying to upload? You cannot manually overwrite the files that come by default when you create your experiment, or any files you previously imported from a git repo (but that restriction is lifted when importing from a git repo)
Jeremy
Jeremy
KeymasterHi Brianna,
Try editing the file other_includes/main.js and find line 204, t.options._finishedCallback(); and insert a new line before that:
allResults = [];
I haven’t tested it so you should do so yourself, but if things work as I expect them to, you should see a new entry in your results file for each SendResults, as if it were coming from a new participant, but which should only contain lines for the unsaved trials so far
Let me know if this solution worked
Jeremy
Jeremy
KeymasterThings should be back to normal now. I apologize for the inconvenience, I failed to anticipate the situation
Jeremy
Jeremy
KeymasterHi Zach,
I think the server is running out of space, I’m working on freeing up some and considering increasing the size of the volume. I’m sorry for the inconvenience, hopefully I’ll get it fixed soon
Jeremy
Jeremy
KeymasterHi,
I moved your question to a new topic, as its connection to the original topic (which is about the DashedAcceptability controller) was not clear
Upload a file named global_z.css to your aesthetics (css_includes) folder with the following rule:
.PennController-Scale .option { margin: 0em 1em; }
Replace .PennController-Scale with .PennController-judgment if you want the spacing to apply only to this Scale element but not to all Scale elements across the board
Jeremy
Jeremy
KeymasterThe problem was due to the MediaRecorder element not automatically stopping when the trial ends prematurely, causing the MediaRecorder element from the next trial to crash. The solution consisted in calling stop on the MediaRecorder element before calling end in the callback
Jeremy
Jeremy
KeymasterHi Rosa,
I was testing your code with a new version of PennController that I hope to release soon, in which I fixed a bug with the Key element, that’s why I didn’t encounter the problem you described. However, as of the latest official release (1.8) that bug still hasn’t been fixed, so you’ll need to replace .log("first") with .log("all") and the problem should go away
Let me know if you still experience problems
Jeremy
November 30, 2020 at 1:32 pm in reply to: Trying to set a unique participant ID/code for Amazon Mechanical Turk payment #6411Jeremy
KeymasterHi,
Blocks of trial commands are actually arguments passed to the newTrial function (PennController has been deprecated for a few versions now) and, as such, they are evaluated at the very beginning of the experiment. Which means that the string you pass to your newText command is also evaluated before any trial has effectively run, ie. before your "ParticipantID" Var element has been instantiated.
I don’t think you really need to use a PennController Var element in this case; you should probably just use a good old javascript variable at the top of your script:
const participant_id = b64_md5((Date.now() + Math.random()).toString());
Then you can do things like newText("code", "<p>Your unique identifying code is: "+participant_id+"</p>")) and .log("Participant id", participant_id) on the closing parenthesis of newTrial (PennController)
Let me know if you have questions
Jeremy
Jeremy
KeymasterHi,
Just change the color CSS attribute as well:
newFunction(()=>$("div:contains(Recording...)").css({'color': 'black', 'background-color': 'lightblue'})).call()
Jeremy
-
AuthorPosts