Forum Replies Created
-
AuthorPosts
-
February 13, 2023 at 6:07 pm in reply to: Printing NewText with parts of the text colored/bolded #9928
Jeremy
KeymasterHi Kate,
You can use HTML in Text elements, like this:
newText("Please press<br><span style='color:green;margin-right:5em;'><strong>F</strong> for <strong>YES</strong></span> <span style='color:red;'><strong>J</strong> for <strong>NO</strong></span>")
Jeremy
February 12, 2023 at 5:13 pm in reply to: Eyetracking experiment: Uploading and downloading material to server #9925Jeremy
KeymasterHi Sanghee,
1. Your
Sequence
command references the label"practiceSession"
but thenewTrial
command inTemplate
labels trials"PracticeSession"
(capitalP
)2. You’re using
AddHost
in place ofPreloadZip
Jeremy
February 11, 2023 at 1:58 pm in reply to: Eyetracking experiment: Uploading and downloading material to server #9922Jeremy
KeymasterHi Sanghee,
You have a line that reads
var showProgressBar = True;
in your script, when it should bevar showProgressBar = true;
— sinceTrue
(capitalT
) refers to nothing in your script, it simply crashes on that line and fails to create the trials you define below, resulting in no items in the running orderJeremy
Jeremy
KeymasterHi,
It depends on what exactly you mean by item number:
- there is an Ibex-internal notion of item number, which corresponds to an index in the
items
array - there is a PennController-specific notion of “trial” number, which corresponds to when the PennController trial was created (
newTrial
commands insideTemplate
commands are executed after non-embeddednewTrial
commands, so the former have greater trial numbers than the latter) - then there is the notion of an item/trial’s runtime number, which would correspond to when the participants saw that trial relative to the other ones; this is not reported by default anywhere in the results file, but you could keep track of that with a global Var element that you increase at the beginning of each trial
- finally, you could have a column named “item” in your table, whose values you decide how to assign; if you have a latin-square design for example, you could decide to have the same value in multiple rows that correspond to different groups
The numbers associated with points 1 and 2 will be the same across participants: no matter the actual sequence of trials they see, those “item numbers” will always be the same, so the question associated with item #189 in this sense will always be the same. The number associated with point 3 can obviously vary from one run to the other, since it corresponds to the runtime “item number,” so the question associated with item #189 in this sense could vary. As for the number associated with point 4, it will depend on what you decide to do with your design; if you have multiple rows with 189 in the “item” column but a different string in the “question” column, then item #189 will not always be the same question
Jeremy
February 11, 2023 at 1:44 pm in reply to: Pre-determined line breaks in self-paced reading experiment #9920Jeremy
KeymasterHello,
The DashedSentence controller does accept the
\n
character as a linebreak, but when looking up the tableTemplate
reads that sequence as two characters (\
+n
) which in a javascript string you would write as\\n
The solution is to replace all occurrences of
\\n
with\n
s:row.acceptability.replace(/\\n/g,"\n")
Jeremy
Jeremy
KeymasterHi Mete,
If you want the bar’s bottom edge aligned with the bottom edge of the page’s frame as scrolled (when applicable) then you need to do this:
(()=>{ let bar; (function barAsLast(){ bar = bar || document.querySelector("#bod table:first-child"); if (bar) { if (document.body.scrollHeight > window.innerHeight) { bar.style.position = 'unset'; bar.style.bottom = 'unset'; bar.style.left = 'unset'; bar.style.transform = 'unset'; let pc = document.querySelector("p.PennController-PennController"); if (pc) pc.append(bar); else (document.querySelector("#bod table:last-child")||document.body).append(bar); } else { bar.style.position = 'absolute'; bar.style.bottom = '0px'; bar.style.left = '50vw'; bar.style.transform = 'translateX(-50%)'; document.body.prepend(bar); } } window.requestAnimationFrame(barAsLast); })(); })();
When there’s no vertical scroll bar, the bar will “jump” to the bottom of the visible frame, but when there is a scroll bar, then it will be placed below all the content that comes before it (ie. you’ll need to scroll down to see it)
Jeremy
Jeremy
KeymasterHi,
I answered this question via email, but I’m posting the answer here too for other users
The simplest solution in this case is to simply set a max-height and max-width on the Image elements to the same dimensions of the containing Canvas elements:
newCanvas("left", 500, 290) .add( "center at 50%" , "middle at 50%" , getImage("target").css({"max-height":"290px", "max-width":"500px"})), newCanvas("right",500, 290) .add( "center at 50%" , "middle at 50%" , getImage("foil").css({"max-height":"290px", "max-width":"500px"})),
Jeremy
Jeremy
KeymasterHi,
I wrote a simplified version of your trial where I took out some elements for the sake of illustration. The main takeaway is that, since all three scenarios (correct choice, incorrect choice, no choice) end the same way (print “press a key” and wait for a keypress) you don’t have to repeat that sequence of events three times, you can write it just once at the end of the trial instead (you also don’t have to use a Var element to check the value of a column, you can pass it directly to
test
):newTrial(row.condition, defaultText.center().print() , newText("prueba", "<p style=font-family:helvetica>Presione la barra espaciadora para continuar</p>") , newTimer("timer", 7000) , newScale("acceptability_checks", 7) .before(newText("<p style=font-family:lucilda margin-right:2em><i>completamente inaceptable</i></p>")) .after(newText("<p style=font-family:lucilda><i>completamente aceptable</i></p>")) .callback( getTimer("timer").stop() ) .button() .keys() .center() .print() .log("all") , getTimer("timer").start().wait() , clear() , getScale("acceptability_checks") .test.selected() .success( getScale("acceptability_checks").test.selected(row.check) .success( newText("<p style=font-family:helvetica;color:darkgreen padding-bottom: 25px>¡Correcto!</p>") ) .failure( newText("<p style=font-family:helvetica;color:red padding-bottom: 25px>¡Incorrecto!</p>") ) ) .failure( newText("lento","<p style=font-family:helvetica;color:red padding-bottom: 25px>¡Muy lento!</p>") ) , newText("<p style=font-family:helvetica>Presione la barra espaciadora para continuar</p>") , newKey(" ").wait() ) .log("group", row.group) .log("item", row.item) .log("condition", row.condition)
Jeremy
Jeremy
KeymasterHello Eleni,
Currently you’re inserting a trial labeled “sep” between your experimental trials, which uses Ibex’s Message controller to display some text, and invites participants to use a keypress since you use
transfer: "keypress"
. You could usetransfer: "click"
instead if you wanted participants to invite the participants to click instead (you can setcontinueMessage
to a custom message if you’d like)You cannot use the PCIbex Farm to host a file that you invite your participants to download. But if you have another hosting solution and have a direct link to that file, then you can use the HTML tag
<a>
, as in<a href="https://link.to.your/file" target="_blank" download="filename.ext">Click here to open/download the file</a>
Jeremy
Jeremy
KeymasterHi Mete,
You could use javascript to make sure the progress bar is always the last element on the page. Assuming you’ll always either have PennController trials or native-Ibex trials, placing the following at the very top of your script (before
PennController.ResetPrefix
) should do the job:(()=>{ let bar; (function barAsLast(){ bar = bar || document.querySelector("#bod table:first-child"); if (bar) { let pc = document.querySelector("p.PennController-PennController"); if (pc) pc.append(bar); else (document.querySelector("#bod table:last-child")||document.body).append(bar); } window.requestAnimationFrame(barAsLast); })(); })();
Jeremy
Jeremy
KeymasterHi Jun,
Your “ID” trial comes after your
SendResults
, so whatever the participant types after that point just won’t be sent as part of the resultsJeremy
Jeremy
KeymasterHi Jun,
Do you mind sharing the raw content of your HTML file? You can either post the code or share your experiment’s URL on this thread, or send it at support@pcibex.net if you don’t want to share it publicly
Jeremy
Jeremy
KeymasterHi,
As long as you keep the 200ms timer before removing the Canvas, you should see the frame for 0.2s:
newTimer("timeout", 5000) , newSelector("pal_sel") .add(getText("pal1"), getText("pal2"), getText("pal3")) .frame("dashed 3px violet") .log() .callback( getTimer("timeout").stop() ) , getTimer("timeout").start().wait() , newTimer(200).start().wait() , getCanvas("canvas12").remove(),
Jeremy
Jeremy
KeymasterHi Meri,
I apologize, I seem to have missed your initial message. Let me answer the last three, unanswered questions:
2) The “buffer” lines report when the audio started the play but had to pause because not enough data had been downloaded to play fully. This can be pretty useful to determine whether participants had a smooth playback experience, as some experimental designs require time-sensitive measures
3) This is a problem with how the farm saves edits your bring to a file. When this happens, the solution is to create a new file, paste the code you have in the new file, and then delete the original file, to force the farm to take the latest updates into account
4) This error comes from the original IBEX and is pretty generic. It tends to happen when there is a syntax error in the script and the
items
variable fails to be created as a result. The bug I mention in #3 makes it more likely to occur, especially if the farm saved your script as you were typing and therefore stored an incomplete codeJeremy
Jeremy
KeymasterOops, I copied and pasted the code from my previous message but completely forgot to edit it!
I’ve updated my message, the commands are now in the appropriate order
Apologies
Jeremy - there is an Ibex-internal notion of item number, which corresponds to an index in the
-
AuthorPosts