You can use the special end
command to control when the trial should end. This is particularly helpful if you want to end the trial prematurely.
Example:
newTextInput("age", "") .settings.before("How old are you? ") .print() .wait() , newText("nativeSwahili", "Are you a native speaker of Swahili?") .print() , newButton("yesSwahili", "Yes") , newButton("noSwahili", "No") .settings.before( getButton("yesSwahili") ) .print() , newSelector("yesnoSwahili") .settings.add( getButton("yesSwahili") , getButton("noSwahili") ) .wait() , getSelector("yesnoSwahili") .test.selected( getButton("yesSwahili") ) .failure( end() ) // Ends the trial prematurely , newText("other languages", "If you speak any other language(s), please list up to two (one per line)") .print() , newTextInput("languageList", "") .settings.lines(2) .settings.log() .print() , newButton("finish", "Send") .print() .wait()
First adds a line asking for age and waits for a press on the enter/return key. Then adds a line of text asking about native fluency in Swahili, two yes–no buttons side-by-side below it and waits for a click on either one of them (both being part of the same selector element). If yes was not clicked, then it is the end of the trial. Otherwise, the script proceeds to adding a line of text and an input box inviting to list any other spoken language(s), and a Send button waiting to be clicked.
Index
- Installing PennController
- Ontology
- Aesthetics
- Preloading resources
- ZIPped resources
- Spreadsheet (CSV)
- Canvas creation
- Setup for audio recordings collection
- Commands by element categories
- Standard Element Commands
- Audio element
- Button element
- Canvas element
- Function element
- Html element
- Image element
- Key element
- Scale element
- Selector element
- Text element
- TextInput element
- Tooltip element
- Timer element
- Var element
- Video element
- VoiceRecorder element
- Youtube element
- Special clear command
- Special end command
- Global PennController Commands
- PennController
- PennController.AddHost
- PennController.AddTable
- PennController.CheckPreloaded
- PennController.DownloadVoiceButton
- PennController.FeedItems
- PennController.Footer
- PennController.GetTable
- PennController.GetURLParameter
- PennController.Header
- PennController.InitiateRecorder
- PennController.PreloadZip
- PennController.ResetPrefix
- PennController.Template