Navigation stuff goes here
Concepts: blocks
What sort of thing can I put in a script ?
A PsyScript script is made up of blocks. There are four normal multi-line types of block plus two special single-line blocks which allow for easy commenting.
Types of block
- a procedure: has a name and may contain some PsyScript commands.
- a table: has a name and may contain some data PsyScript may use.
- a text block: has a name and may contain text which you may want your script to display in a popup.
- a comment block: may have a name. PsyScript will ignore it.
- a blank line: PsyScript will ignore blank lines anywhere between other blocks.
- a comment line: a line starting with '-- ' (minus minus space). PsyScript will ignore comment lines between other blocks.
The shortest PsyScript script
Every script needs one procedure block. The shortest possible legitimate PsyScript script is as follows:
define fileFormat PsyScript script format 2.0
define homeFolder file:///Users/simonslavin/Desktop
define logMethod localStorage
proc main
end proc
Anything shorter than that isn't a proper script and won't run. Here's a script which features all the kinds of block:
define fileFormat PsyScript script format 2.0
define homeFolder file:///Users/simonslavin/Desktop
define logMethod localStorage
-- This whole script does nothing at all.
-- But it does contain at least one of each kind of block.
proc main
-- these comments are indented because they're part of a procedure
-- rather than being their own blocks
end proc
-- since this script does nothing, the table doesn't need to contain data
table stimuli
end table
textblock introductoryText
This is some text which can be accessed by the 'display text from …' command.
end textblock
comment about blocks
This type of block is like a textblock but PsyScript ignores it completely.
end comment
Technical notes
- A blank line inside a procedure is ignored. A blank line inside a table is ignored. However, a blank line inside a text block is a blank line of text.
See also