Title: Revolution Software
1Revolution Software
- Computers for research
- Dr. Bill Potter
2Revolution Structure
- Easy to conceptualize
- Create a stack
- The stack is composed of cards
- Cards have objects on them
- Fields - for text
- Buttons to do things!
- Graphics drawings, movies, pictures
3Create a Mainstack (Program)
- Start Revolution
- Click on Menu item File
- Click on new Mainstack and a new window will
appear. - This is a single
- Stack, with one card.
4Add a card, or several
- Click on menu item Object then select New
Card - Notice that a (2)
- Appeared that
- Is your indication
- That you are on
- Card 2. Looks just
- Like card 1!!!
5Add a card, or several
- Using your arrow keys you can go from card 1 to
card 2. - Add more cards!
6Add objects to cards
- This small window contains many of the objects
that you can plop on a card - If it is not visible, check behind the
- Current window, or go to menu item
- View and make sure that
- Tools Palette has a check
- mark next to it.
7Add stuff to cards
- Once you have that Palette, drag something from
it to the stack you created. - For example, drag a button to the
- Card that you are on
8Now try adding other things
- A field (for text)
- A movie (for fun!)
- A picture (display your photo!)
- A drawing
- Click here to reveal drawing tools!
9- Drawing tools! Select one and
- Draw on the card
- Painting tools
10Here is a card with a field, button, picture,
movie and drawing object.
11Objects always have their own layer..
- The blue drawing object was created first, and is
thus behind the picture of the tiger.
If I Cut (control X) the blue box and paste it,
(control V), it will look like this
The box is now in front of the Tiger. Every
object has its own layer And can be moved from
layer to Layer.
12Test or edit modes..
Edit/Create
Run/Test
- You can be in one of two modes
- when using revolution, editing
- or creating your program, or
- running/testing your program.
- To switch modes, simply click on
- The correct pointer on the tool
- Palette.
13Edit Mode..
- You can write script (program) or change the
properties of objects, create new ones etc. For
example if you are in edit mode and you
double-click on a button the following appears - This is the inspector you can change the button
name, change the font, or color, what the button
does, or many other things about the button from
the inspector. - All objects can be inspected, including each
card, the stack, fields, pictures, etc. -
14Assignment 1 (30 points)
- Recreate this screen to the best of your ability
15Referring to objects.
- Each of the object types has a name and a number.
Here are some of the object types - Window Objects
- Stack
- Card
- Backgrounds/groups (covered later)
- Interface Objects
- Field (several types)
- Button (several types
- Menus
- Graphic/multimedia objects
- Graphics
- Pictures
- movies
The number of an object Reflects when it was
created. If you put a field on card 1, it is
field 1 of card 1. If you create a second field
it becomes field 2. If you cut field 1, then
paste it, it now becomes field 2, and field 2
becomes field 1. Thus, the number of an object is
a bit tricky to work with!
16- The number of an object reflects when it was
created. If you put a field on card 1, it is
field 1 of card 1. If you create a second field
it becomes field 2. If you cut field 1, then
paste it, it now becomes field 2, and field 2
becomes field 1. Thus, the number of an object is
a bit tricky to work with! It is better to give
an object a unique name. for example.
17This stack has been named MyVeryOwnStack
18Message box for commands.
- Hold down control key, then press M or menu item
Tools, message Box. - You can type commands into the message box you
are using programming code!
19Some commands using the object names. Typed in
message box
- Hide Button 1 or Hide button Beep
- Show button 1 or show button Beep
- Set the location of button beep to 100,100
- Set the name of button beep to Hello!
- set the backgroundcolor of button 1 to red
- Most properties of objects can be set this way.
20To find out about properties of objects
- Menu item Help, Documentation, Getting Started,
Using Objects, Properties customizing
interface.. Either watch the video, or download
the PDF file. You can read the PDF at your
leisure. - I suggest looking at others as well, commands,
if-then loops, etc.
21Event Driven Programming
- Revolution is event driven. That is, the
software generate messages when the user does
things like move the mouse, click the mouse,
type, etc. - Watch the messages Menu item Development,
Message Watcher. Then interact with the stack,
clock on things, type, etc. Look at the messages
generated.
22Trap Messages to make things happen
- For instance when you click on a button the
following messages are generated - Mousedown
- MouseStillDown
- Mouseup
- To make something happen when these messages
occur, simply create the following handler in
the button script (each object has a script, it
is where the programming goes!) - On Mousedown --- beeps when clicked this is a
comment - Beep
- End mousedown
23More on messages
- Messages travel in revolution. For instance, when
you click on a button the mousedown,
mousestilldown and mouseup message is sent when
the button is pushed down, then a
Mousestilldown is generated over and over as
long as the button is kept down, then a mouseup
is generated when the button is released. - Where do these messages go???
24Simplified version of the message path
To stack script
To card script
A click on this button sends a mousedown To this
buttons script. If not handled it goes To the
card script, then to the revolution application
Itself. If it is not handled via a script, it
just goes away. If it is handled, it stops at
that object unless you pass it along (later!). No
message is sent to the second button.
25Here is the actual path Messages follow. Hmmmm!
26Event handling.
- For now we will only concentrate on a simple
event mousedown, that is sent to a button. Or
said another way, the button is clicked on! This
code will make the computer beep if it is in a
button script - On mousedown
- Beep
- End Mousedown
- You could also use MouseUp if you like
27Summary of this weeks items to learn
- Go command makes revolution display another
card, for instance if you are on card 1 and give
the command go to card 2, card 2 will be
displayed! - Put command allows you to place things in
containers - Click at simulates a user clicking somewhere at
the screen - Wait tells the computer to wait for X amount of
time - Add tells the computer to add some value to a
container - Random a function that returns a random number
but limited to certain values (you specify) - If then a control structure that tells the
computer to do something if some condition is met - Repeat a control structure that tells the
computer to repeat some actions until some
condition is met (e.g. the correct number of
times)
28Some commands - Put
- Command does something (e.g. Beep)
- Command 1 put allows you to put things into
containers. The most obvious container we know of
is a field (holds text) - Put hello into field Hello World if that
field exists the word Hello will appear in the
field if you have this script in a button - On Mousedown
- Put Hello into fld Hello World ---
notice the abbrev for field - put empty into fld Goodbye --- will clear
whatever is in that fld - End Mousedown
29Click Command
- Click will simulate a mouse click for you. So, if
you were to write - Click at the location of button 2
- Button 1 would be clicked from your program (that
is the button you click would click the other
button! - If you write Click at the loc of fld 1 the
cursor will appear in that field, ready for the
user to type in it! - On mousedown
- Click at the loc of fld Answer notice
the abbrev - End mousedown
30Wait Command
- Wait makes the computer do nothing for the amount
of time that you specify. If you write - On mousedown
- Wait 10 seconds
- Beep
- End mousedown
- the computer will do nothing for 10 seconds then
beep!
31Add command
- Add allows you to add the numbers that are in a
container to something else. For instance, if fld
Start contains the number 8 and you click on a
button with this script - on mousedown
- add 7 to fld Start
- End mousedown
- Each time you click on the button the text in fld
Start will increase by 7! - You can add the numbers in two fields as well
- Put field 1 field 2 into field 3 --- I did not
use add, but it has a similar effect. -
32If statement (a decision)
- The IF-Then statement allows you to determine if
some criteria is met, and if it is, then do
something! For instance - On mousedown
- if fld Start 22 then beep
- end mousedown
33A function Random
- a function calculates, or gives you some
information (put the time) put command, the
time is a function (goes out and figures out what
the time is and puts it in the message box) - Put the random of 9 into fld A Number
- This will randomly select a number between 1 and
9 and put it into fld a Number
34Putting into a field
- Each time I give the command
- Put the random of 9 into fld A Number
- Each new number selected will replace whatever is
in that field - To have revolution put each new number AFTER the
each number simply change the wording a bit - Put the random of 9 AFTER fld A Number
35Repeat loop
- Technically the repeat loop is called a control
structure, as is the if statement . Here is a
repeat loop - on mousedown
- repeat 5 times
- beep
- wait 2 seconds
- end repeat
- End mousedown
- When clicked, this button will beep 5 times, with
2 seconds in between each beep
36Assignment 2
- Create a program that tests recall of a 7 digit
number that is randomly generated. Keep track of
how many trials the participant has and how many
of them are correct. I created the program on two
cards, as shown on the next screens
37(No Transcript)
38(No Transcript)
39How the program should work!
- Clicking the start button should put the randomly
generated 7 digit number into the first field
(the top one in the center). The number should
stay on the screen for 10 seconds, then disappear
and then the participant can type what they think
the number was. When done, they should click on
the finish button, and the program will display
what the correct number was again in the first
field, and update the two fields on the top of
the screen (the number correct and the total
number of trials). They can then do the whole
process over again. The first card should make
sure that all the fields on the second card are
emptied, except for the ones that tally the
number correct and the total trial they should
be set at 0.
40Step by step outline
- Card 1
- -- needs button Start
- Experiment
- -- button script needs to
- put empty into flds ToRecall, answer and
Hidden on card 2 - -- Need to put 0 into flds Correct and
TotalTrials of card 2 - -- Needs to go to card 2
Card 2 Needs 5 fields Needs 2
buttons Torecall Start
Answer Finish
hidden Correct
TotalTrials Start Button -- clears fields
toRecall, Hidden, Answer -- puts random 7
digit number in fld Torecall -- waits 10
seconds -- clears field Torecall (but save
number!) -- clicks at fld Answer so
participant can type Finish Button -- must
add 1 to fld Correct if they typed the
correct number -- must add 1 to fld
TotalTrials -- must put the correct number
back into fld ToRecall
41Some pointers.
- For the first card, you will have to refer to
fields on the second card. To do so, you write
something like this Put 0 into field
TotalTrials of card 2. - If you put the random statement into a repeat
loop it will do it the number of times that you
specify. For instance - On Mousedown
- repeat 7 times
- put the random of 3 into fld Torecall
- End repeat
- You are going to empty out the field ToRecall
pripr to having the participants try to recall
the number but, you still need that number, so
you should save it somewhere. That is what field
hidden is for. Make sure that you stash that
number in the hidden fld for later use! - I will add 1-3 bonus points if you add on some
cool feature, like examining the number of
correct digits number by number, or figuring out
how long it took the participants to do the
recollection, etc. Just make sure that you have a
note in your program telling me to look at that
feature!
42Containers!
- Fields are containers, they holds number or
letters (also known as strings). Variables are
also container, they can hold numbers or strings,
but they do not appear on a card, like a field
does. Basically a variable is simply a place in
memory to store things. A variable can not be
named a Revolution reserved word, or command, but
mostly anything else. Here is an example -
- On MouseUp
- Put Hello into ThisIsAVariable
- Put ThisIsAVariable into fld MyTest
- End mouseUp
43Global Variables
- Variables come in two flavors Global and local.
Local means that the variable disappears
immediately after the handler it is in is
finished. For example - On MouseUp
- Put Hello into ThisIsAVariable
- Put ThisIsAVariable into fld MyTest
- End mouseUp
- As soon as the MouseUp Handler is finished,
ThisIsAVariable no longer exists and anything it
was holding is gone. - A global variable exists as long as your stack
(program) is running. So - On MouseUp -- this is in button 1
- Global ThisIsAVariable -- this is how
you declare a global var - Put Hello into ThisIsAVariable
- End mouseUp
- On MouseUp --- this is in button 2
- Global ThisIsAVariable -- notice that to
access the global var, each handler has to do
this - Put ThisIsAVariable into field MyTest
- End mouseUp
- ThisIsAVariable will still be present when you
click on button 2 and btn 2 will put hello into
field myTest
44Chunks
- Revolution has an easy way to refer to things in
a container. For instance, if the following is in
field ToTest - This is a test and you type the command
- Put character 3 of field ToTest into fld
MyOtherField then and i will be put into fld
MyOtherField - So here are the chunks
- These are some words, and they are cool
Each of these are called A character (char)
Each of these are called A word has a (space
after it)
Commas separate items, in this case there are two
items
45Chunks.
- If this is in fld 1 This,is,a, Test
- If you type in the message box
- Put item 1 of fld 1
- The following will appear (in the lower portion
of the message box) - This
- If you type in the message box
- Put word 1 of fld 1
- The following will appear
- This
- If you type in the message box
- Put word 1 of fld 1
- The following will appear
- This,is,a,
46Opening and saving to a file
- It is easy to open a file, write to it, then
close the file. In revolution it goes like this - On mouseDown
- Open File ThisIsMyTestFile.txt -- the txt
means it will be a text file - Write This is my first file return to
file ThisIsMyTestFile.txt at EOF - Close file ThisIsMyTestFile.txt
- end mouseDown
- This will open a file (and create it if it does
not exist) named ThisIsMyTestFile.txt then
write This is my first file to the file, at
EOF which means at the End Of File, then close
the file. - By using the EOF, you will keep appending the
text to the end of the file so the file will get
larger and larger each time you click the button.
- Where the heck is the file? Usually it will be in
C, under Program Files and Revolution Studio
then in a subfolder named something like
2.7.2-gm-1. Here is my path - C\Program Files\Revolution Studio\2.7.2-gm-1
- The other option is to search for the file!
- Cool thing If you use .csv instead of .txt
your file will open in excel and will all the
data will be entered in the columns!
47Checking char by char
- Part of your task for this new assignment is to
see how many of the numbers they got correct,
character by character. You can do it this way - put "1238895" into var1 var1 and var2 could be
the torecall and answer flds - put "1234567" into var2
- repeat with x 1 to the number of
chars in var2 - if char x of var1 char x of
var2 then - add 1 to TheCorrects
- else
- add 1 to TheIncorrects
- end if
- end repeat
- this compares the two numbers character by
character and if they are the same adds 1 to var
TheCorrects and if not adds 1 to var
Theincorrects
48Creating a trial by trial transcript
- For the new assignment you will also create a
file that will hold what happened for each trial
of your experiment. I suggest using items, so it
will look like this - Torecall, Answer, Correct, Tottrials,
CharsCorrect,CharsIncorrect - 1435643, 143562, 0, 1, 6, 1
- To do this after they complete a trial and you
check to see if it is correct, you will save each
bit of trial information into either a field or a
global variable. It will look something like
this - Put Fld hidden , fld answer , fld
Score , fld totalTrials ,
charsCorrect , charsIncorrect return
after SomeGlobalVariable - The means something like also, it will put the
next string or number right after whatever you
just put in the container. - The , are put in to make them items
- The Return makes sure that the next trial that
you put in will start on a new line.
49Ending your session.
- For this assignment, you will also have the
participant do 10 trials then transition to a
third card that ends the program and thanks them
for participating. I suggest keeping track of how
many trials they have done by using a global
variable to count every time they click on the
Finished button (the end of a trial). Then have
something like this - If NumberOfTrials 10 then
- Save the transcript into the file
- Go to the card that will say Thanks!
- End if
- Dont forget that you will have to initially put
0 into that NumberOfTrials variable probably on
card 1 in the start button.
50Correct/incorrect feedback!
- Some of you did this already, but everyone should
do it - When the participant gets the number correct
revSpeak Great Job or something like that. - When the participant gets the number incorrect
revSpeak Incorrect! Or something like that.
Recall to make your computer speak the command
is - revSpeak What you want to speak
51- New on the experiment card
52New Card.
53Assignment 3 summarized
- Card 1
- Will need to set number of trials var to 0
- Card 2
- Add in the number of digits correct fields and
the label - When the finished button is clicked it should
- Do what it already does (Correct or not)
- Give auditory feedback as to correct or not
(revSpeak) - 3. Calculate the number of digits correct and
display that number in the new field - 4. Create a container that stores the trial by
trial data in item format, that is, each bit of
data is separated by a comma, and each line is
one trial. Here is what you will record - Torecall, Answer, Correct, Tottrials,
CharsCorrect,CharsIncorrect - 5. Count the number of trials when 10 trials
have been reached, save the transcript into a
file (you pick the name) and go to card 3
Card 3 As pictured!
54Set..
- You can set a number of properties of objects
using the set command - set the textcolor of fld 1 to red -- this will
cause the text in the fld to change to red. - Set the name of fld 1 to HolySmokes changes
the name of fld 1 to HolySmokes - set the textsize of fld 1 to 30 will change the
size of the text in fld 1 to 30 - Set the visible of fld 1 to false will hide fld
1 - Set the visible of fld 1 to true will show fld 1
55Option Menu Button
Notice the Option Menu button It allows you to
select options to use in the experiment. In this
case it is to select the second color to be used.
You put the into the contents of the button.
If you write the code Put the selection
of button NameOfTheOptionMenuButton into
Avar Then, in this case, that variable will
contain the word Red as that is what the
user Selected in the option menu button!
56Message openCard
- Every time you go to a card, or open a stack and
end up on card 1, an openCard message is sent
to the card. You can use a handler to do stuff
when that message is sent, for example - On opencard
- Global myPictures
- Show field Instructions
- Wait 3 seconds
- Hide field Instructions
- Put Dog,Cat into MyPictures
- End openCard
57Random Selection without replacement..
- Sometimes you want to randomly present something,
but want to make certain that it is alternated,
but in a random sequence with something else. For
instance, you might want to randomly present
either a picture of a cat, or a dog to a child
who is learning to name cat and Dog
58Random Selection without replacement..
- Basically you want to only present either a dog,
or a cat, and randomly select which one will
appear, with a maximum of only 2 of either in a
row (e.g. cat can be shown on two trials in a
row, then a dog will be shown). Here is some code
that will do this - In the card Script
- on opencard
- global PicsToShow
- global TempPicsToshow
-
- Put "Cat,Dog" into PicsToshow -- notice
that I am using items - put "Cat,Dog" into TempPicsToshow
- end openCard
- In the Start trial button
- on Mouseup
- Global PicsToShow
- global TempPicsToshow
-
- If the number of items in tempPicsToShow 2
then -- both of them are in there - put the random of 2 into whichitem
- put item whichitem of tempPicsToShow into
whichPicture - Delete Item whichItem of tempPicsToShow
59- in our experiment, we want to have the color of
the digits to appear in one color (black) or
another (red, green or blue). The colors should
be randomly presented, with no more than two
trials of any one color ( e.g. red can only
appear a max of two times in a row). - Your task is make the digits appear in either Red
or Black, randomly on each trial, with 5 trials
of red, and 5 trials of Black (if you follow my
example with the dog and cat it will work
purrfectly).
60Assignment 4
- Your program will now
- Allow you to set the specifics of how your
experiment will run - Enter the participant name, which should become
part of the file name so you can keep data in
different files for each participant (as the file
names will be different) - Display the digits in either red,blue,green and
black (you select the nonblack color). Which
color is presented on any given trial should be
randomly determined, but 5 black color and 5
other color should be presented. - Allow you to change the number of digits that are
displayed to the participant - Finally, your program should track the other
color and black color data separately!
61Assignment 4 specifics
- Create a new card 1. If you cant insert the card
in front of the current card 1, try copying the
button on card 1 to card 2 (the inserted card!) - Add in all the fields and buttons for card 1,
then create the script for the Go to Start
Card. This handler will have too - Set the colors that will be use. Black will
always be one color, you select the second color.
Put it into a global variable like this put
red, black into TheColors - Set the number of digits that will be presented
on each trial (use a global variable) - Set the filename that will be used, which should
include your participant name for instance your
file might be called Andrea_digits.txt. Use the
participant field to do that, something like
this put fld Participant _digits.txt Into
MyFilename (use a global variable) - On the experimental card, in the start button,
you will have to randomly select what color the
text will be and change the text color. - In the finish button you will have to save your
data, but make sure that you know which data is
for the other color, and which is for black. I
suggest different containers for each, then save
them into the file with a notes as to which is
which. Or, at the end of each trial, add the
color at the end of the data line, something like
this - Torecall, Answer, Correct, Tottrials,
CharsCorrect,CharsIncorrect,Color
62How to debug.
- In any script, click on the leftmost side of the
screen next to the part of the script that you
would like to examine, like this
63Debug.
- Once you have your red mark (called a breakpoint)
on the sidelines, close the script, then click on
the button to send the mouseup, and start the
script. A debug window will appear, like this
64Debug.
- Once you have your red mark on the sidelines,
close the script, then click on the button to
send the mouseup, and start the script. A debug
window will appear, like this
Executes the next line of your code
stops the debugger
65From the user manual
- 3.5.7 The Debug Menu
- The Debug menu contains commands to aid in
debugging scripts and to control when the
Debugger window appears during execution. For
more details, see the section on Debugging. - Set Breakpoint Sets a temporary breakpoint at the
current line of the script. If more than one line
is selected, the breakpoint is set at the first
line. When a breakpoint is set, a marker appears
in the left margin of the script. - Clear All Breakpoints
- Removes all breakpoints in the current
script. Breakpoints are indicated in the gray
strip to the left of the main script field. (This
item does not remove breakpoint commands typed
into the script. Revolution will still bring up
the debugger when a breakpoint command is
encountered.) - Step Into Executes the next line of the handler
being debugged. If the next line is a call to
another handler, this command steps into that
handler. This menu item is disabled if the
debugger is not running. - Tip Press Space to step into the next line.
- The items in Blue are what you are likely to use
at this point in the class!
Step Over Executes the next line of the handler
being debugged. If the next line is a call to
another handler, this command steps over that
call, skipping it and staying within the current
handler. Tip Press Alt-Space to step over
the next line. Trace Begins slowly executing the
handler being debugged, starting from the current
line. Tip The delay between lines can be
changed by changing the value of the traceDelay
property. Run Resumes normally executing the
handler being debugged, starting from the current
line. Abort Stops running the handler being
debugged. Message Watcher Opens the Message
Watcher window, used to view and track messages,
function calls, getProp calls, and setProp
triggers as theyare sent to objects. Variable
Watcher Opens the variable watcher window, which
you use to keep track of the value of variables
during debugging, or to alter the contents of
variables to change the execution of your script
during debugging. When the debugger is not open,
the variable watcher shows the value of global
variables. Script Debug Mode If this item is
checked, the debugger is enabled the debugger
window appears when a breakpoint is encountered
during script execution, and you can enter the
debugger when an execution error occurs. If
unchecked, the debugger is disabled.
66Watching variables
- One of the powerful benefits of the debugger is
that you can watch what is happening to your
variables as you step through your script line by
line, while watching what is happening to your
variables. To start the variable watcher, click
on menu item Debug and Variable Watcher after
the debugger has started (after you clicked on a
script that has a breakpoint on it!). Here is
what the debugger looks like - As you step over the script, the variables will
change. You can also directly change the contents
of a variable by modifying it in the lower panel
once you change the variable, click elsewhere
on the Var watcher and the value will be changed
in the upper panel.
67Protecting your stack from unwanted user actions
- During the time that the digits are displayed on
the screen the user can type the numbers on the
keypad and Revolution will save those numbers and
put them into the Answer field. We dont want
that! To stop it, you can use the FlushEvents
function - Here is the REV documention on this
- Summary
- Clears pending events from the event queue so
they will not trigger handlers. - put flushEvents("activate") into trashVar
- get flushEvents("all")
- Use the flushEvents function to prevent unwanted
messages from being sent during a handler's
execution. - Parameters
- The eventType is one of the following
- all ignore all waiting events
- mouseDown ignore mouse presses
68Arrowkey protection.
- The user can press the arrowkeys and go to
different cards, when you dont want to to! - When the arrowkey is pressed an arrowKey message
is sent. Here is the rev Documentation on this - Syntax arrowKey up down left right
- See also keyDown message , navigationArrows
property , selectionChanged message , textArrows
property -
- Summary
- Sent to the active (focused) control, or to the
current card if no control is focused, when the
user presses an arrow key. - on arrowKey theKey -- make Up arrow go to the
first card - if theKey is "up" then go to card 1
- else pass arrowKey
- end arrowKey
- Handle the arrowKey message if you want to do
something special when the user presses an arrow
key.
69Arrowkeys
- For your stack I want the user to hear a beep
each time they try to press the aroowkeys. So
your script, which I suggest be in the stack,
would be something like this - On arrowkey whichKey
- Beep
- End arrowkey
- If you were cool you would have a different
sound or action for all the different aroowkeys!
70Preventing the user from pressing the start
button twice, or the finish button twice
- Global Variable can be used to indicate the state
of something for instance if the user clicks on
button Start we can put a 1 into IwasClicked
(a variable). If the button was not clicked on,
or the finish button was just clicked on, we can
put a 0 into it. - So what will this do?
Button 2 on mouseUp Global ClickedOrNot
If ClickedOrNot 0 then revSpeak "I was
clicked last time exit mouseup Else put
0 into ClickedOrNot revSpeak "Thats right I
was not clicked last time!" End if end
mouseUp
Button 1 on mouseUp Global ClickedOrNot
If ClickedOrNot 1 then revSpeak "I was
clicked last time exit mouseup Else
put 1 into ClickedOrNot revSpeak "Thats
right I was not clicked last time!" End if
end mouseUp
71Assignment 5
- Using the arrowkey message, prevent the
participant from using the keys to navigate the
stack, and each time they press the arrowkey make
a sound (beep, or other sound) occur - Using the FlushEvents function, prevent a user
from typing during the time that the ToRecall
digits are on the screen. - Using a global variable, only allow the
participant to click on the start or finish
button once time. You should give them feedback
if they try to click on either of the buttons
twice. For example, if they click twice, perhaps
use revSpeak to say (Click the finish button -
that is if they clicked the start button twice). - Finally, using a global variable, make the time
between when the digits go off the screen, to
when they can start typing, be X number of
seconds. That is, you are increasing the
difficulty of the memory task by taking the
torecall number off the screen, then waiting X
seconds, then allowing them to type in the
number. You should set the X (seconds) on the
set-up card.
72Timing in revolution
- Timing in revolution involves capturing the time
at one point, then at another point and
subtracting the two. This will give you the
amount of time that elapsed between the two
events. The events can be anything the user does,
click on buttons (mousedown), press a key
(keydown) or switch card (opencard).
73Using Milliseconds
- A millisecond 1/1000 of a second
- From Rev
- The milliseconds function returns the total
number of milliseconds since midnight GMT,
January 1, 1970. - When you write
- Put the Milliseconds into Avariable
- The number of milliseconds from that date on will
be put into Avariable. It will look something
like this - 1161293155312
- A second later it will look like this
- 1161293156312 notice the 4th from last digit is
now a 6, 1 second 1000 milliseconds.
74Using Milliseconds
- Thus, to time something,
- On event 1 (e.g. opencard)
- On open card
- global TheStartTime
- Put the milliseconds into TheStartTime
- End opencard
- On another event
- On Mousedown
- Global TheStartTime
- put the milliseconds into TheEndTime
- put theEndTime- TheStartTime into elapsedTime
- put elapsedTime/1000 return after fld 1
- End mousedown
75Setting the DefaultFolder
- From Revolution help
- The defaultFolder property specifies the folder
Revolution uses as the current directory . thus,
it is where revolution will save files that you
open and write to, and where it will look to find
files that you might use (e.g. pictures) - To see what the defaultfolder is, in the message
box type Put the defaultfolder
76Using ANSWER to set the default folder
- Answer allows you to ask the user to choose
something. Answer will bring up a dialogue box
and ask the user for some information, then put
that information into a revolution variable
called it - We are interested in the Answer Folder command.
It will ask the user to either select a folder or
to create a new one. When it is finished, it will
put the folder address (or path) into the
variable it.
77Answer Folder some label
- This is what the following code does
- Answer folder Please pick a folder
78Set the defaultfolder to the chosen folder
- Once you have chosen a folder and clicked on Ok
then the variable It will contain the path to
that folder. It will look something like this - C/Documents and Settings/wpotter/Desktop/All
Desktop - You can set the default folder to that location
by simply using this command immediately after
the answer code - Set the defaultfolder to it.
- Here is the whole thing
- On Opencard
- answer folder "Pick a Folder where things should
be saved" - Put it into theFolder (or you can simply set the
defaultFolder to it) - set the defaultfolder to theFolder
- end OpenCard
79Assignment 6
- Create a stack with this on card 1
In the start Button Capture the milliseconds
when you click On the button I suggest
mousedown. In the finish button Capture the
milliseconds when you click On the button
again on mousedown. Calculate the amount of time
it took you To click on button start then
Finish and Display the number of seconds (not
milli- seconds) in field 1, as displayed to the
left. In the Set defaultFolder button, use
the answer and set defaultFolder commands to
set the default folder to a folder of
your choosing.
80Assignment 7
81(No Transcript)
822
83Assignment 7Examining variability of responses
- Card 1 set up card, participant name to create
the filename from, set defaultfolder - Card 2 for the participant to click to start the
experiment after you leave the room probably
sets initial variable values - Card 3 the experimental card
- Displays 4 buttons with the letters E,S,T,A on
one button each - Arranges code such that each button needs to be
clicked on at least once before a trial ends - When a trial ends, a black graphic covers the
screen for 2 seconds (show/hide graphic) - Arranges for every other trial to earn a point
(an FR2). - Displays the points earned
- Displays what buttons were clicked on, in what
order, for each trial (see field) - Ends after 20 trials and saves the data into a
file with the participants name as part of the
file name
84Some pointers.
- Use your existing code from the memory experiment
for card 1 and card 2 (but Modify it) - For card 3 you need to know about user defined
messages basically you can create a message of
your own and send it to any object. For Example - On Button 1
- On mouseup
- Send MukkyMuk to this card
- End mouseup
- On the card script
- On mukkyMuk
- Put MukkyMuk was sent to the card! into field
1 - End MukkyMuk
85My Card Script Code!
86One buttons code - all are very similar!
87Names
- Put the long name of button 1 into fld 1
- The following appears in fld 1
- button "E" of card "card id 1020" of stack
"C/Documents and Settings/wpotter/Desktop/F2006
classes/Assign7_Varibility1.rev - Put the name of button 1 into fld 1
- The following appears in fld 1
- button "E
- Put the short name of button 1 into fld 1
- The following appears in fld 1
- E
88Assignment 8
- For this assignment you will modify the
variability experiment that you created last
week. - 1. Add another card, that does the same thing as
the E,S,T,A, buttons card, but uses numbers
instead on the buttons (1,2,3,4) - After each trial the buttons should be randomly
positioned on the screen - Keep track of all your data! (new stuff as well)
89Randomly positioning the buttons.
- First you need to understand how revolution
figures out where something is located on the
screen.
X value increases, e.g. 200, 0
0,0
Y Value increases, e.g. 0, 200
90Examining the screen positions (x,y coordinates)
- If you type this code into the card script then
change out of editing mode, the position of the
mouse will be reported in the message box over
and over (the idle message is continuously sent! - on idle
- put the mouseloc
- end idle
91The Location of an object
- location
- Syntax set the location of object to point
- Synonyms loc
- See also bottomLeft property , bottomRight
property , globalLoc function , is within
operator , localLoc function , lockLocation
property , move command , moveControl message ,
rectangle property , revCacheGeometry command ,
revUpdateGeometry command , topLeft property ,
topRight property -
- Summary
- Specifies where an object is.
- Use the location property to move an object
without resizing it, or to find out where an
object is. - Value
- The location of an object is any expression that
evaluates to a point--two integers separated by a
comma. - The first item of the location is the distance in
pixels from the left edge of the screen (for
stacks) or card (for other objects) to the center
of the object. The second item is the distance in
pixels from the top edge of the screen (for
stacks) or card (for other objects) to the center
of the object. - For cards, the location property is read-only and
cannot be set. - Comments
92Putting the locs of your buttons
- First, find out the location of your buttons this
is easily done by typing the following into the
multiline messagebox then pressing on the control
and enter key. - repeat with x 1 to 4
- put the loc of button x return after fld
transcript - end repeat
- Something like this will appear
- 170,136
- 407,136
- 170,273
- 407,273
- These are the locations of the buttons, starting
with button 1 on top, down to button 4. Copy
these.
93Randomly assigning positions
- Here is my code for doing the random assignment
- Your main task is to figure out where this code
should be positioned in your program!
94Assignment 8 new card
- I would copy the current card, then make
modifications to the new card be sure to be on
the card you want to copy, then type this into
the message box - Copy this card then press return
- Then type this
- Paste card then press return
- A complete copy of the card will now be in the
stack notice that the card number at the top
left of the screen has increased by 1!
95Assignment 8, new card
- Some of the modifications you will need to make
- You must change the names of the buttons
- You much change the global variable names where
needed (i.e. you cant use the names Abutton as
those may have some values in them from the
previous card!) - If you change the variable names you will have to
change the card script to reflect this that is
the CheckifTrialIsDone handler