function.call

getFunction(id).call() Executes the function. Example: [js try=”true” highlight=”12-13″] newFunction(“setKeyTime”, function(){ this.keyTime = Date.now(); }), newFunction(“keyTimerDelay”, function(){ return Date.now() – this.keyTime > 10; }), newButton(“Start”, “Start”) .print() .wait(), newText(“instrutions”, “Quick, you have one second to press the T key!”) .print(), newTimer(“quick”, 1010) .start(), newKey(“t”, “T”) .wait(), getFunction(“setKeyTime”) .call(), getTimer(“quick”) .wait(“first”), getFunction(“keyTimerDelay”) .test.is(true) .success( newText(“success”, “Good job!”) …

canvas.settings.add

getCanvas(id).settings.add( x, y, element ) or getCanvas(id).settings.add( “left at x”, “top at y”, element ) (since PennController 1.1) or getCanvas(id).settings.add( “center at x”, “middle at y”, element ) (since PennController 1.1) or getCanvas(id).settings.add( “right at x”, “bottom at y”, element ) (since PennController 1.1) Places element onto the canvas at the coordinates (x, y). Note …

button.test.clicked

getButton(id).test.clicked() (since beta 0.3) Tests whether the button was ever clicked before.

button.settings.log

getButton(id).settings.log() Adds a line to the results file each time the button is clicked. Example: [js highlight=”2″]newButton(“word”, “It’s a word!”) .settings.log() .settings.once() .print() , newAudio(“sound”, “sound.wav”) .play() .wait()[/js] Adds a button to the screen, plays the audio file sound.wav and proceeds when the audio is done playing. The button can only be clicked once (see …

button.settings.once

getButton(id).settings.once() Disables the button right after it is clicked for the first time. Example: [js highlight=”3″ try=”true”]newButton(“test”, “It’s a test!”) .settings.log() .settings.once() .print() , newAudio(“sound”, “test.mp3”) .play() .wait()[/js] Adds a button to the screen, plays the audio file test.mp3 and proceeds when the audio is done playing. The button can only be clicked once, and …

button.wait

getButton(id).wait() or getButton(id).wait(“first”) or getButton(id).wait( test ) Waits until the button it clicked before evaluating and executing the next commands. If you call wait(“first”), then if the button was already clicked at least once by the time this command is evaluated, the next commands are evaluated and executed right away. If it was never clicked …

audio.test.playing

getAudio(id).test.playing() (since beta 0.3) Tests whether the audio stream is playing at the moment when the test command gets evaluated.

audio.test.hasPlayed

getAudio(id).test.hasPlayed() (since beta 0.3) Tests whether the audio stream has played at least once before in the trial.

audio.settings.log

getAudio(id).settings.log() or getAudio(id).settings.log(“play”) or getAudio(id).settings.log(“pause”) or getAudio(id).settings.log(“end”) or getAudio(id).settings.log(“seek”) Tells to add a line in the results file each time an event happens. If you do not specify which event you want to log, all of them will add a line to the results file. “play” adds a line including a timestamp and an offset, …

audio.settings.once

getAudio(id).settings.once() Disables the buttons to play/pause the audio right after its first playing (the audio can still be played using the action play). Example: [js highlight=”5″ try=”true”]newText(“instructions”, “Please listen to the audio below”) .print() , newAudio(“sentence”, “test.mp3”) .settings.once() .print() .wait() , newButton(“validation”, “Validate”) .print() .wait()[/js] Adds some instruction text to the screen and control buttons …