The new PCIbex Farm is here! Be sure to check out all of its new features and changes.

Link Search Menu Expand Document

Special commands

Used within a trial, but not called on an element.


table of contents


clear

syntax

clear()

description

Removes from the screen any element that was previously added during the trial.

example

click to expand
newText("helloworld", "Hello world!")
    .print()
,
newImage("smiley", "ya.png")
    .print()
,
newButton("erase", "Erase")
    .print()
    .wait()
,
clear()
,
newButton("void", "Enough with the emptiness")
    .print()
    .wait()
  1. Prints a line of Text, an Image and a Button with the text "erase" to the screen.
  2. Remove the three elements from the screen when the "erase" Button is clicked.
  3. Print a new Button that is waiting to be clicked to the screen.
↑ back to top

end

syntax

end()

description

Ends a trial immediately.

example

click to expand
PennController.ResetPrefix(null);

newTrial(
    newText("instructions", "Press F to end the trial immediately, or press J to continue.")
    	.print()
    ,
    newKey("fj", "FJ")
        .wait()
    ,
    getKey("fj")
        .test.pressed("F")
        .success(end())
        .failure(
            newText("continue", "The trial has continued! Press the spacebar to finish.")
                .print()
            ,
            newKey(" ")
                .wait()
        )
)
  1. Prints the "instructions" Text element to the screen.
  2. Creates the "fj" Key element and waits for the F or J key to be pressed.
    • If F was pressed, end the trial immediately.
    • Otherwise, print the "continue" Text element and wait for the Spacebar key to be pressed.
↑ back to top

exitFullscreen

syntax

exitFullscreen()

description

to be filled in

example

click to expand
  • Calling exitFullscreen() quits fullscreen mode.
newTrial(
  newButton("Start the experiment and go fullscreen!")
    .print()
    .wait()
  ,
  fullscreen()
)

newTrial(
  newScale(100)
    .before( newText("It is cold here") )
    .after(  newText("It is warm here") )
    .slider()
    .print()
    .wait()
)

SendResults()

newTrial(
   exitFullscreen()
   ,
   newText("Thank you for your participation!")
     .print()
   ,
   newTimer().wait()
)
↑ back to top

fullscreen

syntax

fullscreen()

description

Sends a fullscreen request to the participant’s browser.

example

click to expand
newTrial(
  newButton("Start the experiment and go fullscreen!")
    .print()
    .wait()
  ,
  fullscreen()
)

newTrial(
  newScale(100)
    .before( newText("It is cold here") )
    .after(  newText("It is warm here") )
    .slider()
    .print()
    .wait()
)

SendResults()

newTrial(
   exitFullscreen()
   ,
   newText("Thank you for your participation!")
     .print()
   ,
   newTimer().wait()
)
↑ back to top