authorware programming guide for reseachers- 2nd edition

97
AUTHORWARE GUIDE FOR RESEARCHERS Daniël Lakens Version 2.3 Last update: 31-5-2009 Published under a creative commons license: . © 2005-2009 Daniël Lakens

Upload: lakens

Post on 12-Nov-2014

6.287 views

Category:

Documents


0 download

DESCRIPTION

workbook

TRANSCRIPT

Page 1: Authorware Programming Guide for Reseachers- 2nd Edition

AUTHORWARE GUIDE FOR RESEARCHERS

Daniël Lakens

Version 2.3 Last update: 31-5-2009

Published under a creative commons license:

. © 2005-2009 Daniël Lakens

Page 2: Authorware Programming Guide for Reseachers- 2nd Edition

- 1 -

Contents Contents ..................................................................................................................... 1 Introduction ................................................................................................................. 2 1. So, when do I get to program something? .............................................................. 3 Where you will learn the basics of Authorware and the main interface 2. So now what? ....................................................................................................... 11 Where you will change the standard settings of your experiment 3. Boooooooooring. .................................................................................................. 12 Where you will use radio buttons and the decision icon 4. Hey, this is really a lot of work! ............................................................................. 19 Where the functions of the Text Entry are explained 5. Maybe I prefer paper and pencil tasks. ................................................................. 22 Where you will make a standard instruction display and use the wait icon 6. So am I pretty good now, or what? ....................................................................... 28 Where you build your first questionnaire 7. Authorware programming is a piece of cake! ........................................................ 34 Where the functions and variables are introduced 8. Riiiiiiight. Do I look like a nerd to you? .................................................................. 39 Where all different time-related programming is shown 9. Everything I made looks so… plain. ..................................................................... 44 Where looks do matter and the conditional response is put into practice 10. Lights, Camera, Action! ...................................................................................... 49 Where Hollywood meets the laboratory and we insert video’s in our program 11. How about that questionnaire I made? ............................................................... 53 Where you are shown the functionality of loops 12. Ok, now give me something difficult. .................................................................. 57 Where we wander around in the wonderful world of lists 13. Is that the best you can do? ................................................................................ 63 Where the navigation through the experiment is broadened 14. So long, and thanks for all the fish! ..................................................................... 70 Where the safe storage of your data is ensured 15. No Authorware program is an island................................................................... 75 Where your experiments learns to communicate with other experiments and pc’s 16. How about packaging? ....................................................................................... 79 Where the ins and outs of distributing an experiment are discussed 17. Bugger! ............................................................................................................... 81 Where advice is given on how to debug your experiment Appendix 1: The Best of Both Worlds ....................................................................... 85 Where we combine E-Prime and Medialab with Authorware for RT research Appendix 2: Experimenting Online ........................................................................... 88 Where we get our experiment out of the lab and on internet

Page 3: Authorware Programming Guide for Reseachers- 2nd Edition

- 2 -

INTRODUCTION

elcome to this introduction to programming experiments in Authorware. Using a computer to administer experiments has several advantages over paper and

pencil tasks. First, all data is directly stored on the computer, and importing the data in statistical software like SPSS is very easy. Second, experiments programmed in Authorware allow a great deal of interactivity in instructions and tasks based on par-ticipants choices and answers. Third, it can make experiments more enjoyable for participants. All examples in this guide are based on Authorware 7.02 but most will work with older versions of the program as well. I will use a lot of examples to teach you the basics of programming in Authorware. The examples build on each other, so it is advisable to start with the first chapter and work your way through to the last one, even if you al-ready have some basic skills in Authorware programming. Tips are given in all chap-ters which could be useful even if you know the basics. This guide is not a reference manual; it is a workbook. You follow all examples step by step, read the explanations and learn the basics of making experiments in Author-ware. There will be situations where you will need Authorware to do something I have not discussed here; in most cases, it will be possible to program Authorware the way you want, but the commands needed are too specific for this guide. In the last chap-ter, I will give you some advice on where to look for help in those situations. Always remember that the only real way to learn Authorware is by programming ex-periments yourself. A good start will get you a long way, and in my own personal view, this Authorware Guide is the best introduction to programming experiments in Authorware you can get. I’d like to thank my colleagues Chris Reinders Folmer for his excellent help and com-ments, and Wilco van Dijk for giving me the time to work on this guide. If you have comments, suggestions, questions or want to report some errors, feel free to mail to [email protected]. P.S. Thanks to everyone who made suggestions for improvements. Small updates are added about twice a year – check http://lakens.googlepages.com/home for the latest version and some useful pre-programmed Authorware pieces.

^

W

Page 4: Authorware Programming Guide for Reseachers- 2nd Edition

1. SO, WHEN DO I GET TO PROGRAM SOMETHING?

- 3 -

1. So, when do I get to program something? Well, almost. We’ll explore the Authorware interface by building our first interaction. Open Authorware, and start a new file.

This is what you will see. The vertical line with the white hand next to it is the ‘flow-line’. For now, it’s empty. To the left of the screen, you’ll see the Icons bar. In it are all icons Authorware has, 14 of them. The names of all Icons are shown in tooltips; just let the mouse cursor rest above an icon and you’ll see the name appear. The top-left icon is called the ‘Display Icon’. This is the one we want to have on the flow-line. You can put icons on the flowline using the Click-and-Drag technique. Click on the Display Icon and hold down the left mouse button: the cursor arrow now changes to a display icon. Still holding down the left mouse button, drag the icon over to the flowline and release the mouse button. The Display Icon will appear on the top of the flowline. Now, select the name next to the display icon by clicking on it. Type in a new name instead of the ‘untitled’: in this case, name it ‘Intro’. TIP: Always name icons. This will help you enormously when building bigger Authorware pieces. The Display Icon is generally used to visually present information, such as text or pic-tures, to the participant. The Display Icon we just put on the flowline is grey, and not black like in the Icons bar (at the left of the screen). Why is this? If an icon is grey, this means that it is empty, and therefore will not do anything yet. If participants en-counter an empty Display Icon, they’ll just see an empty white screen. That’s not

Page 5: Authorware Programming Guide for Reseachers- 2nd Edition

1. SO, WHEN DO I GET TO PROGRAM SOMETHING?

- 4 -

what we want, so let’s put something for the participants to see in our icon. Double-click the display icon we have put on the flowline to open the presentation window. This presentation window is what your participants will see when they go through the experiment. For now, it looks pretty empty, so let’s figure out how to put something in the presentation screen. When double-clicking the display icon, Authorware automati-cally opens the Tools bar. On the toolbar (see picture on the next page) are icons for the options you have in the presentation window. The ones you’ll use the most are the text and the arrow icons. Authorware provides you with a great scope of layout options, but the downside of this is you can’t just go and type in text in a Display Icon like you would in Word. You have to select Text in the Tools bar first, and you must deselect Text by clicking the Arrow sym-bol if you want to perform other operations after you typed in something (for instance, if you want to drag the text you just typed in to another loca-tion on the screen). Displaying text in the presentation window is pretty straight forward. Click on the ‘Text Icon’. The cursor changes from the arrow-cursor to the bar-cursor you probably know from Microsoft Word. Click with this cursor somewhere in the lower half of the presentation window. A blinking cursor appears under a horizontal bar; this is a text field automatically created by Authorware. Now type in: ‘Welcome to this experiment.’ After you’ve done this, you realise that you wanted to have this text a lot higher, actually in the upper part of the presentation window. Click on the ‘arrow’ icon in the Tools box. Click-and-Drag the text to the upper part of the presentation window. Well done! But wait! Now you realize that the welcome you typed in is a bit curt. To edit the text, click on the ‘Text’ icon in the Tools bar, click on the text we just typed into the display icon, and correct the sentence. Change the text to: ‘Dear participant, welcome to this experi-ment.’ Oh dear, look what you did now. The text no longer fits on one line but now consists out of two lines! Now how do we fix this? Quickly click on the ‘arrow’ icon again, and look: six white squares appear on the outer edges of the text field.

These squares are at the borders of the text field. To make the text field bigger, click-and-drag the white squares on the right side of the text field further to the right so the sentence fits on one line. If we run the experiment like this, the experiment will simply freeze on this screen. Alternatively, if we have more than one icon, Authorware will display all without pause. This will make it impossible for our participants to read what’s actually on the screen. For this, we first have to close the display icon. You can close the display icon by clicking the ‘close’ button in the top right of the presentation screen. Alterna-tively, use the following shortcut: TIP: Press Ctrl+1 (press the ‘1’ key while pressing the ‘Control’ key): the presentation screen disappears. Press Ctrl+1 again. The presentation screen re-appears. Shortcuts like these will save you a lot of time while programming. Now we wanted to give the participant a moment to read this introduction before we

Page 6: Authorware Programming Guide for Reseachers- 2nd Edition

1. SO, WHEN DO I GET TO PROGRAM SOMETHING?

- 5 -

proceed with the experiment. For this, we can use a Wait Icon ( ). The Wait icon freezes the experiment for a certain number of seconds. In the Icons bar, you really can’t miss the Wait icon. If you haven’t figured it out already: it’s the one that has ‘wait’ written in it. Click-and-drag one onto the flowline, name it ‘Wait’, and then dou-ble-click it. A pop-up menu appears, in which we can edit the Wait icon’s properties. Two options are selected as a default: ‘Key press’, which makes the program wait until the participant has pressed any key, and Show button, which makes the pro-gram wait until the participant has pressed a button. Neither is required at this stage, so deselect both options. We do want a Time Limit, however. Type the number ‘8’ in the corresponding field. Now, when the participant reaches the Intro screen, the ex-periment will pause for eight seconds, thereby giving the participant more than enough time to read our welcome message. Now, we are going to need a bit more than just an introduction screen. But before we can present more information or questions to the participant, we must first erase our welcome screen, otherwise this screen will remain in the background during the whole experiment. This will not only look sloppy, overlapping text will make further text illegible as well. We must make Authorware erase our welcome screen after the participant has seen it. Thankfully, we have just the icon for the job: the Erase Icon ( ). The Erase icon can erase any information you specify from the Display screen. This is a very useful feature: in some cases, you want to remove everything you have displayed so far, in other cases you want to remove one specific item from the display screen while pre-serving others. The Erase icon therefore is a crucial part of Authorware programming. Where then do we find this important icon? It’s the third from the top in the left row in the Icons bar, the one with the little box in it. Click-and-drag it to the flowline, rename it to ‘EraseIntro’ and open it by double-clicking. A menu appears, to the right of which you see two options: ‘Icons to erase’ and ‘Icons to preserve’. We want to erase a specific icon this time: the introduction screen. You will see this screen in the back-ground as you open the erase icon (if not, close the erase icon menu, re-open the Intro display icon, close this again, and re-open the Erase icon). Now just click on the text in the background. The text will now disappear, and the Intro display icon will appear in the list of objects to be erased. When we run the experiment, Authorware will now first display the introduction, then wait for eight seconds, and then erase the introduction screen. Now let’s try something that will allow the participant to actually interact with the pro-gram. We are going to ask our participants to fill in their name. This will introduce us to another type of icon: the ‘Interaction Icon’. Drop another Display icon on the flow-line, and name this ‘Question’. Open it, and type ‘What is your first name?’ some-where. Now we need to make sure the participant can actually type in his or her first name somewhere. We therefore want to interact with the participant, and for this we need the Interaction icon from the Icons bar.

Page 7: Authorware Programming Guide for Reseachers- 2nd Edition

1. SO, WHEN DO I GET TO PROGRAM SOMETHING?

- 6 -

The Interaction Icon is the top-right icon, a right arrow with a question mark in it. Click-and-Drag it to the flow-line, just below the display icon. Name it ‘EnterName’. The interaction icon tells the flowline: ‘before we can pro-ceed, we need an answer from the participant to a ques-tion, and the answer we need should be given here to the right of the arrow.’ Normally the flowline runs only from top to bottom, but it has to pause when it encounters an inter-action icon and wait until it re-ceives input. In this case, we want the participant to fill in his or her name. We need to specify how we want Authorware to ask this to the right of the interaction icon. By click-and-dragging a ‘map’ icon (from the Icons bar) to the right of the Interaction Icon, we can select how we want the participant to respond. If done correctly, you should see the same on your screen as in the picture to the right. The pop-up ‘Response Type’ menu allows you to specify what kind of interac-tion you want. Authorware gives you all possibilities the program has, from which you can choose the type that best fits your needs. In this case we will choose ‘Text Entry’, as we want the participants to type in their first name. Select the Text Entry option by clicking on the corresponding radio button (the empty white circle to the left of each interaction type in the menu) , and then click on ‘OK’. A new field appears, again named ‘untitled’. For now, let this be. Notice that the … symbol above the map icon and right of the interaction icon reveals that the interaction is a Text Entry. So, where do we click now? We have 3 options: the interaction icon, the text entry icon, or the map. It can sometimes be confusing where to adjust certain aspects of your interaction. There is a simple rule, however: all visual aspects you want to change, like location on the screen and the looks of the interaction, are on the flow-line (so in the Interaction icon) and all properties of the interaction the program needs to know are to the right of the interaction (so this time in the text entry icon). So let’s change the visuals first. Double-click the interaction icon. The interaction icon itself works like a Display Icon. By double-clicking it, we are back at the presentation window again, and here we can change its visual aspects. You see a marker () and a dotted text entry field. You can click and drag the entry field to anywhere in the presentation window. You cannot see your text display now, so it’s hard to tell if the text entry is anywhere in the right place compared to the text you typed in, but this is a point we will come back to later. For now, just guess a little where it will be ok. We can change all kinds of visual aspects of the Text Entry by double-clicking on the text entry field. A new menu called ‘Properties: Interaction Text

Page 8: Authorware Programming Guide for Reseachers- 2nd Edition

1. SO, WHEN DO I GET TO PROGRAM SOMETHING?

- 7 -

Field’ pops up, which features options to change the font and layout of the Text Entry. For now, leave this be and click ‘OK’, and close the presentation screen (with Ctrl+1). We are not so much interested in how the Text Entry looks, but more in the inner workings of the Text Entry. For instance, what kind of responses the Text Entry will accept. Double-click on the text entry interaction itself (the small arrow and dotted line to the right of the interaction icon). There is a Text Entry tab and a Response tab. In the top left field, Type in * (the star located above the 8 on your keyboard). This is called a ‘wildcard’. A wildcard will allow a text entry to accept any kind of text input. You could also type in a specific name, such as ‘James’, but then the text entry would only accept people named James: a selection procedure which will unfortunately get you rather small samples. Sometimes, when you want people to only type in a spe-cific text entry, it is useful to put something else in this field then *, but for now use the wildcard. Then click on the Response tab.

For now, we are only interested in the field next to ‘Branch’: this field tells Authorware where the flowline should go to after the participant has interacted with Authorware: the options are ‘try again’ (useful if they responded in the wrong way to the interac-tion), ‘continue’ (useful in more complex interactions) and ‘Exit Interaction’ (meaning you want to continue with the flowline after the input). Choose exit interaction. Notice the flowline changed to resemble the picture here on the right. The flowline makes a small detour to collect a response from the participant, and then continues. So are we done now? Well, we are far enough to take a look at what we made. Press the ‘Run’ ( ) button in the taskbar. You’ll see the introduction screen, which will disappear after eight seconds. Next, a screen will appear in which you are asked for your name, and somewhere under it you will see a text entry blinking. If your text entry is not nicely aligned with the question on the screen, then this is the time to fix it. TIP: In the presentation screen you can click-and-drag text and images to a better location on the screen. If you accidentally double-clicked somewhere, just run the Authorware piece again. Type in your name in the text entry and press Enter. TIP: Participants have to press ‘enter’ to exit this text entry interaction. Be-cause this is not self-evident, be sure to tell them to ‘press Enter’ in your ex-periments. Always guide your participants through the interaction best you can.

Page 9: Authorware Programming Guide for Reseachers- 2nd Edition

1. SO, WHEN DO I GET TO PROGRAM SOMETHING?

- 8 -

So, what did Authorware do with the name you just typed in? Exactly what you told Authorware to do with your name: nothing. If we want to store the name the partici-pant filled in, we need to tell Authorware to do so. So let’s go back to the flowline and double-click on the map icon underneath the Text Entry interaction. Another screen opens, with a new flowline, and in the top right of the screen you see a label ‘Level 2’. A map works the same as a folder on your com-puter: it helps to keep things organized. As you might have noticed, we are halfway through the flowline already, and have only asked someone’s name. Authorware saves you from scrolling down a flowline of 200 meters by working in folders (in fold-ers in folders in folders in folders) which each contain a flowline on the next level. When the flowline encounters a Map icon, it will proceed on the next level (in this case, Level 2). Once the flowline has passed all icons in the map, it will return to its previous level (in this case, Level 1). However, if the Map icon includes map icons itself, the flowline might go to lower levels (Level 3, 4 etc.) first. Maps may save you from scrolling but sometimes you’ll click yourself to death; watch out for tips that save you from some clicking. TIP: If you don’t want to put your icons in maps inside maps, you can also increase how much of the flowline you can see on the screen by increasing the Flowline window. Alternatively, you can right-click inside the white window and select ‘Scroll Bars’. If there are more icons on the flowline to fit the window, a scroll bar will appear, allowing you to scroll to icons on the bottom of the flow-line. However, using maps will often save you the most time when you are browsing through your experiment.

On this Level 2 flowline we’ll click-and-drag the most important icon of all: the calcula-tion icon ( ). Name the calculation icon ‘NameSave’ and open it by double-clicking. In this screen, that looks like Notepad, you have to type in some Authorware pro-gramming.

SIDESTEP ON PROGRAMMING Programming works with functions and variables. For example: if month = 12 then NameMonth := “December”. The if – then structure is a well known function in programming, month is a variable that Authorware computes by itself, or a system variable, NameMonth is a variable we define ourselves, and Decem-ber is a string variable, or a variable containing text, in this case the word ‘Decem-ber’. This may look kind of confusing in the beginning, but you will get used to it pretty soon. This expression reads as follows: if (a variable the system keeps track of itself called the) month = (equals) 12, then (a variable we made and want to use called the) NameMonth := (becomes) (the word) December. Most important to remember now is that the := symbol should be read as ‘be-comes’. You may wonder what the deal is with all the colours, but text written in-side a calculation icon automatically gets different colours depending on what the meaning is in Authorware. String variables are displayed in purple, variables you made are green, system variables black and bold, and logical operators red. You don’t have to colour them yourself.

Page 10: Authorware Programming Guide for Reseachers- 2nd Edition

1. SO, WHEN DO I GET TO PROGRAM SOMETHING?

- 9 -

TIP: If you want to give a variable a number value, you can just type in the equation. E.g., WhichMonth := 12. But if you want to give a variable a word as its value, you must put this word between quotation marks. E.g., NameMonth := “December”. Authorware considers words that are outside of quotation marks as variables, not as values. So what do we enter to save the name? First of all, we have to make a variable. A variable means just this: something that can vary from time to time or person to per-son. In this case it is the name that varies from participant to participant. We want this variable to hold, or become, the name a participant typed in the text entry. To pro-gram this, type in the next short sentence in the calculation icon (Authorware will take care of the colours): NameSave := EntryText The variable we create here, NameSave, becomes the Text people just typed in in the Text Entry interaction. But Authorware will not automatically know that NameSave is a variable we want Authorware to store. Therefore, when closing the calculation icon, and clicking ‘Yes’ to save the changes to the calculation icon, the screen on the right appears. Authorware saves the new variable called NameSave in the program. You have the op-tion to give a short description of the variable. For short experiments you will remember what every vari-able means, but if you have over 100 variables in your experiment with similar names you might want to use this option to make things easier for yourself and for others who might use or modify your experiment later on. Type in ‘name of participant’ in the description field en press ‘OK’.

TIP: Give all variables that you want to save to analyze eventually a name that ends with ‘Save’. That way you won’t forget any in the end. Now we managed to Authorware remember a name the participant typed in, we also want to be able to use it to address the participant in the remainder of the experi-ment. We want the word the participant typed in to be displayed on the screen. In order to display a name, we first need to erase everything in the Display field. We can do this by using the other erase option of the Erase Icon: not to erase a specific icon, but to preserve a specific icon. Drop another Erase icon at the bottom of the flowline, and rename it to ‘Erase All’. Double click the erase icon on the flowline to open it. Again, you can choose whether to specify the items you want to erase or the items you want to preserve. TIP: An easy way to erase everything is to preserve nothing. Check the radiobutton next to ‘icons to preserve’. By leaving the field next to it empty, the Erase Icon will do exactly what you have told it: it will preserve nothing. Now close the erase icon. Click-and-Drag a new display icon to the flowline under the

Page 11: Authorware Programming Guide for Reseachers- 2nd Edition

1. SO, WHEN DO I GET TO PROGRAM SOMETHING?

- 10 -

erase icon and name it DisplayName. Double-click it to open. Here we want to write ‘Hello’ followed by the name of the participant. To use the current value of a variable in the presentation window, you have to write the name of the variable in between { } brackets. In this case, click on the Text icon in the Tools box and write somewhere on the screen: Hello {NameSave}! At first, this variable will have the value 0 (which is the standard initial value for vari-ables). If you run it and type in a name, Authorware will store that variable. At this point, the variable NameSave will have the name the participant filled in as its value, for instance “Daniel”. A variable can have every value, a word or a number. Run the Authorware piece. After typing in your name, the screen will display ‘Hello’ followed by your name. Congratulations, you’ve just programmed your first piece in Authorware! Now throw away the Authorware piece you just made. Close Authorware, and don’t even dream about saving it. That’s right, delete it, and erase it from the hard drive, gone. What you just made was the worst Authorware piece you’ll ever make and you’ll never want to see it again in your life once you’ve finished this course. Trust me on this one.

Page 12: Authorware Programming Guide for Reseachers- 2nd Edition

2. SO NOW WHAT?

- 11 -

2. So now what? First of all, I would take a short break and walk around, and just think of how many people you know that wouldn’t be able to do what you just did. Then I would take a moment to realise that even though what you just learned were some basic lessons in Authorware, you are still nowhere near to running your first experiment. There are some more icons left in the Icons box we didn’t look at (but we’ve covered the most important ones), another couple of important interactions we didn’t explore, and doz-ens of useful functions and variables we still have no idea of when to use. But more importantly, we haven’t even properly started building a piece yet. Let’s start with that first. Open a new file. Now let’s not get ahead of ourselves by throwing icons on the flow-line, let’s get a little bit more organized. In the menu bar, go to Mod-ify>File>Properties. Turn of the Title Bar and Menu Bar options. This will remove the title (the blue bar in the top of the screen) and menu bar (the grey bar directly below the blue bar) when your experiment runs, and in doing so removes the option for your participants to close the experiment. Then think about what screen resolution the

computers have your experiment will run on, because we can change this in the ‘Size’ drop-down menu. Close the file properties window by pressing Ctrl+Shift+D. Did you like the way the letters looked on the screen in the last experiment? I didn’t, and I think making the experiment look slightly better makes it a much more enjoyable experience for partici-pants. If you agree, take a minute to change the default style of the text. Go to Text>Define Styles. There you can change the font in whatever you like, (I mostly use Verdana size 13, Bold. You can use whatever you like, but with higher screen resolutions I advice to use a bold font, as your text will look a bit thin otherwise). One word of caution. The font isn’t a part of the program. This means the computers your experiment will be running on need to have the font installed! Keep this in mind. Choose common fonts, like Times New Roman, Arial, etc, which all computers have. This is not just an excuse on my part to dissuade you from using horrible childish, jiggly fonts: typeset problems can ruin your experiment. There’s still plenty of scope for horrible colours and styles, so don’t despair just yet!

SIDESTEP ON SCREEN RESOLUTIONS TIP: If you are running experiments in a lab where you can set the screen resolutions, I advice to set the size to 1024 x 768 (SVGA, Mac 17”). This gives you a lot of room in the presentation window and nowadays it’s the standard setting of most computers which saves you the time of having to change the screen resolutions of the lab computers. If you don’t know the resolution and can’t influence it, set the Size to Full Screen. This sounds rather treacherous, because Authorware does not scale the presenta-tion: if the resolution is higher (screen contains more pixels) your experiment moves to the top left corner of the screen; if resolution is lower, parts of the right

Page 13: Authorware Programming Guide for Reseachers- 2nd Edition

2. SO NOW WHAT?

- 12 -

Click modify and ok; the default font will now be changed. Authorware sometimes has trouble handling text styles, especially when copy-pasting between programs like Word and Authorware. It is good practice to use defined styles to make building an experiment easier for yourself.

Finally, before you do anything, save your experiment because you will often use this as a basis to build new experiments from, saving you the trouble of changing these settings every time you start a new experiment. Later on, if you insert your own but-tons for example, you can also do this in this basic file, saving a lot of time in the fu-ture. TIP: If you plan on making a lot of experiments, Save a file with all your fa-vourite settings and text styles and save it as ‘NewExperiment’. Use this as a framework to build new Authorware pieces to save time defining your settings. But remember to save it under a different name if you start building a new ex-periment, otherwise you’ll overwrite your layout file. Be sure to save your experiments regularly. Like all computer programs, Authorware can and will sometimes crash. Make a habit of saving your experiment after every difficult or time-consuming task you finished, and every time before you run your ex-periment.

SIDESTEP ON FONTS Authorware isn’t a text editor. There are fewer options, lay-out styles and symbols for your text in Authorware. If you copy-past text from your text editor (most likely Word) Authorware will display a RTF import screen:

No footers, headers, columns or other lay-out will be imported, so just click ‘ok’. Furthermore, Authorware does not know certain symbols, like , ∏ or ⅛. The easiest way to show these symbols on the screen is called ‘font mapping’. Press print screen, open Paint, press Ctrl+v, and save the symbol as a small picture. Then import the picture in Authorware and use it as a letter if you really need the symbol.

Page 14: Authorware Programming Guide for Reseachers- 2nd Edition

3. BOOOOOOOOORING

- 13 -

3. Boooooooooring My apologies, you are so right. Let’s make another Authorware piece. Imagine you are a social psychologist who is single and is not just looking for data while perform-ing experiments, but looking for a date as well! You have to ask the gender of the participant anyway for analyzing, so why not drop in a question asking for someone’s phone number? But how do we end up with a list of male-only (or female-only) tele-phone numbers? Well, here we go. This piece will consist of 2 steps: first of all we have to ask the gender of the partici-pant, then we need to ask for a telephone number but only if a certain condition is met (being male or female). First, place a display icon on the flowline and name it ‘Question’. Double-click the dis-play icon to open it. Now go to the taskbar, go to View and select ‘Grid’. This shows a grid on the presentation screen (only visible while programming) to help us put text and objects on the right place. Aiming for the 4th cross from above and the 6th from the right, type in: What is your gender?. Ctrl+1 close the presentation screen and drop an interaction icon under the display icon and name it ‘Gender’. Place a map icon next to it (accept the default ‘button’ response type). TIP: If you make a mistake, like pasting something on the wrong place, acci-dentally moving an object or deleting something you didn’t want to delete, you can undo this by pressing Ctrl+Z. Double-click on the button interaction icon (and notice how it resembles a button). We want to make 2 radiobuttons (round checkboxes) where participants can tell us what their gender is. First, for some more visuals, click the button next to ‘cursor’

and choose the hand cursor ( ) on the bottom of the list. Now, when participants hover above the button, the cursor will change into a hand. This will show them they can interact with the button by pressing it, and these small things will guide partici-pants through interactions. Change the title of the button in ‘Male’. This will also be the label that will be displayed next to button when running the experiment, keep this in mind! TIP: If you want to change or hide the label in a button, click ‘Edit…’ and in the drop-down menu ‘Label’ change ‘Show Label’ into ‘None’. Go to the response tab, and set the branch to ‘exit interaction’. There are several ways to ask a participants gender, with normal checkboxes, normal buttons and other interaction types, but this will be a better learning experience, so we will go for the radiobuttons. Click on the ‘buttons’ button on the left of the proper-ties screen. A new window opens, scroll all the way down and choose the button on the end of the list (the native platform radio button), then click ‘OK’. If you’re into aes-theticism you can even change the font of the label here, but since we are only inter-ested in scoring some phone numbers we won’t bother. This button is done!

Page 15: Authorware Programming Guide for Reseachers- 2nd Edition

3. BOOOOOOOOORING

- 14 -

Now because we want one almost exactly like it underneath it on the screen but then named ‘Female’, select the ‘Male’ button and copy it (Ctrl+C). To do this, we need to place a copy of our button next to the one we just finished. To do this, first the white hand (which indicates your location on the flowline) has to be pointing to the right spot. Click somewhere to the right of the ‘Male’ button and the hand will be on the right spot, as you can see in the picture here to the right. Then press Ctrl+V and the second button appears. Copy-pasting parts of your experiment saves a lot of time. TIP: The only thing we want to change in this button (for now) is the title. You don’t have to open the button for this, but can directly change the title by changing the labels to the right of the flowline. Change the second title to ‘Female’, and open the Control Panel by clicking on the

icon in the task bar. The Control Panel allows you to stop the experiment and pause it while the program is running. Why this is practical will become clear when you Run the program. Do so now.

As you will notice, the screen is (depending on your settings and the screen resolu-tion) completely filled by the presentation window. That’s good, because you want

SIDESTEP ON RUNNING YOUR PROGRAM The bigger your experiment will become, the longer it will take to go through the whole piece to check if something looks good or works after some adjustments. However, you can tell Authorware where to start running and where to stop. TIP: By placing the white flag in the flowline on the position where you want Authorware to start from, and the black flag on the position where you want Authorware to stop you can run a small part of the piece.

Be aware that when running the piece from a specific place on the flowline, the variables in your program may not have the values you want them to have to run correctly. For example in the flowline to the right, Authorware will most likely not know which path to take in the decision icon (see next page for what a decision i i ) if th i bl th t t ll A th h t h th i iti l l 0 Y

Page 16: Authorware Programming Guide for Reseachers- 2nd Edition

3. BOOOOOOOOORING

- 15 -

you participants to see it that way (moreover, participants will no longer be able to tamper with icons on the desktop this way). It’s bad as well, because now you lose access to the underlying menu and taskbar. At least we have the Control Panel to help us a little. TIP: If your computer allows it, it’s is very practical to increase your screen resolution to one step better then that you are programming the experiment in. This way you will see all menu and taskbars when test running the program. Ok, so the radiobuttons are not exactly where we want them. To replace interactions in the presentation window, you first have to pause the program with the button on the Control Panel. Now you can drag the buttons across the presentation window. Put them somewhere under the text. TIP: If you really lost the button underneath the menu bar, press Ctrl+Shift+M to hide or display the menu bars. When the visual aspects are ok, let’s take care of saving the variable. Put a calcula-tion icon inside the map under the Male radiobutton, name is ‘GenderSave’ and open it. In it, we want to give the variable GenderSave a value of 1 if the male button is clicked (we will give the variable a 2 if the female button is clicked). To do this, type in: GenderSave := 1 Close the icon (click yes and ok to save the variable as in the previous example) and then copy-paste the calculation icon in the female map too. Open it, change the GenderSave value from 1 to 2 and we’re done! Put an erase icon underneath the interaction (again with preserve nothing) and name it ‘Erase All’. Now for our tele-phone number... There is another important icon when making an interactive program we haven’t used

yet. It is called the Decision Icon ( ), and it makes a decision on which branch of the flowline the program will display on the presentation screen. Yes, the flowline can be divided into several flowlines, and decision icons can decide which road to take. Of course, programs run by a computer can not really choose, but let’s prevent get-ting carried away with philosophical discussions and just drop one of these Decision Icons on the flowline, and go with the flow. But which flow? Rename the decision icon ‘MaleFemale’. Double-click it to open. A very important function of decision icons is their ability to repeat, or loop, a piece of program. Though we won’t use that here, it never hurts to know where to find this function. We are more interested in the function Branch. There are (as always in life) several op-tions. Sequentially means that the first time the flowline encounters the icon the first path is taken, the second time the second path, etc. This is useful when you combine this with the repeat function. We are interested in the ‘to calculated path’ option, where Authorware uses a variable to calculate which path to follow. Did you notice the text field underneath the ‘to calculated path’ option became active (turned white)? This is because we need to fill in the variable Authorware will use to calculate which

Page 17: Authorware Programming Guide for Reseachers- 2nd Edition

3. BOOOOOOOOORING

- 16 -

path to take, in this case ‘GenderSave’. Just type it in there.

So, what did we just do? We told Authorware to choose a path based on the variable GenderSave, so if GenderSave = 1, then take path 1, and if it is 2, then take path 2. But where are these paths? Well, we first have to make them. We do this by Click-and-Drag-ging 2 map icons to the right of the decision icon, similar to how interaction icons work. First drop one and rename it ‘Male’ then drop another one and rename it ‘Female’. Look at the picture here to the right to see the flowline. The map nearest to the decision icon (notice the C inside the icon, for calculated, instead of the S for sequential) is path 1, the further path is path 2. That’s why we had to put the two paths in this order: they correspond with the values of GenderSave, where 1 is male and 2 is female. Actually, without you knowing this, this is the reason we didn’t give the GenderSave the value 0 for male and 1 for female: so we could use them in this calculation icon without have to use extra variables and programming. Note that if a To calculated path variable has a value of zero, Authorware will simply bypass the Decision path altogether. Authorware therefore will not take any path but will just continue on the flowline. (Sometimes, variables aren’t this easy to use in decision icons. Then you need to put a calculation icon on the flowline and program your way around the prob-lem.) So what do we do with these two paths? Well, we put our telephone question in one of them of course! If you have a preference for a male date, ask a phone number in path 1, if you prefer a female date, put the question in the second path. Put in a dis-play icon with the text ‘Would you please type in the 10 digits of your phone num-ber?’, put an interaction icon underneath it, a map next to that (choose the text entry option) and a calculation icon in the map. Open that and put the following in it to save the telephone number: TelephoneNumberSave := NumEntry. NumEntry is al-most the same as TextEntry (both could be used here) but NumEntry can only store numbers, and it is useful to use NumEntry when your are only interested in numbers. Keep in mind that it is NumEntry, and EntryText (so not TextEntry). Double-click the interaction icon (with the question mark in it). The presentation win-dow will open. Double click the text field. You will see the properties interaction text field (remember we were here in the previous example but didn’t change anything?) and in the lay-out tab set ‘10’ as the character limit (since most phone numbers contain 10 digits). This is actually a very advanced thing to be looking at right now, but it is a good exam-ple of how you should always browse around all the options when making an interaction just to be sure you didn’t miss anything. Until you really know the program, don’t be afraid to double click on

Page 18: Authorware Programming Guide for Reseachers- 2nd Edition

3. BOOOOOOOOORING

- 17 -

everything to see if the program has some setting you want to know of. Now we really are done! Run the experiment and chose the male radiobutton, and run it again and chose the female button and notice the difference. By the way, you might even be able to use this programming for other things than asking phone numbers, like giving a different text in different conditions, asking different questions, giving different kinds of feedback depending on the score of a participant, and lots of other interactive things! Actually we can improve the radiobuttons. The small problem with these is that the participants cannot correct their mistake if they clicked too fast and missed the right button. Ok, I might be too concerned, but if we make it the right way this time, we’ll be able to use it over and over again. Drop a third button next to the 2 radiobuttons. Name the button ‘Continue’. Standard, Authorware will also make it a radiobutton without asking first because it thinks that’s what we want. However, that’s not what we want, so double click the last button icon (NOT the map icon) and click on the ‘buttons…’ option. Now change the radiobutton to a normal grey rectangular button. We want participants to check the male or female button, and then press continue. To do this, go to the properties, response tab of both radio buttons, and change the branch to try again. TIP: You can change the ‘Branch’ setting by holding down the Ctrl key and clicking just between the button icon and the at-tached map (see the line in the picture to the right). See how the flowline changes. Only the continue button will allow the participants to exit this interaction. But they should only be allowed to exit the question after answering it, so in the continue button response tab, in the text field next to active if: type: GenderSave > 0. Only if they answered the question and the variable value is either 1 or 2 will the button be active, or will partici-pants be able to click on it. TIP: By checking the Hide When Inactive checkbox, the button will only ap-pear when your participants are able to press it. This will provide participants with a visual cue of what to do to continue. Now this leaves us with 1 small problem. Run the program, and try to click on the male button and on the female button. As you will see, it is possible to select both radiobuttons. We would prefer that if one button is pressed, the other button is un-checked automatically, and vice versa. This isn’t to difficult, if you know the right func-tion to type in. In the calculation icon in the male button, underneath the GenderSave := 1, type: Checked@”Female” := False This programming will make the state of the radiobutton named Female false, or un-

Page 19: Authorware Programming Guide for Reseachers- 2nd Edition

3. BOOOOOOOOORING

- 18 -

checked. This is one of the reasons we name icons: so we can control them with spe-cial functions we program in calculation icons. However, if you close the calculation icon, Authorware will give you a warning that more then 1 icon are named Female, in this case, the Map icon and the button icon. If you use programming like this, make sure that you use unique icon names, so change the name of the male and female map icon to ‘MaleMap’ and ‘FemaleMap’. The programming will now be accepted. In the female radio button, type: Checked@”Male” := False That’s all. Now you have a perfectly working piece of Authorware that asks the gen-der of participants. So, now we are done, you are wondering if you have to delete this too. The answer is no. The reason is the question where you ask the gender of par-ticipants is a very common question, so you can use that in your experiment. But the rest of the program isn’t really much use, so you can delete that part.

Save the file by clicking the Save button in the menu bar, or go to File>Save As… Name the File MaleOrFemale or anything else you think is convenient, and you’re done! By creating small Authorware pieces you will use often (for example the standard file to start building experiments we made above) you can easily copy-past them into a new experiment you are making. The more experiments you make, the more you will see you will be mainly adapting existing experiments.

Page 20: Authorware Programming Guide for Reseachers- 2nd Edition

4. HEY, THIS IS REALLY A LOT OF WORK!2. SO NOW WHAT?

- 19 -

4. Hey, this is really a lot of work! Right now it is. But as you get the hang of the program, it will take you about 3 min-utes to build the previous exercise. Really. And anyway, now you have it, it will only take 5 seconds to copy paste it in your new experiment. So let’s build another com-mon question, this time asking the participant’s age. First, start by opening your ‘NewExperiment’ file and Save As… AgeQuestion, then drop a display Icon on the flowline and rename it ‘AgeQuestion’. Open it, and type: ‘Enter your age and press Enter’. TIP: Always use clear instructions in your experiment. That’s why you have to write: press enter (maybe even show the symbol which is on the enter key on some keyboards; some participants may not know what the enter key is, or even what the ‘ANY’ key is if you tell them to press any key to continue. They exist, trust me, I’ve met some of them myself). Close it by pressing Ctrl+1 and underneath it on the flowline, drop an interaction icon and name it ‘Age’. Next to it on the right, drop a map icon and choose the text entry. Double click the text entry (not the map) to access the Properties window. Now we want to make sure that participants can type in their age, but only their age. A standard text entry works like this: a participant types something on the keyboard, and then presses the Return key on the keyboard and exits the interaction. When we would use the standard text entry, participants could type in #d and press return, and we wouldn’t have their age. Now this may sound like I have a problem with trusting my participants to do as they are told, but that’s not the point. We are using Author-ware because we can control the experiment: so why not use the control we have? We can tell Authorware which entries are the ones we are looking for, and to exit the interaction only if a correct entry has been given by a participant. We have to type in all possible answers in the title field (where right now the word ‘Untitled’ is written). For instance, if we would type in 35 in that text field, Authorware would only exit the interaction if a participant would type 35 and press return. Because we want partici-pants to be able to type in different answers, we have to separate these answers with the “|” symbol, which means ‘or’. For example, if we expect all of our participants to be somewhere between the ages of fifteen and 85, we would type: 15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85 Yes, you can type in that many symbols in the text field. And yes, that looks like a lot of work but I just did it and so can you (and when we’ve discussed conditional inter-actions, you will learn a much easier way to do the same thing). This literally means: fifteen or sixteen or seventeen, etc. Set the branch in the response field to Exit Inter-action. Inside the map icon, put a calculation icon, name it ‘SaveAge’ and in it type:

Page 21: Authorware Programming Guide for Reseachers- 2nd Edition

4. HEY, THIS IS REALLY A LOT OF WORK!2. SO NOW WHAT?

- 20 -

AgeSave := NumEntry Close it and save the new variable named AgeSave. If the participant enters an age between 15 and 80 the age is saved and the participant will exit the interaction. What we have programmed will now look something like the flowline above. Now we have forced participants to write only certain specific answers, it would be nice if we could let all participants that typed in a wrong answer know they are trying to enter something that does not belong to the possibilities. If you won’t tell them they are doing something wrong, how will they ever know? For this we need to build in a catch all net where all other entries are judged. We made something like this in the first exercise. Drag and drop another map icon to the right of the existing text entry map. Set the branch to ‘Try Again’ and replace the ‘Un-titled’ with the wildcard *. This meant any text entry, remember? Open the map icon attached to it. If anyone fills in one of the options not allowed and presses return, the flowline will flow through this icon and let them try again. But the participant can’t tell this is happening because nothing on the screen is changing. The program just doesn’t continue. But if we drop a display icon on the flowline in the map, open it and type the sen-tence: ‘Your entry is not one of the possible answers, please try again.’ that would make things much clearer. The participant will see this text appear after he pressed return and can correct his mistake. Put the display icon in the new map as explained.

Run the experiment and type in ‘1’ and then press return. You will see the sentence appear on the screen. You can drag it to a better place if neces-sary. You can even change its colour: double click the sentence, and when

highlighted (you can see this by the 6 white squares appearing around the text) se-lect a red colour from the colours in the Tools bar so it will stand out more. What would happen if the catch all text entry and the text entry with limited answers would change places? You can try it out. You will notice that whatever answer you type in, you will always see the sentence that you typed in the wrong answer. This is because the flowline first encounters the catch all text entry icon (the flowline goes from top to bottom and left to right in interaction icons) and that icon tells Authorware to let the participant try again. The second text entry icon is ignored. This shows it is important to keep track of where the flowline will go first to prevent mistakes. TIP: Always keep in mind the flowline encounters icons and performs the commands from top to bottom and left to right. Maybe you’ve noticed something else. When we place two buttons to the right of the interaction icon, we saw 2 buttons on the screen. Now we placed 2 text entries to the right of an interaction icon, but we only see one text entry. Why is that? The answer simply is: because. That’s how Authorware works. If you want to create several text entries on 1 page, it will get a lot more complicated fast. We will deal with this prob-lem later on in chapter 12.

Page 22: Authorware Programming Guide for Reseachers- 2nd Edition

4. HEY, THIS IS REALLY A LOT OF WORK!2. SO NOW WHAT?

- 21 -

For now, let’s just change some small things before saving this file. Double click the interaction icon itself (with the question mark in it). You’ll see a black dotted square

like this: This is the text entry, with the standard marker (the black triangle) to indicate where people have to enter the text. To make it look a little better (or that’s what I think, but you can choose how you want it to look yourself) let’s remove the triangle and in-stead draw a black square around it. In the tools bar, select the rectangle draw func-tion. Set the mode to transparent (otherwise the text entry will be covered by the rec-tangle). And draw a box around the dotted line. There are different modes for objects in the display screen (see picture). Opaque creates a white rectangle behind all objects, covering anything be-hind it in the display screen. Transparent shows only the objects, but erases all white pixels (note that sometimes pictures you copy past from somewhere else will still have a white fuzzy border around them in trans-parent mode because the pixels are actually not white but slightly grey). These two are the most common, and most of the time the only practical, options. Notice in the screen on the right how the Action Key(s) field has ‘Return’ in it. This means that if participants press return, they will exit the text entry interaction. Whereas that is a practical thing if you want them to fill in just one number, it will be very unpractical if you want participant to write down a short story where they want to make paragraphs in the text by pressing return. In that case, this standard setting of Authorware will be very unpractical. If you want to enable participant to press the Enter key on the keyboard, assign another key to the Action Key(s) field that they will not use, for example type in Break, so that they will exit the text entry interaction when pressing the Pause/Break key on the keyboard. Note that keeping the field empty will not work, since Authorware will reset the field to Re-turn! Don’t forget to provide them with a button to exit the interaction and to put the text entry interaction to continue. If the rectangle you just made is still red, change the colour back to black. Now with the arrow cursor, double click the dotted text entry field to uncheck the option to dis-play the Entry Marker in the interaction tab. That’s it!

Page 23: Authorware Programming Guide for Reseachers- 2nd Edition

5. MAYBE I PREFER PAPER AND PENCIL TASKS2. SO NOW WHAT?

- 22 -

5. Maybe I prefer paper and pencil tasks What we’ve just done may seem like a lot of work for a simple question, but remem-ber, we are building parts we will be able to use for every experiment we are ever going to do. Now it might be some work, but the next time we need it we will have it ready to use. So let’s build something else we will use often; Text Displays. Instruc-tions will be a big part of your experiment and you want your participants to read them carefully. It helps if the layout of the text makes it easier for participants to read all the information. Open your NewExperiment File so you will have all your favourite settings ready (and to make sure the text display we are going to make will look good on the screen eventually). Start with dragging a display icon to the flowline and rename it ‘Text’. Double click to open it. Now this will all be a matter of personal taste, so feel free to make the page look the way you think is best. It’s still advised to leave a white border around your text of about 4 cm and to place your text somewhat centred on the screen. Type in: ’Welcome, and thank you for participating in this experiment. Please read all instructions carefully. Turn of your mobile phone. If you have any questions, please ask the experimenter. The experiment will take about 10 minutes. Click the ‘continue’ button to continue.’ Change the layout however you like using the arrow cursor. More text layout option (like centring the text, justifying it, or blending it slightly more in the background with the anti-alias option) or found in the Text menu in the menu bar. Test Run the experiment to see how it looks. TIP: If you want to offer a lot of text on the screen, you can also use scrolling text. To choose scrolling text, select the text and in the menu bar choose Text> Scrolling. You can change the height and width of the scroll field. Even though this function can be useful, I would advise you to pre-sent the text on different display screen in text fragments that are easier to read. TIP: Keep the text in Text Displays restricted to 4 or 5 lines per page. This will make reading a lot of information easier for participants. Let’s try something new here. Up until now, we’ve always worked with (display) icons that get deleted immediately after the participant has seen them. But in some cases, we want to keep an icon for longer, perhaps even for the entire experiment. In this example we’ll find out how this works. Authorware shows the content of each new display icon on top of the content of pre-vious display icons, and we can use this to our advantage. In some cases, this is the last thing we want (remember the example about overlapping text being unread-

Page 24: Authorware Programming Guide for Reseachers- 2nd Edition

5. MAYBE I PREFER PAPER AND PENCIL TASKS2. SO NOW WHAT?

- 23 -

able?), but it can be a useful tool as well. As long as we don’t delete the first icon, it will remain on the screen, so this is a perfect way to make a background for our ex-periment. Black text over a white background really is far too boring for the partici-pant, and even the slightest enhancement will be much appreciated by your partici-pants. The easiest way to change the appearance of your experiment is to change the overall background col-our. In the task bar, go to Modify>File>Properties and click on the square next to BackGround (see picture). If you ever decide to change it, change it for a light colour to keep your text visible. For the moment, keep the background white: we’re going to use the Tools bar to make a nice background ourselves.

Let’s give it a try: drop another display icon on the flowline, above the ‘Text’ icon we just made, and name it ‘Background’. Don’t put it underneath the ‘Text’ icon: your background will be presented on top of the text if you place them in this order, and as a result your participants won’t see the text. Now open your new display icon, this is a good chance to use some of the other icons in the Tools bar. We already discussed the Text and the Arrow options, and we learned how to change the colour of text. But the Tools bar features far more options, and will allow you to draw squares, circles, figures and lines as well. Now I just want you to go ahead and build a nice back-ground using these options. You can change the colours of your figures as well to make a more appealing composition. Try not to make your background too busy, or it will distract too much from the text participants have to read. This is also a good time to learn another important trick: you can bring parts of your background forward or send them backward within one display icon by first selecting the figure you want to

SIDESTEP ON WORKING WITH SEVERAL OBJECTS IN 1 DISPLAY ICON Sometimes, you will put several text fields together with some pictures in a dis-play icon. If you want to do this and keep things organized, here is some advice:

• You can select all the objects on the screen with Ctrl+A.

• You can select the next object if you have an object selected by pressing the Tab button.

• You can select several objects within the display icon (for example to move

them together) by holding down the Shift button while clicking on all the items you want to select. Alternatively, you can select all objects with Ctrl+A and de-select the ones you don’t need by holding down the Shift button.

• You can group several objects together, so they can not be moved sepa-

rately but will all be moved together. Select all the objects you want to group together, and press Ctrl+G while in the display icon.

Page 25: Authorware Programming Guide for Reseachers- 2nd Edition

5. MAYBE I PREFER PAPER AND PENCIL TASKS2. SO NOW WHAT?

- 24 -

change in the display screen. The white squares on the outer edges will indicate you have selected the figure. TIP: To change the way objects overlap on the presentation screen, in the Task Bar, go to Modify>Bring to Front or Modify>Send to Back. The figure you selected will now be moved to the top or bottom layer of your background. Once you’re happy with your background, press Ctrl + A to select everything, and then Ctrl. + G to group everything into a single figure. Your background is complete! Now for the text. Open the next Display Icon, ‘Text’. Now it’s possible that you need to change the colour of your text to make it stand out from your background, espe-cially if you’ve made a background using dark colours. It’s also a good idea to change the Mode of the text at the bottom of the Tools bar. Select all your text and set the mode to Transparent. This way, the text won’t have an ugly white area surrounding it which will cover your background. Now we’re done! Now there are several ways to show the next screen. We want participants to have enough time to read the text, so it’s best to let them tell the program when to show the next piece of text. So drop an interaction icon on the flowline (and rename it Con-tinue) and a map icon next to it. Now, through what kind of interaction do we want participants to tell the program to continue? The most common options are:

• Button: let them press a button displayed on the screen with either the mouse or the keyboard.

• Key press: Press a specific or any key on the keyboard.

Again, this is just what you prefer. I recommend using the button interaction for 2 reasons: first, it let’s participants decide if they want to use the keyboard or the mouse, instead of forcing them to use the keyboard (at least, if you’ve programmed the button to accept a certain key as a response as well), and second, a button with ‘continue’ is pretty self-explanatory, whereas a key press interaction always need an explanation on the screen (like ‘press the space bar to continue’). So let’s choose the button and rename it ‘Continue’. Remember, as with the radio button, names you give a button will also be displayed in the presentation window; with radio buttons as a label next to the button, with normal button as a label on top of the button. Double-click the button icon to adjust the properties. First, for the visual aspects: we will change to cursor to the hand again, so participants will see the cursor change when it’s over the button. Then, instead of making the key only clickable with the mouse, assign a key on the keyboard to it. Type in ‘Return’ in the text field. (Although you can also write ‘Enter’, Return is the word used in the programming language in calculation icons for the return key, so it’s best to learn from the start to write Return.) In the Re-sponse tab, set the Brach to Exit Interaction (because we want them to exit the inter-action and go on to the next display screen). Ctrl+1 close the presentation window.

Page 26: Authorware Programming Guide for Reseachers- 2nd Edition

5. MAYBE I PREFER PAPER AND PENCIL TASKS2. SO NOW WHAT?

- 25 -

Now comes the good part of displaying several display icons after each other. We

want to erase the text before we present another screen. Place an erase icon on the flowline. We could just Preserve nothing, like we’ve done before. But we want to pre-serve the background, so that won’t do. Now there are two options: we can add Text to our Icons to erase list, or add Back-ground to our Icons to preserve list. The

latter is especially useful if you wish to erase a lot of things at the same time, the for-mer is useful if you only wish to erase a single thing and preserve a number of oth-ers. You choose, and name the Erase Icon EraseText or PreserveBackground, de-pending on your decision. Remember that the figure you see in the background is the one you opened last (the text). If you wish to Preserve the background, you must first open this display icon again, close it, and then go to the Erase icon. Now you can add the background to your list of Items to preserve. TIP: If you want to add an item to your Erase/Preserve icons list, open and close the Display icon it’s in first. Authorware will only show the item you opened last in the Display screen when you edit an Erase icon. You might think this is a good time to place the continue button on a better location on the screen, but if you click it now it will be added to the items the erase icon has to erase, so only click on the text. As in the picture to the left, you will see the Text dis-play icon in the screen with items to erase. So don’t we need to erase the button then? No, and the reason is that the button will disappear automatically when clicking on it, unless you make it perpetual, but that is an option rarely used. Close the erase icon and presentation window (and quickly look at the ‘Erase’ option on the button properties screen I was just talking about). Then open the control panel. TIP: You can open the control panel by pressing Ctrl+2. And yes, Ctrl+3 and Ctrl+4 are also shortcuts, but they are pretty useless. Only Ctrl+1 to open and close the presentation window and Ctrl+2 to open and close the control panel have real practical value.

SIDESTEP ON NAMING OBJECTS As you might have noticed, I always make names as clear as possible, don’t use spaces in between words and use a capital letter for every separate word. This is only my own system and you can use whatever you want as icon and variable names. Just keep the same style, use names that you understand if you read them again after 2 months (so not ‘nttql1’ for the number of times through question loop 1, or ‘q1’ for the first demographic question, but rather LoopTimes1 and Country-Birth. If you choose to use my recommendation of adding ‘Save’ to the end of vari-ables you want to save and analyze, this would become LoopTimes1 (because this will probably be a variable only used to make the program work, and one you will not save to your dataset) and CountryBirthSave (because you will want to ana-lyze this answer later). Note that custom and system variable names are not case sensitive, so IconTitle is the same as iContITle.

Page 27: Authorware Programming Guide for Reseachers- 2nd Edition

5. MAYBE I PREFER PAPER AND PENCIL TASKS2. SO NOW WHAT?

- 26 -

Run the program you just made. Before hitting the continue button, pause the pro-gram with the control panel and click-and-drag the continue button (remember you could only move the buttons while pausing and move the text even while running?) to the right bottom of the screen, somewhere where it looks good and isn’t to much in the way. Run the program again (or continue the program, by clicking instead of

). The text will disappear whether you press ‘Return’ on the keyboard or click on the button, but the background will remain. Close the presentation window. Now something I like to do is to build in a short pause between the different text dis-plays. This way, it is very clear the text changed for participants and well, I just think it looks good. This is another chance for us to use the Wait Icon, and to do something more interesting with it than we have before. Drop one on the end of the flowline and open it. First, click away all the options: No, we don’t want to wait for a key press. No, we don’t want to show the button with continue on it. But hey, didn’t we just make a button titled continue that worked on a key press? And here is a ready made one! Yes, that is true, and right now, they do the same thing (except for showing the nice visual hand cursor above the button). But the button we made has one important advantage: we can make it look much better then it looks now. We can (and will) change every aspect and place calculation icons inside the map whereas this Continue Button is standard and can not be changed. And the button we made was much more educational, don’t you think? Now, back to our wait icon. What time limit do we want before the flowline goes on

with the flow? Usually 1 second works fine. So we could type a 1 in the ‘Time Limit:’ window and close it and it would work. But instead we’ll do something a bit more creative and write down the word ‘IconTitle’ in the

field, as you can see on the right. IconTitle is a system variable, and if you use it, Au-thorware will set the value of the variable to the name (or number) that is in the icon’s title. So now close the Wait Icon and rename it to ‘1’ as you can see in the small flow-line picture to the left. So why did we do that? Well, copy-past this icon and place it in be-tween the text and interaction button. Rename it to ‘5’ (see the flow-line to the right). By renaming it, you told the wait icon to wait 5 icons instead of 1. Now it will take 5 seconds before the continue button will appear, so participants have to read the text for at least 5 seconds before they can continue. It saves us from clicking a cou-ple of times and learns us how we can use system variables to our own advantage. Of course this is a simple example and the advan-tage is rather small, but it is still a lesson learned and will get us more acquainted with system variables, something we will deal with later on in chapter 7. Now, select the entire flowline with the mouse. Press Ctrl+G. TIP: Ctrl+G will Group all the separate icons together in a map, helping you

Page 28: Authorware Programming Guide for Reseachers- 2nd Edition

5. MAYBE I PREFER PAPER AND PENCIL TASKS2. SO NOW WHAT?

- 27 -

to keep the flowline organized. Ctrl+Shift+G will ungroup a map icon. Name the map ‘Welcome’. Now copy the ‘Welcome’ map, and paste a copy under-neath the original welcome map (Remember to first click at the right spot on the flow-line so the white hand will appear at the right place) and rename it ‘Intro’. Open the map and open the display icon. Select the Text cursor in the Tools bar. Select the text, delete it and type in (or paste) the new text. TIP: By re-using and copy-pasting the same text display, the text will always appear on the same spot on the screen and make your experiment look good. Now run the experiment. Be sure to save this file, you can copy-past from this for-ever. Well done!

Page 29: Authorware Programming Guide for Reseachers- 2nd Edition

6. SO AM I PRETTY GOOD NOW, OR WHAT?

- 28 -

6. So am I pretty good now, or what? Well, you are seriously getting the hang of some basics here. All the text parts of your experiments will run smoothly I think, although you might want to spice up the visuals now and then. But that can wait for the moment, a more important point is that we haven’t really made a questionnaire yet, and you probably will want to use one in your research. So let’s make one right now. It is going to be a pretty difficult and long lesson, so be prepared. Open your self-made NewExperiment file and drop an interaction icon on the flowline. What, no display icon? Well, you could, but we can also display text in the interaction icon and that is what we are going to do now. Double-click it and with the Text cursor type: ‘how do you feel right now?’ on the upper half of the screen. We want partici-pants to answer this question on a 7 point Likert scale, so let’s build one. Let’s first

build the visual part (in the icon on the flowline, remember?). We want to have the numbers one to seven placed in black squares where the partici-pants can click on. Although we can import pictures in Authorware (we will do that later) you can also draw simple figures yourself. In

the Tools bar click on the lines part and select a slightly fatter line. Then select the Rectangle icon in the Tools box (see picture on the right). With this, you can draw a rectangle on the screen. Click and drag on the display screen to draw. The shape we are looking for is something like this: TIP: To draw a perfect square with the rectangle option, hold down the Shift button while drawing. Now we need 7 of these, so switch to the arrow cursor and click on the square you just made. Press Ctrl+C and Ctrl+V, copy-paste, and now we have 2. But they are not really nicely aligned, are they? So, select one of the squares, and drag it so it overlaps the original one, so you know they are on the same horizontal height. TIP: If you are having trouble positioning the squares on top of each other, use the arrows on your keyboard to move objects 1 pixel at a time. TIP: If things don’t move around fast enough with the arrow keys, hold down the Shift button while pressing the arrow keys. Now they are on the same height, now move one to the right so they look like this:

Page 30: Authorware Programming Guide for Reseachers- 2nd Edition

6. SO AM I PRETTY GOOD NOW, OR WHAT?

- 29 -

Now select both of them. You can either do that by dragging a selection field around them with your mouse or by holding down the Ctrl key and click on both, but in the last case there is a small chance one will move. When they are both selected, copy past. Now we have 4. Put the 2 new ones on the same height. Select all, copy paste, put the new ones on the same height (and don’t forget to de-lete one because we only need 7) until your square sequence looks like this:

In order to make this a 7-point scale, well, we obviously need to add the numbers 1 to 7 in the corresponding squares. Remember to set your Mode to Transparent in the Tools bar, otherwise higher layers may obscure lower ones. In the case of our numbers, in the Opaque mode these will have a white background that may partially obscure your square. Set the Mode to Transparent to remove the white background for text. We now have the visual part of a 7 point scale, but at this moment it doesn’t work like a 7 point scale. We want a click by the participant in one of the squares to register as a specific response: the number on top of the square. But how can we make Author-ware register a click at a specific location? We will do this by using a new interaction type, the hot spot. Close the Presentation screen. Now drop a map next to the inter-action icon and chose the Hot Spot option (and notice how the symbol now resem-bles a small square). Double-click the hot spot icon to change its properties. On the response tab, set the branch to ‘Continue’. This way, the participant will not exit our

interaction and continue with the flowline after clicking on the 1 to 7 squares, which enables them to change their answer. However, we will have to build in another way to exit this interac-tion instead. We will use a normal ‘Continue’ but-ton for this. If you want to enable participants to

answer your questionnaire also by using the keyboard, go to the hot spot tab and you can type 1 into the field ‘Key(s)’ (see picture on the left). However, some people like to force participants to use the mouse because it slightly slows them down and there-fore makes them think a little longer about the questions. You decide. Name the hot-spot ‘1’ and close the properties screen. Now we've just made our first hotspot. Once we've put it at the right spot, Authorware will be able to register a click by the participant on one button. But we must make it clear for the participant as well that they've clicked the button, and that the Author-ware has registered their response. To do this, open the map icon underneath the hotspot icon and open it. Put a display icon on the flowline, followed by a calculation icon. Now, what will happen is the participant click on the hotspot associated with this icon? Authorware will follow the flowline to the corresponding map, go to level 2 and follow the flowline inside the map, and therefore to the icons we put into the map. Now we want to show participants a cross inside the square they've clicked, and we want to save the participant's response as a variable whose value corresponds to the number they've clicked. So we need the flowline to encounter a display icon (and show it) and then a calculation icon (and perform all programming in it). Drop these

Page 31: Authorware Programming Guide for Reseachers- 2nd Edition

6. SO AM I PRETTY GOOD NOW, OR WHAT?

- 30 -

two icons onto the flowline inside the map. We don't want Authorware to continue to the next question after a response: maybe the participant will want to change his or her answer (this is why we've set the Hotspot branch to continue). First things first: let's make a cross through the square a participant just clicked on, so the participant knows what the selected choice is. In the display icon we will draw a cross with the diagonal line function in the Tools box. TIP: To draw a straight line or a diagonal line, press Shift while drawing. Make a cross; don’t worry to much how it looks, but the closer it resembles the one on the right, the better. Close the screen; name the display icon ‘Cross’. Now we can show to the participants that they've actually clicked a square correctly. However, we must also save this response if we ever want to get to analyze some data. So on to the calculation icon - rename this to ‘1’. Remember the IconTitle trick we pulled with the wait icon? We will do the same thing here. Open the calculation icon. Here we simply type: Answer := IconTitle ‘Answer’ is a new variable where we will save the answer to the question. If the par-ticipant clicks on the hotspot 1, Authorware will now display the cross and save the answer as the IconTitle, in this case 1 (Naturally, you can also just type in Answer := 1 if you prefer). Close the Calculation icon (and accept the newly created variable ‘Answer’). This map is done, now we would like to have 6 more. Copy the map, place the white indicator hand to the right of the map, and press Ctrl+V six times to paste six more hotspots next to it. What you see on the screen will resemble this:

Authorware can only show 5 folders next to an interaction icon; when there are more, it shows this scroll screen. In the scroll screen to the right, scroll back to the top of the list and select the top icon (which is the icon most to the left, closest to the interaction icon). It is the hotspot associated with the square with the 1 in it, so the name 1 is OK. Press the Tab key on your keyboard. Now the second icon is selected. We want this hotspot to register a response in the second square, so change its name to 2. Continue to do the same with the rest of the hotspots, until you've changed the name of the last one to 7. Now back to the second hotspot. We now have seven different hotspots for the par-ticipant to click, but as they're all copies of the first a click on any hotspot will yield a cross in the same location. Moreover, for any response the Answer variable will be 1. So open the map underneath the second hotspot (the first one was ok). Change the IconTitle of the calculation icon from 1 to 2. This saves you from opening the calcula-tion icon (six times), closing it (six times) and clicking yes to the question if you want to save the changes (six times). Now change the icon titles of the icons under the rest of the hotspots (3 to 7) to match their respective numbers. If you also enabled

Page 32: Authorware Programming Guide for Reseachers- 2nd Edition

6. SO AM I PRETTY GOOD NOW, OR WHAT?

- 31 -

participants to use the keyboard, you will also have to open the hotspot properties and change the entry in the Key(s) field to the corresponding key participants have to press to the right number! Now are we done? No: Authorware doesn't automatically know where we want our hotspots. Therefore, we must now find the hotspots and put them over the 7 squares we made. Here is how: Ctrl+2 open the Control Panel. Run the program and pause it. TIP: You can also Pause the running program by pressing Ctrl+P. You will see something like this:

Now the hotspots will be visible: the dotted squares with the number in their top left corner. In the picture above, I selected the hotspot associated with answer 7 (its name is indicated inside of the hotspot). Click-and-Drag the area and change it so it fits tightly over the square with the 7 inside (as you see in the picture on the right). Do the same thing for all other squares. TIP: Drag hot-spots around by clicking exactly on the grey dotted line. There's one last task to do (I told you this was going to be a long example, didn’t I?): we have to put the crosses on the right place. Run the experiment. If you did every-thing right, you can now click each of the scale options. If you do this, the cross you made appears somewhere on the screen. Even while the experi-ment is running, you can place it on the right spot, by clicking-and-dragging the cross to the right place. Click on every square and drag the cross over the square. See the example to the right. After you’ve done this for every square, Run the experiment again and click on all the squares. Your crosses now appear in the right place. Pretty neat huh? This would be a good moment to save your experiment. Go to File>Save As… and

Page 33: Authorware Programming Guide for Reseachers- 2nd Edition

6. SO AM I PRETTY GOOD NOW, OR WHAT?

- 32 -

save your experiment as Questionnaire. But hey, wait a minute, oh no, we forgot to give all the hotspot the hand cursor when the mouse floats over it! Especially with hotspots you want participants to be able to see which parts of the screen they can click. Do we have to open each icon and change it? No, thankfully not. TIP: You can change the properties of multiple icons at once. Close the presentation window and select the 5 hotspot icons you can see. The in the menu bar, go to Edit>Change Properties. Select All Attached Icons because you want to change all, so also the 2 you couldn’t see and didn’t select. Then select the property you want to change.

In this case, select Cursor, and from the scroll menu that appears choose the hand cursor. Then click apply top left, click ok and we’re done. Now the only problem we have is participants can click whatever they want, but they won’t exit our interaction. This was because we wanted participants to be able to change their choice. We still have to make a button to exit the interaction. Scroll to the 7th icon in the interaction, and drag and drop another map to the right of it. Notice that you don’t get a choice this time of what kind of interaction you want. Au-thorware figures that after 7 hotspots, you will want an eighth. But we don’t. Double-click the hot-spot icon to access the properties. First, name this icon Continue. Then look at the dropdown menu to the right of the title: it is called Type. Drop down the menu and you see all the options you have for interactions. Select the Button choice. Set the branch to Exit Interaction - we want participants to exit this interaction (to con-tinue to the next question) if they press this button. Two fields above that is the Active If text field. With this, you can program when this button is active - when participants can click on this button to exit the interaction. It would be nice if participants could exit the interaction only AFTER they gave an answer instead of before. You want them to choose, and then exit. One option to pro-gram this is telling Authorware this button is active if the Answer variable is bigger then 0. This would be programmed as Answer > 0. Although this would do in this case, a better way is to use another system variable called Tries. Tries is a vari-able which value is the number of times the user responded in this specific interac-tion; this makes it the better choice, because you can use it again and again through-out your experiment and it will reset itself to 0 automatically in every new interaction. So if they click on an answer, the value changes from 0 to 1. If they change their an-swer, the value is 2, etc. Therefore, we will write the following in the Active If text field: Tries > 0

Page 34: Authorware Programming Guide for Reseachers- 2nd Edition

6. SO AM I PRETTY GOOD NOW, OR WHAT?

- 33 -

It's far better to use Tries instead of Answer > 0. For this last expression to work you would have to reset your answer variable after every question, otherwise the Answer variable would still have the value it got in the previous round, thus making the Con-tinue button active immediately. In this worst case scenario, it's very easy for partici-pants to make mistakes (to press continue twice, for in-stance) or to cheat (by only pressing Continue and not an-swering any questions). If you want participants to use the keyboard, go to the but-ton Tab, and type Return in the Key(s) text field. Run the experiment, pause it with the Control Panel and move the ‘Continue’ Button to somewhere under the 4, in the middle of the 7 point scale. Change the shape if necessary (remember we want to make par-ticipating in experiments easy for our participants, so the bigger the button, the easier it is for them to click on it!) by running the experiment, pausing it and clicking on the button. You will see white squares around the button similar to when we changed the text borders in the first chapter. Click and Drag on the white squares to give the but-ton any size you prefer. That is it. You made your very own questionnaire. Save it again. We will use this piece in chapter 10 as well, so again be sure to save it.

Page 35: Authorware Programming Guide for Reseachers- 2nd Edition

7. AUTHORWARE PROGRAMMING IS A PIECE OF CAKE!

- 34 -

7. Authorware programming is a piece of cake! Right now, you are like a chess player who knows how all pieces move, knows 3 moves from an opening and has one or two tricks up his sleeve to surprise his oppo-nent. This gives you enough knowledge to play a fun game. But that doesn’t make you Kasparov. To become a better programmer, it is time to learn some more theory. Here to the right, we see 2 windows, one above the other, named ‘variables’ and ‘func-tions’. When you use variables and functions in calculation icons (and sometimes in other icons as well) you have an enormous amount of possibilities with Authorware. In 99.99% of the cases, your imagination will be the limit of your experiment, not Authorware. You can

open these 2 windows by clicking on the variable window icon and the function window icon in the taskbar. TIP: You can also open and close the variable and function windows by press-ing Ctrl+Shift+V and Ctrl+Shift+F. Let’s first take a closer look at the variable window. The category is set to all, so in the scroll window we see all the system vari-ables. We don’t see the variables we made ourselves. Open your Questionnaire Author-ware file. Change the category from All to ‘questionnaire.a7p’. Here you will see one variable you made yourself, named ‘answer’. Select it. You can now see which icons refer to this variable, which are, not so surprising, the 7 maps where the answers the partici-pant gives are stored. You also see a text field named Initial Value: usually this is not that important, but if you want a variable to have another value then 0 from the beginning of the experiment, you can change it here. You can also see the current value (and change it if necessary, for example while testing your experiment). If you run your experiment, and click on an answer and come back here, you will see the answer you clicked on. This is a good way to check if all variables are stored the way you want. This is also the place where you can add a new variable, or delete a variable name that you no longer use. Now switch back to the All category. Another great thing about this window is the de-scription field. From the All category, scroll down until you see the system variable Tries. Remember we used that last exercise? Click on it to read the description of what this variable does. You will also see you have used it in the icon named ‘con-

Page 36: Authorware Programming Guide for Reseachers- 2nd Edition

7. AUTHORWARE PROGRAMMING IS A PIECE OF CAKE!

- 35 -

tinue’. If you scroll up again, you will also see the system variables NumEntry, IconTi-tle and EntryText we have already used. Yes, there are a lot of variables in the list, but don’t worry: I never used more then half of them myself. They are here if you might need to do something you can only do with a system variable, so if you think you’ve run into a problem that is impossible in Authorware, you might find a way to do it here.

Now let’s switch to the functions window. This works pretty much in the same way. And it is also true that there are so much functions that I have never used, that you wonder how you ever going know the useful ones from the not so useful ones. Where do you start?

SIDESTEP ON DIFFERENT TYPES OF VARIABLES. There are four different types of variables which are interpreted differently by Au-thorware. The difference lies in the different data they store.

• Numerical variables store numbers, plain and simple. They allow mathe-matical operations like adding, subtracting, etc. A numerical variable can store values ranging from -1,7*10308 to 1,7*10308. Interesting, isn’t it?

• String variables contain letters, words or complete sentences. They are al-

ways enclosed within “quotation marks” within Authorware, but the quota-tion marks are not displayed on the screen. They do not allow mathemati-cal operations. The maximum number of character a string variable can contain is 32000 characters. That would be the first 14 pages of this guide, meaning it is often enough, but still useful to know.

• Logical variables store a True or False variable (or a 1 or 0 value, respec-

tively). This represents a condition that is met, or not. We used a logical variable when we told Authorware to set the value for Checked@“Male” := False. They are not very common, but can be useful, for example in the Active If field in interactions.

• List variables store a set of values. They have a wider range of possibilities

then a string variable. They allow retrieving information at specific places in the list, deleting information, adding information, etc. There are special functions to work with lists which will be dealt with in chapter 11.

TIP: Note that it is impossible for a numerical variable to equal a logical or string variable. The numerical variable for gender can have the value 1, but it is not possible to write Gender = Checked@“Male” to indicate that the gender of a participant equals the radiobutton that is checked; Authorware will interpret this as Gender = True or False. Gender will not have a numeri-cal value, so can not be used in a decision icon in the field ‘to calculated path’ or be stored for analysis. In the same way the numerical value 1 can not equal the string value “1”. Also, never use the := symbol when you should use the = symbol.

Page 37: Authorware Programming Guide for Reseachers- 2nd Edition

7. AUTHORWARE PROGRAMMING IS A PIECE OF CAKE!

- 36 -

Well, here, for one. Most practical functions will be used in one of the examples in this workbook. Second, you can browse the list and read descriptions of the functions so you get the idea of what is possible. I wouldn’t do that right now, but maybe if you encounter a problem and are looking if Authorware has some kind of way around it. Third, there is the Authorware help file, where a lot of information can be found if you need it. For now, go to the category function, and select language. Here you see the most important functions, called ‘Logical operators’. TIP: The logical operators do not appear in the All category of the function screen. You have to select the language category to view them. Here is a short explanation of what the operators mean: := operator, as we have encountered already in expression like: Answer := 1. The value of the variable answer ‘becomes’ 1. Use this only when a variable becomes a certain value; don’t use it in a logical expression, e.g., if Gender := 1 then X. This lit-erally means if the variable Gender would be changed into 1 during this logical ex-pression, and is therefore meaningless. if-then structure. If a condition is met, then something else will be done. You can also specify several conditions, but when you do this, Authorware suddenly gets very picky about how you type this in, where you place Returns and where tabs. This can become a little frustrating in the beginning, but you can type over this example to get you started:

if day > 0 then Whatever := Whatever + 1 Remark := "Hello" end if

There is a Return after the first line, then the next lines with the statements what Au-thorware should do start with a Tab (usually automatic, sometimes not) and the last line starts at the normal position again. See the function description for more exam-ples to follow. The following symbols are relational operators, comparing 2 variables. = equal to, <> not equal to, < less than, <= less than or equal to, >= greater than or equal to, > greater than. Remember, only 2 variables are compared, so expressions like: 5 > 2 & < 8 will not result in Authorware telling you this expression is true. To use arithmetic operators, use + to add, - to subtract, * to multiply and / to divide. Logical operators, & means ‘and’ as in dazed & confused, | means ‘or’ as in dead | alive, and ~ means ‘not’. Note that using logical operators, you check if a certain condition is TRUE or FALSE. For example you could program: if AgeVariable > 18 & Gender = 1 then Category := “Adult Male”. If you want to check if X = 1 or 2 or 3 or 4, it should be programmed as: if X =1|=2|=3|=4 then Y. The = should be repeated be-cause you check if X equals 1 is TRUE OR X equals 2 is TRUE, etc. Repeat With functions can save you a lot of time when you want to perform a lot of operations on a large amount of variables. The next example might me a little ad-

Page 38: Authorware Programming Guide for Reseachers- 2nd Edition

7. AUTHORWARE PROGRAMMING IS A PIECE OF CAKE!

- 37 -

vanced, but it is useful to illustrate the repeat with function. We have a list of vari-ables (see Chapter 11 for what Lists are) in which we want repeat the search for the lowest value 12 times, and save these 12 low values to a new list and then delete the lowest variable to find the next lowest value, starting with the lowest value 0, but add-ing 1 if there are no zeroes left in our list with variables. We would program this the following way:

repeat with index := 1 to 12 FoundValue := FindValue(ListWithValues; LowValue) if FoundValue <> 0 then LowItem := ValueAtIndex(ItemsList; FoundValue) AddLinear(LowItemsList; LowItem) DeleteAtIndex(ListWithValues; FoundValue) end if if FoundValue = 0 then LowValue := LowValue + 1 end repeat

Now, scroll to the Math category. Here you will find several mathematical functions you can use to average your expression, round a value or calculate the cosine. An-other important function here is the Random function, which enables you to generate a random number. Now scroll to the File category: here you’ll find the most important command to store your data on the computers hard drive, namely WriteExtFile and AppendExtFile. The Graphics category is mainly relevant if you want to let Authorware draw something by itself, which may not be a common usage, but at least you know it is possible. Another important category is List. Lists are a powerful way to use variables in Authorware you will not have heard the last about before finishing this guide. With func-tions it is even more useful to read the de-scription. Often function have to be typed in a very specific way, whereas variables are usu-ally only a word. TIP: Instead of typing in data, you can also press the ‘paste’ button at the bottom of the function (and variable) window when you’ve opened a calculation icon. For instance, to use the Random function, you also need to type in some parameters that Authorware needs to know before creating a random value. In this case, you will need to type in the minimum value, the maximum value, and the units in between the maximum and minimum. Thankfully, Authorware will help you while typing in a function. To see this, open a calculation icon, and type in Random(. If you wait a second after typing in the first bracket you will see the picture on the right. The values Authorware needs to randomly generate numbers have to be typed in between brackets () and separated with ‘;’. (In older versions, this was the comma symbol. Sometimes in help files, you will see a comma when actually you have to

Page 39: Authorware Programming Guide for Reseachers- 2nd Edition

7. AUTHORWARE PROGRAMMING IS A PIECE OF CAKE!

- 38 -

type in a ‘;’. Pay attention to this.) In the calculation icon, Authorware helps you by showing you that you have to type in the minimum value followed by ; followed by the maximum value followed by ; followed by the unit end closed by a bracket. To finish this expression, type in ‘random(1; 6; 1)’. Authorware will create a value be-tween 1 and 6 in units of 1; this will be like rolling a dice.

SIDESTEP ON CRASHING AUTHORWARE (A.K.A. HOW TO FRY YOUR PROCESSOR) Programming with functions and variables can be really powerful, but really de-structive as well. One of the most common ways Authorware will crash is the (ab)use of the Repeat With/While function. If you set Authorware to repeat a cer-tain piece of programming until a certain condition is met, but that condition is never met, Authorware will enter a never-ending loop the result of which is that your program will stop responding, and any unsaved data will be lost. For exam-ple, open a new Authorware program, drop a calculation icon on the flowline and in it type: Repeat While ListCount(EmptyList) < 1

Nonsense := Nonsense + 1 End Repeat Just click ok when closing the calculation icon. What you told Authorware to do is to loop this piece of programming until the empty list (which you didn’t even define as a list) contains a variable. Since you never add a variable to the empty list, if you run this Authorware will continue to add 1 to the nonsense variable for ever (or until your processor burns out). So always save your program when trying out the repeat function and never start with a calculation icon on the flowline (be-cause when you open it, Authorware starts running the first icon automatically, resulting in a crash on start-up and losing your entire file). Just so you know.

Page 40: Authorware Programming Guide for Reseachers- 2nd Edition

8. RIIIIIIIGHT. DO I LOOK LIKE A NERD TO YOU?

- 39 -

8. Riiiiiiight. Do I look like a nerd to you? Well, this may not look like it is very interesting, but using the functions and system variables in Authorware is actually the most creative part of building your experiment. If you want to program a game participants have to play, or if you have a special kind of manipulation you need that requires interactivity, programming some expression will usually enable you to make what you want. But maybe this will become clearer if we build a new experiment. You may think this guide is teaching you how to use Authorware in no-time. Though it’s fast, it’s not actually no-time. Open the variable screen (by clicking in the toolbar or pressing Ctrl+Shift+V) and scroll to the variable TotalHours. This is the amount of hours you have been working on this specific Authorware file. Don’t ask me why Au-thorware has this system variable, but it does. It has a lot more system variables concerning time. Let’s use a couple to make some time-related Authorware pieces. Put a display icon on the flowline, name it ‘Time’ and open it. Somewhere on the screen, type the following: {Hour}:{Minute}:{Sec} Immediately when you click somewhere else on the screen, you will see the words change into numbers. Remember that if you want to display a variable on the display screen, you had to write it in between { } brackets? That’s what we did here: we took 3 system variables, the first containing the current hours, the second containing the current minutes, and the third containing the current seconds, and made a digital clock. Look at the clock again: it seems to be a little late. As you see, the variables are not updated on the screen. TIP: To have Authorware continuously update variables on the display screen, go Modify>Icon>Properties or press Ctrl+I to open the icon properties screen and check the option ‘Update Displayed Variables’. This is important to remember because you will use this often. It is useful when con-stantly displaying a score of participants which changes every trial for example. Now if you Run the file (please note, the variable will not change if you double-click the display icon, but only in Run mode) you will see a running clock. Now we have another small thing I’d like to change. In our running clock, the seconds from 0 till 9 are displayed as 9 instead of 09, for example. To change this, select the text in the display screen with the Text cursor and in the menu bar go to Text>Number Format. Here we get lots of options to customize the numbers that are displayed on the display screen in every way we want.

Page 41: Authorware Programming Guide for Reseachers- 2nd Edition

8. RIIIIIIIGHT. DO I LOOK LIKE A NERD TO YOU?

- 40 -

In this case, we want to display 2 zeros before the decimal (so the seconds will be 00 or 04), so as in the picture to the right, we will check Leading Zeros and put 2 in the text field. Since seconds are always whole number, there is never anything behind the decimal, so those options are irrelevant. This is only one way in which you can display the passing of the seconds on screen. Another very simple way to display a time participants have to wait is the wait icon. Beneath the display icon in the flowline, put a wait icon, name it ‘Wait10’ and open it. Set the time limit to 10 sec-onds by typing 10 in the text field and only check the box before ‘Show Countdown.’ Run the Au-

thorware piece again and you will see a small black clock in the left bottom corner counting down the 10 seconds.

Now let’s try to combine the 2: we want to have numbers on the screen, but then counting down from 10 to 0. This may sounds pretty simple, but it will require some difficult programming to make. There is no counting down system variable, so we will have to program a variable that does this ourselves. First, open a display icon; rename it ‘TimeLeft’ and type somewhere in the centre of the display icon: The test will begin in {TimeLeft} seconds. Close the presentation window with Ctrl+1 and click ‘OK’ to save the new variable ‘TimeLeft’. Now we need to tell Authorware what this variable will be and when it will change. To do this, drop a calculation icon on the flowline beneath the display icon and rename it ‘SetTime’. Open it and type: CountDown := SystemSeconds + 10 From the bold typeface of SystemSeconds you can conclude it is another system variable. SystemSeconds contains the number of seconds since the computer was started. It is a simple second counter, but it is extremely useful because it is easier to do calculate with then with the ‘sec’ system variable which only has values from 0 to 59 and then starts over. What we do in this calculation icon is save the value of the current time in a new variable. To see the value of the sys-tem variable SystemSeconds, open the variable screen and look at the current value. For example, on the right, the value was 5052,31. You can see the value has 2 decimals behind it; this will cause a problem later on and we will get back to this. For now, we have set our own variable, CountDown, to the current System-Seconds + 10. This means the difference between CountDown and the System-Seconds is 10 seconds right now, and the difference will become 1 less every sec-ond. Now we want Authorware to calculate and update the variable {TimeLeft} for every new second. How can we let Authorware continuously monitor a variable? The an-swer is the loop, which is nothing more than a circle in the flowline Authorware will

Page 42: Authorware Programming Guide for Reseachers- 2nd Edition

8. RIIIIIIIGHT. DO I LOOK LIKE A NERD TO YOU?

- 41 -

follow until you tell it to stop. If you put a calculation icon inside a loop, Authorware will perform the calculation for as long as you tell it to loop. To do this, drop a deci-sion icon beneath the SetTime calculation icon and name it LoopTime. Then drop another calculation icon to the right of the decision icon and rename it CalcTime. To get the flowline you see in the picture on the right of this page, open the decision icon by double-clicking it. Select Repeat Until True from the drop down menu. We want it to repeat, but not forever. When should Authorware stop looping? A simple answer is, until the variable TimeLeft = 0. But the problem is, this variable is 0 right now! We didn’t change the initial value when creating this variable or later on in the variable window, so TimeLeft has the standard initial value of 0. We could change the initial value now, but we can also tell Author-ware to loop until the variable CountDown = SystemSeconds. You can just type this kind of programming in the text field and Authorware will understand it and continue looping until the 2 values of the variables have the same values. Now Authorware will

loop until the variable CountDown (which was 10 seconds higher than the current Sys-temSeconds) will be equal to the System-Seconds, so until 10 seconds have elapsed. As you can see, all problems can be solved in different (and creative) ways. TIP: Another common option in loops is

the repeat fixed number of times, by typing any number (or a variable) in the text field underneath the drop-down menu. All we need to do now is write something inside the calculation icon in the loop that will allow Authorware to calculate the current TimeLeft. Take a minute to think of the precise function yourself. Here comes the answer (or one of the possible answers). Type the following function in the icon: TimeLeft := CountDown – SystemSeconds Now Run the Authorware piece. You will see the time count down. Depending on your number format settings, you might see numbers behind the decimal as well. To change this to only see the seconds, select the TimeLeft variable in the presentation window with the Text cursor, and go to the Text>Number Format screen. Disable the checkbox with the option ‘Show Numbers After Decimal.’ Now, while running the piece, several things can happen. Either the program stops when there are 0 seconds left. The other option is that the program will keep on counting to -1, -2, etc. Now that’s weird, right? Just run the program a couple of times and you’ll see what I mean. What’s wrong? In the introduction I wrote that if you are doing reaction time experiments, you should use E-prime software. Authorware is ok when it concerns timing, but not perfect. Re-member we told Authorware to stop looping until CountDown = SystemSeconds? And that SystemSeconds was a variable with 2 decimals? That means we are ask-ing Authorware to loop until the value of the variable CountDown (for example,

Page 43: Authorware Programming Guide for Reseachers- 2nd Edition

8. RIIIIIIIGHT. DO I LOOK LIKE A NERD TO YOU?

- 42 -

10243,82) equals the SystemSeconds variable. Equals, as in being the same to one hundredth of a second. That is asking more of Authorware then it can. Sometimes it will work, but sometimes it won’t and Authorware will miss the hundredth of a second the 2 variables are equal to each other and continue looping forever, for example when your computer is using a lot of its internal memory for another task, like scan-ning for viruses. So this time the problem, as always in life, wasn’t your fault. How do we fix it? There are 3 options. Either we can use the SystemSeconds variable without the 2 deci-mals by rounding the value to a whole number. To do this, we should change the SystemSeconds in every calculation icon and text field in the loop to Round(SystemSeconds). The Round command will Round the value of the Sys-temSeconds variable to a whole number, and Authorware will surely notice Count-Down = Round(SystemSeconds) when it has a whole second to do so. The other option is not to loop until CountDown = SystemSeconds, but to loop until Countdown <= SystemSeconds. The smaller or equal to sign will be your safety net so Authorware won’t loop forever. The third option is probably the best one: use the built in option the decision icon has to set a time limit. We will keep the Repeat Untill True setting, but in the field under-neath it we will type something that can never be true. There are an almost unlimited amount of options, and in the picture below you can see the condition that’s never true is Day (a system variable which holds the current day of the month from 1 to 31) = 555 (or any random number above 31).

This means the loop will repeat itself indefinitely. To make it stop after 10 seconds anyway, we type in 10 in the time limit field. The use of the SystemSeconds variable and how to calculate passing time in Au-thorware has a lot of practical uses. For example, you can let a button appear after a certain amount of time had passed, or you set the Time at the beginning of an ex-periment and at the end to see how long participants took to finish the experiment, or even keep track of how might time they needed to answer each individual question of your questionnaires. Another way to limit the time participants can spend in an interaction (instead of letting the program wait forever until participants make a response) is the Time Limit Interaction. This is one of the response types you can choose when dropping a map folder to the right of an interaction icon. After choosing this response type a small clock will appear above the folder, indicating you have created a time limit in-teraction. If you double-click the small clock you enter the properties screen of the time limit interaction where you can set the number of seconds for the time limit, choose wheter you want to show a clock or not and what Authorware should do upon an in-

Page 44: Authorware Programming Guide for Reseachers- 2nd Edition

8. RIIIIIIIGHT. DO I LOOK LIKE A NERD TO YOU?

- 43 -

terruption (usually you would keep the standard settings).

Page 45: Authorware Programming Guide for Reseachers- 2nd Edition

9. EVERYTHING I MADE LOOKS SO… PLAIN.

- 44 -

9. Everything I made looks so… plain. As we’ve seen, making a nice background can really lift your experiment. Black text on a white background is far from appealing for the participant, and come to think of it, the standard grey buttons aren’t the most attractive things in the world either. Know, however, that Authorware actually is a program which is used more for making presentations then doing experiments. It can make presentations look better then Powerpoint and add interactive elements like sounds as well. Most of the time, this is of no interest to a researcher. It is even the other way around: to much distracting visuals are even unwanted in an experiment. Still, it is crucial that we consider these possibilities for two reasons. First, your participants will enjoy your experiment more (and therefore may be more motivated), but second and more im-portantly, your experiment may require certain visual or aural stimuli. We have already seen how you can make your own backgrounds in Authorware using the Tools box. However, perhaps you prefer to use existing pictures for your background. Drop a display icon on the flowline and name it Background. Double-click it to open.

You can import a picture by clicking the import button: . Search your computer for a picture and import it into Authorware. In this way, you can also import pictures to present to your participants as stimuli. Place the picture you want in your background (for example, your company logo) in the right top of the page. If you double click it you can adjust certain options, like the mode (just try them all to see which you like best) and, on the lay-out tab, the position. TIP: If you want your background always to be visible (and not disappear under pictures you have in the presentation window later on in the flowline) change the layer of the display (default layer is 0) in the properties window to 1 (or higher). The presentation screen consists of pixels. Every pixel has an X- and Y-coordinate. The top left pixel has coordinates 1, 1. Moving to the right increases the X-coordinate, moving down increases the y coordinate. TIP: To place pictures on a specific location you can type in the coordinates. Actually, you can even type in a variable name, making the location of an im-age variable! The image had to be placed in it’s own seperate Display Icon. The easiest way to do this, is put the white hand cursor on the right place on the flowline, and click the import button in the taskbar. Import any picture (For instance, go to C:\WINDOWS and select Blauw 16) and notice it is automatically named for you. Now counterintuitivly, to change the location of the picture and it’s properties, we don’t double-click on the picture in the presentation window, but go to the properties window of the display icon by either Ctrl+I or

Page 46: Authorware Programming Guide for Reseachers- 2nd Edition

9. EVERYTHING I MADE LOOKS SO… PLAIN.

- 45 -

right-clicking the display icon. TIP: By right-clicking an icon you can easily access most common options for that icon. We have several Display options available. We can choose the basic ‘no change’, set a path for the image in the display icon to move over (which we won’t discuss but is fun to try out once) or the ‘on screen’ option to simply show the picture somewhere on the screen (or sometimes off the screen). For instance, select ‘on screen’ and, in the initial C field, type ‘ClickX’ and in the initial Y field type ‘ClickY’. These are again system variable, storing the values of the last X- and Y coordinate where the left mouse button was pressed down for the last time. Since these coordinates are input from a participant, they are only stored during an interaction. So let’s build a small interaction for the effect. In this interaction, we will use a new Response Type. Drop an interaction icon on the flowline, and click and drag the display icon to the right of it. The Response Type window will open, and we will select ‘Conditional’. A conditional interaction comes into play when a cer-tain condition is met. Most often, this will be when a certain amount of time has passed and you want your participants to be notified they have to hurry up, for example. Right now, we will use it to update the location of the image when the participant clicks somewhere in the presentation window. The response we are waiting for in this case is a left mouse click. In Authorware, the system variable MouseDown keeps track of when the mouse button is down (clicked) and when not. In the Condition field on the conditional

tab of the properties window, type ‘MouseDown’. This means that in this interaction, whenever the mouse is down, Authorware will follow the flowline attached to this condition icon, performing the

commands given (in this case, showing the picture on the location on the screen where the participant clicked for the last time). Set the automatic drop down menu to ‘On False to True’, which means that when the MouseDown variable switches from False to True the condition is met. Now Run your Authorware piece, and click somewhere on the screen. When you need to import a moving .gif image, for example a nice image you found on the internet somewhere, the procedure to follow is a little different from just click-ing the import button. In the menu, go to Insert>Media>Animated GIF and select your moving .gif image. On the flowline you will see the animated GIF icon:

Page 47: Authorware Programming Guide for Reseachers- 2nd Edition

9. EVERYTHING I MADE LOOKS SO… PLAIN.

- 46 -

If you go to the properties screen of the .gif image, in the Tempo drop down menu you can select fixed and set the frames per second at which your gif should move. Note that your image will keep moving ad infinitum. If you want to stop your gif from moving, you can do so by using the following command in a calculation icon: CallSprite(IconID@"IconTitle", #pause) and replacing IconTitle with the name of your animated gif icon. You can also import a picture of your company logo and use it as a background. We’ve discussed backgrounds before, but there’s one important trick to backgrounds we haven’t covered so far. When you have imported your background, name the icon ‘Background’. Close the presentation window and right-click the display icon and choose ‘calculation’. You see that a calculation icon opens. Inside, type: Movable := False

By typing in this expression, when running the program, all objects you put in this background cannot be moved. Try to move the picture now while running the piece (click once on the picture, and try to drag it some-where). Under normal circumstances you could move everything in the presentation window around, but this way you can prevent items in the Display Icon from acciden-tally being moved while working on the piece. Close the window and you will see a small = symbol attached to the display icon. This is the attached calculation icon. You can attach calculation icon to all icons. Ok, not to calculation icons, but that would be pretty useless, now wouldn’t it? Now let’s get back to images and how you can re-use them in your experiment with-out having to import them more than once. First, let’s place a wait icon underneath your background (this time, don’t change anything inside) and place an erase icon beneath the wait icon. Double click it to open. Click on the picture to let the back-ground icon be erased by the erase icon, and close the icon. Now underneath it, a wait icon (again, don’t change anything, this is just an example we’ll throw away when done with it) and beneath that place a calculation icon. In the calculation icon, type: DisplayIcon(IconID@“Background”) Now what would that function do? Not surprisingly, it tells Authorware to display an icon with a specific icon ID. Authorware identifies all icons with a unique number, the ‘IconID’. You can find this number in the properties window of every icon (Right-click on any icon, Properties). Thankfully, you will never need this number, because we refer to icons by the names we give them ourselves. This is one of the reasons we give every icon a name (later on, when you start making your own experiments, you will learn when you actually don’t have to name the icons and when you will have to name them, but since I’m teaching you how to do it the right way, I make you name every icon).

Page 48: Authorware Programming Guide for Reseachers- 2nd Edition

9. EVERYTHING I MADE LOOKS SO… PLAIN.

- 47 -

Note that Authorware uses these ID’s and not the names to tell erase icons which icon to erase, or navigate icons where to navigate: thus copy pasting these icons from other files will always lead to problems because the ID numbers will be different in each file, even if the names you have given are the same. Because of this, icons you specifically told Authorware to be preserved will be deleted anyway when you copy past the perfectly working part of your experiment to a new file. To bad, but that’s how it works.

Run this piece. You see your background with the continue button from the wait icon. If you click it, the erase icon erases the background and you see the next continue button. If you click that, the display icon re-appears. Authorware displays the same icon. When you are working with pictures, using this command to display a display icon can same a lot of disk space compared to copying the same icon several times. In this case, the background and the DisplayIcon request are relatively close, but DisplayIcon also works for icons that are many maps apart. You can therefore summon your image at any time and as often as you want, without having to import it more than once, decreasing over-all file size and enabling you to create the interactive appearances of pictures. The question then is: where will you put all those pictures that you will call upon with the DisplayIcon function? You could just put them in icons on the flowline, and then quickly erase them all, but there is an

AGE QUESTION REVISISTED: CONDITIONAL RESPONSES Remember how we spend 10 minutes typing in the allowed answers in the age text entry in Chapter 4? Now that we have learned what a conditional response is, we are able to re-program our Age question a little more parsimoniously. What we need for this is a text entry, and next to it, we will place 3 conditional responses like this:

There is only one response that we will consider as correct, and that is any age from 15 to 85. That means that if (the condition) the numbered entered in the text entry field equals a value lower then 15, it is an incorrect response, and the same goes for a entry higher then 85. We will program the first two conditional res-ponses to react to these two conditions by typing NumEntry@"Tekst"< 15 and NumEntry@"Tekst"> 85 in the condition fields. Then we set the flowline to Try Again, and inside the folders you can put a display icon with the text: Your entry is not one of the possible answers, please try again. In the correct condition, we

Page 49: Authorware Programming Guide for Reseachers- 2nd Edition

9. EVERYTHING I MADE LOOKS SO… PLAIN.

- 48 -

easier way. We will create a storage map somewhere the flowline will never go. The easiest way to do this is to drop a decision icon on the flowline, set it to calculated path, but then don’t put any variable in the field to specify where the flowline should go. This way, the program will ignore any map icons you attach to the decision icon

but just continue right away. Drop a map to the right of the decision icon and name it storageroom. Inside you can store all the display icons you want and call upon them whenever you need.

Now for some sound. Here is a small example of how to incorporate sounds in Au-thorware. Drop a sound icon (the one with the musical note in it) on the flowline, beneath the wait icon, but above the erase icon. Name it ‘ClickSound’. Double-click it to open. Click on the import button to import a sound. On a PC running windows, go to C:\Windows\Media and choose the start.wav file. On the timing tab, in the drop down menu next to concurrency, choose concurrent. Concurrent means your pro-gram will continue running while it plays the sound, instead of waiting until the sound clip is finished. Ok, for a short sound like we have you will not notice the difference immediately, but it is useful to know if you want to play long sound files. Close the sound icon properties. Right-click the sound icon and choose preview (in this case that means pre-hear). If your speakers are on, you hear a short clicking sound. Now copy-past the same sound icon directly behind the second wait icon. Now run the piece. Ok, I admit, this isn’t going to win any beauty contests, but never-theless it is the basis of making Authorware look better. For some inspiration, check out the show me examples located in C:\Program Files\Macromedia\Authorware 7.0\ShowMe. For example open the Altimeter, and then don’t even look as much at the altimeter, but the construction and visuals of the show me example itself, the moving title bar, the text in the scroll windows with different colours, etc. While you are looking at this ShowMe example, pause the presentation (Ctrl+2 open the control panel, click the pause button) and double click on the menu button on the bottom. This is a button, not a hot spot. In the Button: Properties window, way to the left is the button labelled ‘buttons…’. If you open it, you will see 3 custom made but-tons. You can make your own buttons for your own experiments, or download them from the internet. You need 2 different ones, one for the normal state, and one for the down-state (when it is pressed) to visually represent pressing the button. Further-more, you can make a mouse over button (Though I would not recommend it: we use the hand icon for this instead) and a disabled button (which could be useful if you want to show the button when it is not active). Making a black rectangle with the word continue on it in white, will really not take so much time and improve the way your experiment looks…

Page 50: Authorware Programming Guide for Reseachers- 2nd Edition

10. LIGHTS, CAMERA, ACTION!

- 49 -

10. Lights, Camera, Action! Besides creating interactive experiments, Authorware is a useful tool for presenting digital media. This is an obvious advantage of using a computer to administer your experiment over paper and pencils. After all, if a picture paints a thousand words, manipulating mood with 30 seconds of your favorite Disney movie will outperform any instruction to ask participants to describe in detail the last time they felt really happy. So hereby, due to popular demand, the details for how to get a movie or soundclip working in your experiment. TIP: Always check if your experiment will play the video on the computer in the lab. If the pc in the lab is missing the right codec, your video will not ap-pear, even though it worked fine on your own pc. Always check. Always. Ok?

There’s another distinction between movie files you need to keep in mind, namely if you have a quicktime file (or .mov file) or any other video file (the most common file types are .mpg, .avi and .wmv). Quicktime movies are added in a different way than the other types of movies, and we will discuss them separately. Let’s start with the most common way to display a large variety of movie clips, using the digital movie icon from the Icons Toolbar. Ok, let’s get going. Drop a Digital Movie Icon ( )on the flowline, and name it ‘mov-ie’. Go to the properties window of the video icon. Hit the import button, and browse to a video file. If you don’t have a video file, try browsing to the folder

SIDESTEP ON CODECS Videofiles and audiofiles are often compressed to reduce file size. In the case of audio files, which in uncompressed format are .wav files, the most common com-pression method is MPEG-1 Audio Layer 3, or .mp3 files, easily reducing file size by 10 times. The same goes for video files: to reduce file sizes, they are often compressed. Unfortunately, there are a lot of different codecs used for videofiles. Where every PC can play a .mp3 file, it is possible your video file will play on one PC, but not on the other, because the right decompressor is not installed. When working with video files in Authorware, first of all test the video file in a normal media player. If the video file does not play at all, install a codec-pack (search the internet for K-Lite codec pack). If you can’t install anything on the PC you want your experiment to run on, try saving the video file in an uncompressed format (you can do this with the freeware program VirtualDub). What to do if your movie does not play? Check the compression type of your video using Gspot. If the video codec is not MPEG1, with MPEG-1 Layer 2 audio, consider converting your video to this for-mat, since this will always work in Authorware. Ask your IT expert for help, or get a copy of TMPGenc, it’s a great program for all your video recoding. Some other ways are discussed below, but if you have problems, recoding will help in 99% of the cases.

Page 51: Authorware Programming Guide for Reseachers- 2nd Edition

10. LIGHTS, CAMERA, ACTION!

- 50 -

C:\WINDOWS\Help\Tours\WindowsMediaPlayer\Video, and select the copycd.wmv file, and click import. Run your experiment, and you will see the video appear. You can pause the program, and move the video around to a different location just as you can with pictures and text. If you click the timing tab, switch the timing from concur-rent (which means your program will continue after starting the video) to ‘Wait until Done’ you the video will play completely first, and then your experiment will continue. Pretty easy, not? That is, if your self-chosen video file shows up in the same way as the windows me-dia player .wmv file. If not, you most likely only saw a box in the presentation screen similar to the one on the right. We can still show this video using a less straightforward procedure. It’s possi-ble to use Windows Media Player (if installed on the PC your experiment will be running from) to display your video. This is most likely necessary if your video is compressed with certain DIVX codecs. Again, first try to play your video in Windows Media Player. If that works normally, and you don’t know why your video did not appear in Authorware, there are three ways to fix the problem. First, the shortcut: Rename your video file by adding .wmp after the extension (so JustWorkYouStupidVideo.avi will become JustWorkYouStupidVideo.avi.wmp). Au-thorware will now try to play your file using windows media player, so if it worked there, renaming your file will most likely do the trick. There is also a second way to make windows media player play your video file, and that’s by adding an ActiveX component. ActiveX components allow you to add the functionality of other programs to Authorware. For example, you could open a PDF file in Authorware, and let your participants browse through the pages. Similarly, you can open a video file with Windows Media Player, and add all the functionality of the Windows Media Player. Participants could pause or rewind the video, and change the volume. This is a bit more complicated than the other ways to display a video, but it give you some interesting other options you might need. To add an ActiveX component to the flowline, choose Insert>Control>ActiveX. Somewhere at the end of the list that appears, you’ll see Windows Media Player. Se-lect it, and click OK. A new screen opens, where you can set all the options for the Windows Media Player Component you are using. First, click the ‘Custom’ button, then click the ‘Browse…’ button to locate your file. In the same screen, you can select the Mode, which by default is set to Full. This means participants will get the video screen, with the interface of all controls needed to play and pause the video, change the volume, etc. If you choose ‘none’, there will be no controls, only the video, and if you choose invisible, participants will hear the sounds, but see nothing. If you pause the screen, you can increase the size of the ActiveX, and thereby change the video screen size. Alternatively, you can select ‘Play on Full Screen’ by checking the cor-responding box on this tab.

Page 52: Authorware Programming Guide for Reseachers- 2nd Edition

10. LIGHTS, CAMERA, ACTION!

- 51 -

TIP: The layer option does not allow you to display .avi, .mpg or .wmv videos on a certain layer: these video formats will always be played on the top layer. If you want to add something on top of your video, use a Quicktime movie (you can set the layer of that type of movie). If you have a Quicktime (.mov) file, getting it to play in Authorware works a little dif-ferent. Choose Insert>Media>Quicktime and the following screen will open:

Again, click the Browse… button to locate your file. Uncheck the Direct To Screen checkbox if you want to add layers on top of the video. Again, test if the computer you want to run your experiment on has Quicktime installed, otherwise it will not be able to play your video file.

Page 53: Authorware Programming Guide for Reseachers- 2nd Edition

10. LIGHTS, CAMERA, ACTION!

- 52 -

The thirds option is probably best: convert your video file so that Authorware will au-tomatically recognize it. See the sidestep on codecs box earlier in the chapter. If all describe methods fail, know you can also always use an external program to display a video. For example, is you have a file Windows Media Player cannot play, you might want to use a different program to play your video. You can use Author-ware to start a different program with a specific file. So, if you have downloaded a YouTube video (which is a .flv file) you could play it using VLC media player by putting the following sentence in a calculation icon: JumpOutReturn("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe"; “C:\\Video.flv") Note that this will start up the VLC media player, which automatically starts playing your .flv file. Remember participants do not only have full control over the player’s controls, but can also close the VLC player program. It is not an ideal solution, and you might wish to convert the .flv file to a .mpg file as discussed in the Sidestep on codecs box.

Page 54: Authorware Programming Guide for Reseachers- 2nd Edition

11. HOW ABOUT THAT QUESTIONNAIRE I MADE?

- 53 -

11. How about that questionnaire I made? Oh yes, I almost forgot! You know what the problem was with the questionnaire? It asked one question, but what if we have a 30 item questionnaire? We are research-ers, right, and with the computer automatically saving and scoring all answers, we can ask our participants whatever we want! Of course we could copy paste the same interaction and change the display items of all 30, and then save all 30 questions as a different variable, which all have to name and change in 30 calculation icons. Then we could add those 30 answers to our data save calculation icon. But that’s a lot of work, it’s not very parsimonious, and the more variables you use, the bigger the chance you will make a mistake somewhere. When you use the same thing a lot of times, it sometimes pays to build a loop, which will rerun the same part of your experiment for a fixed number of times. This way, you can re-run your questionnaire (say, thirty times) and use a variable to change the question being asked in the Presentation screen every time the interaction makes a new loop. Let’s try this, and learn some more useful Authorware commands while doing so. We need to do 3 things: first loop our questionnaire, then create a variable that changes the question for every new loop, and finally create a variable that stores the answer every time we loop without overwriting the previ-ous answer. First, select all the icons that make your questionnaire, and press Ctrl+G to group them in a map. Drop a deci-sion icon underneath it, name it ‘QuestionLoop’. Set the loop to repeat: fixed number of times and in the text field type 10 times. In this exam-ple we’ll only ask 10 questions, so we’ll loop 10 times. Now we don’t want participants to answer the same question 10 times, so we have to make sure the question changes each time we loop. Open the map with your ques-tionnaire in it. Open the interaction icon and replace the text of the question with the variable {question}. Close this window (and accept the new variable named question) and don’t forget to check the ‘update displayed variable’ box in the display icons property screen. Now we need to tell Authorware which question we want the vari-able {question} to display every time we loop. Authorware needs to know this before it encounters the interaction icon. To do this, put a calculation icon above the ques-tionnaire interaction icon, so that every time that the questionnaire loops, it will first go through this calculation icon before displaying the question. Name it SetQuestions and open the calculation icon. TIP: Always write something in a calculation icon you drop on the flowline. Though this might seem like an obvious thing, sometimes you might forget it. An empty calculation icon or display icon will cause Authorware to unexpect-edly pause while running your piece. We want to program Authorware in a way that each time it loops the question should

Page 55: Authorware Programming Guide for Reseachers- 2nd Edition

11. HOW ABOUT THAT QUESTIONNAIRE I MADE?

- 54 -

change to the next in our list. We will do this with the if – then function. There are 2 options. First is to type in: NumberOfLoops := NumberOfLoops + 1. This is a very common and often useful way to keep track of how many times we went through a loop. We could follow this by If NumberOfLoops = 1 then question := “What-ever you want to ask.” However, we don’t have to create a variable that keeps track of how many times we repeated this loop, because our friendly and practical Authorware has a system vari-able called RepCount that does the same thing: it counts how many times the par-ticipant has repeated the loop. Note that RepCount is an interaction specific variable, comparable to the Tries variable. This means it is reset every time you exit an in-teraction, and creating a custom variable like NumberofLoops is useful is you come back to the same loop, but exit it in between. However, this time in the calculation icon, we can type: If RepCount = 1 then Question := “Question number 1.” The copy-past this sentence 9 more times, and make the numbers for both Repcount and Questions run from 1 to 10. Of course, eventually, you will want to change the “Question number 1” into a real question, but for now, close the calculation icon. Now before we continue, remember how I told you in Chapter 1 to close the calcula-tion icon and then click yes to save the changes you made in it? Now be honest with me: did you actually ever read the text displayed in the pop-up window asking you if you wanted the changes to be saved, or did you always just press ‘yes’? Well, if you are like me, you probably just clicked yes and didn’t bother, so here’s what it says: If you made only a small change like you were instructed above, it is a lot more work to click the close button of the window and after that click the yes button of the pop-up window then it is to hit the Enter key of the numeric keyboard to close the calculation icon. Switching between using the mouse and the keyboard is also less straining on your muscles, so keep this in mind. Now run your piece. You will see the 10 questions appear before the screen turns white, if you followed the instructions. Now the only problem is that Authorware has only stored the answer to the last ques-tion in the variable “Answer”, a variable that therefore is overwritten every time the participant answers a question. Answer therefore saves only the last response, rather than the answers to all ten questions. To address this problem, we will create a new variable which will contain a string of values - the 10 answers the participant gave to our questions. This variable we will eventually save to analyze. Open the map of the Continue button. Since every time the participant has answer the question he will have to click on the continue button, they will always go through

Page 56: Authorware Programming Guide for Reseachers- 2nd Edition

11. HOW ABOUT THAT QUESTIONNAIRE I MADE?

- 55 -

the flowline in this map, which makes it a great place to put a calculation icon to store their answers. Place a calculation icon on the flowline and name it SaveAnswers. Open it and inside type: AnswerStringSave := AnswerStringSave^Tab^Answer Here we create a new variable named Answer-StringSave. Every time we loop, AnswerStringSave will become (:=) the variable it already was, but with a Tab attached to it, followed by the current value of Answer (the answer to the current question). Now watch out: we will change the initial value of this variable. If you close this icon, save the variable, but in the text field ‘Initial Value’ type ‘999’ (see picture). Click ‘OK’. Run the experiment and look at the cur-rent value of AnswerStringSave in the variable win-dow (Ctrl+Shift+V open the window, in category, select ‘questionnaire.a7p’). You will see a value something like this: "999\t5\t2\t4\t3\t7\t6\t1\t3\t5\t2" What does this mean? This is a variable string, containing several separate values glued after each other as in the Golden Goose fairytale by Grimm, separated by a Tab which Authorware expresses by a \t symbol (In the final text file in which we save our data, the \t’s will be displayed as tabs). How did the 999 value get at the start of our answer string? Remember the expression we used to save our answers in an answer string: AnswerStringSave := AnswerStringSave^Tab^Answer. The first time a question is saved, AnswerStringSave will therefore change to its cur-rent value (at that moment 999) followed by a tab, and by the value of Answer (in this example 5). After this we see the nine other answer values. This is why we set the initial value to 999: so we know it is not a real answer. There are other separators you can use instead of a Tab if you want, for example return, or you can type “ ” to simply insert a space. That’s it! We made a good questionnaire, so save this because you will use it often! It is possible to expend it with more questions by letting it loop more often and adding questions. The RepCount function in Authorware is very useful, as is saving answers in a string like we did here. What if you want to display a variable within a variable? For example, you ask par-ticipants about their affinity with the Transformers cartoon in one condition, and about He-Man in the other, but you still want to loop the questions like above. Basically, what you want is: If RepCount = 1 then Question := “Do You Like”^CartoonName^”?” where CartoonName is set to Transformers or He-Man. Instead of pasting variables together like this, you can also display a variable in a variable: TIP: To display a variable in a variable, create string variable 1 with the sen-tence you want to embed variable 2 in. Then create variable 2 which contains

Page 57: Authorware Programming Guide for Reseachers- 2nd Edition

11. HOW ABOUT THAT QUESTIONNAIRE I MADE?

- 56 -

the variable you want to embed. Then create a third variable which meshes the two together like this: Var1 := "Do You Like Var2?" if condition = 1 then Var2:= "Transformers" if condition = 2 then Var2:= "He-Man" Var3 := Replace("var2",Var2,Var1)

Page 58: Authorware Programming Guide for Reseachers- 2nd Edition

12. OK, NOW GIVE ME SOMETHING DIFFICULT.

- 57 -

12. Ok, now give me something difficult. Are you sure? Yes? Well, ok, if this wasn’t difficult enough, let’s start with lists. Note that using lists can be quite complicated, and beginners often do not need to use them. If you don’t completely understand the concept of lists after reading this chap-ter, you can let it be and return here if you do need to use lists. A list in Authorware means almost the same as a string variable, only it has a little more options. Remember how a string variable saved multiple answers in one vari-able? Well, a list variable has a different value for every entry in the list, and these values can even be variables themselves. Lists can be used to organize the values, and to add delete entries at specific places in the list. This makes a list a very con-venient and versatile tool for handling a lot of variable values. It is very similar to one row in Excel; the row is the variable, and every column is a different place within the list variable. The best way to get a hang of lists is to use one. We are going to build a game. The game will be that the computer will show 5 different letters on the screen. Then the computer will show a + symbol, followed by either one of the 5 letters already seen, or any other letter. We could make the letter selection completely random, but then letters might be se-lected twice or more and we wanted five different letters. We could write the proce-dure out in a list of mutually exclusive expressions: if a is selected, then the next let-ter is either b, c, d etcetera. This would save time if there were only 5 trials and maybe even if there were 10 trials. But if there are 20 or more, it is quicker to just program a real random game. To make this game, we have to work with lists. How do you make a list variable? Let’s for once make a variable the official way: open the variable window and click on the new… button on the bottom. Name the new variable Alphabet. TIP: To make a new list, always type [] in the initial value field. If you type [] in the initial value field, Authorware will know this variable is a list variable. Never forget this. It’s a mistake often made. Now we need to fill this list. The easiest way to do this is set values directly into the list in the following manner: drop a calculation icon on the flowline, name it SetList and type in: Alphabet[1] := "a". This means the first place (or row, to continue the resemblance to Excel) gets the value ‘a’. Copy paste this 25 times, and change the numbers so they run op to 26, and change the letters so they run up to z. Now we made a list with “a” on the first spot, “b” on the second, all the way down to z. In Excel this would look like this: Alphabet =

Page 59: Authorware Programming Guide for Reseachers- 2nd Edition

12. OK, NOW GIVE ME SOMETHING DIFFICULT.

- 58 -

By creating a List variable, we can ask Authorware to display the letter at any (Alpha-bet[x]) location. Moreover, we can let Authorware modify this list: we can tell it to de-lete values in any column, to replace them, to delete columns, etc. Now, on with the programming. Beneath the calculation icon on the flowline, drop a display icon and name it “Stimulus”. Open it, and in the centre, type the variable name {DisplayStimulus}. This is where the 5 letters will be displayed. Close the dis-play icon, and save the variable. Here we will change the initial value, to “”. TIP: If you want a displayed variable to be invisible, set the initial value to “”. Note that you changed the variable from a numerical to a string variable. Again, don’t forget to check the ‘update displayed variables’ box in the display icons property window, or the variables displayed on the screen which are changed with the programming in the calculation icons will not be updated on the screen. Now we need to tell Authorware which letters should be randomly displayed. We want Au-thorware to show 5 different letters, followed by a +, and then either one of the 5 let-ters already displayed, or one of the remaining letters of the alphabet. How can we do this? Drop a decision icon on the flowline. Name it ‘LetterLoop’ and drop a map next to it. Set the loop to repeat fixed number of times, and fill in 6. Name the map next to it ‘GetLetter’. Open the map, and drop a calculation icon in it. Name it ‘WhichLetter’. Open it. To make sure we don’t get the same letter twice, we have to make letters that have already been selected unavailable, so that a single letter cannot be gener-ated more than once (There are other options, as always in Authorware, to do this). Then we have to draw a random letter from the letters left. So we need to know how many letters are left. In the calculation icon, type: LettersLeft := 27 – RepCount. The first time the number will be 26 (of course) and after every loop it will be one less, because one letter will have been asked. Then we need to draw a random letter from the remaining letters. We will generate a random number, and retrieve the letter on that place in our alphabet list. Type: Ran-domNumber := Random(1; LettersLeft; 1). We create a RandomNumber variable, ranging from 1 to the number of letters left, with increments of one. To make the displaystimulus variable this random letter, type: DisplayStimulus := Val-ueAtIndex(Alphabet; RandomNumber). This means that the variable Dis-playStimulus will become the value (ValueAtIndex is another system variable especially for lists, see the List category in the function window) at the place of the Alphabet string indicated by the random number (or inside that row in the Excel anal-ogy). So now we have our letter, we want to delete is so it will not be drawn again. Type: DeleteAtIndex(Alphabet; RandomNumber) to delete this letter (delet-ing the row in the Excel example; so now there are only 25 rows left). Now go to the variable window and click new. We need a new list, which will consist of all the letters we have drawn. This way, we can display the letters we’ve already drawn while being able to generate new random letters from the list. The new vari-able will be named ‘Letters’, and don’t forget to type [] in the initial value text field. You didn’t forget, did you?

Page 60: Authorware Programming Guide for Reseachers- 2nd Edition

12. OK, NOW GIVE ME SOMETHING DIFFICULT.

- 59 -

Now back in the calculation icon, save the letter we just draw in the new ‘Letters’ list. Using the expression Letters[1] := DisplayStimulus isn’t practical in a loop, because the second time we loop we want to store the letter we asked in the second location in the list. Instead, we will use another system function that does the same thing. Type: AddLinear(Letters ; DisplayStimulus) to add the letter (the current value of DisplayStimulus) to the Letters list. Note that when we do not specify a specific location in the list to store the value, the value will automatically be stored at the end of the list. Finally, we want the 6th display stimulus not to be a letter, but a +. We can program this by typing If RepCount = 6 then DisplayStimulus := “+”. Be sure to type this at the bottom! Authorware will perform the commands in the calculation icon from top to bottom; now the 6th loop, it will first draw a random letter, but finally change the DisplayStimulus variable value to a +. There are other way to show a + symbol after we have shown 5 letters (for example by using a new display icon) but this works just as well. Everything together, the programming inside the calculation icon will look like this:

Close the calculation icon, and save all new variables. Underneath this calculation icon, place a wait icon. Set the wait time to 1, and uncheck everything. Now the let-ters will stay on the screen 1 second before the display stimulus changes. TIP: Note that is you would want to save a list in your data text file, you need to convert it into a string variable. See chapter 14, page 61. Using the functions ValueAtIndex, DeleteAtIndex and AddLinear allows us to manipulate a lot of different values. With AddLinear we created a new list, from which we now in 50% of the cases want to draw a random letter to show. In the other 50% we want to draw a new letter from the remaining letters in the Alphabet list. Beneath the loop, drop a decision icon. Set it to branch randomly to any path. With this option, Authorware will randomly choose any path. Usually you will want more control over where participants go, but this time, the option comes in handy. Another option is branch to unused path, to randomly send the flowline through several at-tached maps until all maps are taken, but we won’t use that now. Drop a map next to

Page 61: Authorware Programming Guide for Reseachers- 2nd Edition

12. OK, NOW GIVE ME SOMETHING DIFFICULT.

- 60 -

it and name it OneOfFive. Drop a calculation icon in the map. Here we will choose a random letter from the 5 already shown. Type in: RandomNumber := Random(1; 5; 1). Note that we re-use the variable RandomNumber here, but that’s no prob-lem. We want to draw one of the 5 letters. TIP: To keep the total number of variables down, you can recycle variable names you used before. Then we have to assign the letter on the place of the RandomNumber (ranging from 1 to 5, so for example if the value of the RandomNumber is 3, this would mean the 3rd column in the Excel row) to the variable DisplayStimulus. Type: Dis-playStimulus := ValueAtIndex(Letters; RandomNumber). The letter on the position of the random number will become the DisplayStimulus variable. Under-neath it, type: SameDifferent := 1. This is a new variable that will be 1 if the flowline passed through this icon, meaning that the 6th letter shown was the same as one of the 5 before. Close the window. TIP: When saving the variable SameDifferent, in the description you might want to add that 1 means same, 2 means different letters. Copy this map and past another next to it to save some time. Name it OtherLetter. Open it. There are some small differences. Here, we want to draw a random letter with the minimum still 1, but the maximum is to be the Let-tersLeft. So replace the 5 in the first line with LettersLeft. Then we want to draw a random letter not from the Letters list, but from the Alphabet list, so change Letters into Alphabet. Finally, here the SameDifferent variable has to get the value 2, because the letter the participant sees is a different one from the six before. That’s it. Close the calculation icon and run your piece to see if everything works. Now we want the participants to give their answer. Was the letter one of the five seen before or not? This means we will have to drop an interaction icon on the flowline. Double-click it, and with the text icon type: Did you see the last letter before? Type y if the answer is yes, and n if the answer is no. Set it in the centre of the screen. TIP: You can change the alignment of the text by selecting it and pressing Ctrl+[ to left align, Ctrl+] to right align, Ctrl+\ to centre it, or Ctrl+Shift+\ to jus-tify the text. Drop a map icon next to the interaction icon, select key-press and name it Yes. A key-press interaction simply means the participant has to press a specific key to con-tinue, instead of clicking on a button. In the key press tab you can specify the key Authorware has to react to. In the text field, type: "y". TIP: To make sure lower and uppercase letters are accepted, type “y|Y” in the text field. This means the key press will respond to y or Y.

Page 62: Authorware Programming Guide for Reseachers- 2nd Edition

12. OK, NOW GIVE ME SOMETHING DIFFICULT.

- 61 -

Set the Branch option to Exit Interaction in the Response Tab. In the map, place a calculation icon. We want to check if they made the right response. For yes to be the right response, the value of SameDifferent had to be 1. So in the calculation icon we type: If SameDifferent = 1 then AnswerCheck := 1. Copy past this sen-tence, and change it into If SameDifferent = 2 then AnswerCheck := 2. AnswerCheck is a new variable that stores if the participants gave the right answer. Close the icon, save the variable, and maybe add in the description field 1 means correct, 2 means wrong answer. Copy this whole map next to it, and change the key in the key press tab into “n”. If they have not seen the letter before and press “n” the answer is correct this time (so it is the other way around as in the other calculation icon), so we will write If SameDifferent = 2 then AnswerCheck := 1. and If SameDifferent = 1 then AnswerCheck := 2. It can be hard to keep track of when responses are right and wrong, so pay attention while programming! Drop an erase icon underneath this all and erase everything (or save nothing). Now we want to give them feedback how they did. If their answer was wrong, we will show ‘Wrong’ in a display icon, if it is right, we will display ‘Right’. If they see the one or the other depends on the value of AnswerCheck: if it is 1 they will see ‘Right’, if it’s 2 they will see ‘Wrong’. Drop a Decision icon on the flowline, set it to branch to calcu-lated path, and in the text field type: AnswerCheck. Drop a map next to it and name it ‘Right’. In it, drop an interaction icon and attach a map. Again choose a key press interaction. Double-click the interaction icon, and with the text cursor type: Right! Press any key to continue. Now go to the key press interaction. Set it to branch: exit interac-tion. Leave the text field on the key press tab empty, but type ‘?’ in the title field. TIP: To create a ‘press any key to continue’ interaction, put a ‘?’ question mark inside the title field of a key press interaction. This is comparable to the * wildcard in the title field of a text entry. Copy-past this map and rename it Wrong. Change the text in the interaction icon to Wrong! and that’s it. Now the idea was to loop the same task 20 or 30 times. But remember that we used a lot of variables and changed their values. If we loop the same piece, there will be letters removed from the alphabet list, letters are already added to the letters list, et-cetera. To prevent this from causing mistakes, we can set all variables back to their original state. This way you know for sure that if it worked the first time, it will work the second time this part loops. At the bottom, place a calculation icon. In it, type: Initialize(Alphabet; Letters; LettersLeft; DisplayStimulus) Initialize is a function that resets all variables to their initial values. TIP: You can only specify 10 variables after each initialize command; how-ever, you can place several initialize functions in a calculation icon.

Page 63: Authorware Programming Guide for Reseachers- 2nd Edition

12. OK, NOW GIVE ME SOMETHING DIFFICULT.

- 62 -

It is also very practical if you loop your entire experiment (so you don’t have to restart it for every participant) because with the command initialize() (without specify-ing which variables to reset) you can reset all variables to their initial values and start with a clean experiment. Also, if you loop, the variable AnswerCheck will be overwrit-ten, so this is a good place to make a new variable string with all the answers as we did before, so type: AnswerCheckAllSave := AnswerCheckAll-Save^Tab^AnswerCheck. Then again erase everything with an erase icon to start with a clean presentation screen next loop. Sometimes in Calculation icons you want to make a note so if you read the pro-gramming 3 weeks later or if someone else reads it, an explanation is given about what is done in the calculation icon. TIP: To make comments inside a calculation icon, start by typing to -- hy-phens before writing. For example, you might want to remind yourself that initializing means resetting all the variables to the initial value. The calculation icon would look like this:

Now select all icons, press Ctrl+G to group them, and loop them any fixed number of times. Now this was pretty advanced programming, but it is useful to know if you have something complicated to program with variables with a lot of different values you want to keep organized. There are a lot of other options with lists; you can sort them, add values or add lists together, making them a powerful way to handle data in Authorware.

Page 64: Authorware Programming Guide for Reseachers- 2nd Edition

13. IS THAT THE BEST YOU CAN DO?

- 63 -

13. Is that the best you can do? Yes. Considering this was meant to be a beginner’s guide, definitely. Actually, this may have been a bit too much, but we still have something difficult we have to attend to. Remember that when we put 2 text entries next to an interaction icon, only 1 text entry appeared on the screen, whereas we could have several hot-spots on one screen? That’s because Authorware thinks a text entry is a difficult enough interac-tion on its own compared to buttons or hotspots. But what if we really want several text entries on one display screen? How do we manage that? There really isn’t that much in Authorware that is really impossible. You only have to know how. In this example, let’s build the first screen of your experiment. That’s where you will want to type in the participant number and the condition the participant is in. You could do this on 2 different screens, avoiding the problem, but here I will show you how to have 1 screen where you can type in several text entries. For this, we need a new icon. After this example, we will have used all the icons in the Icons Bar except the knowledge object, DVD and digital movie icons which we

will not discuss in this guide. First, drag the Framework icon ( ) to the flowline. The framework is a convenient way to group related pages and let participants navigate through the pages with the standard naviga-tion panel, similar to reading a book. Run the piece to see the standard navigation panel. This is without a doubt the most hide-ous standard button set ever. Luckily it is easy to use normal buttons or import your own buttons in the framework.

In our experiment, participants normally cannot browse back to re-read previous pages. However, if you want to enable this, you could use a framework icon for this. Drop several display icons next to it

(see the picture on the left). Open the first display icon, and somewhere on the screen type ‘Page 1’. Open the other display icons and write the corresponding page numbers on them. Now double-click the navigation icon itself. You will see the same as the picture here on the right. That’s a lot of stuff we are getting by just dragging a framework icon on the flowline, isn’t it? Why this is the standard option beats me, because most of this we don’t want. What we get is a complete navigation structure, where participants have buttons for everything: to exit the framework, to go to the first or last, previous or next page, and even a ‘find’ button to search for words within the text on the pages in your framework! First, double-click the display icon named ‘grey navigation icon’. As you can see this is the background of the buttons. We don’t need or want this, so delete the display

Page 65: Authorware Programming Guide for Reseachers- 2nd Edition

13. IS THAT THE BEST YOU CAN DO?

- 64 -

icon. Now we only have 1 interaction, where we can press 8 different buttons. Usu-ally, you won’t need all of them. Let’s strip this navigation icon down to the basics; delete every icon except the exit framework, previous page and next page buttons. Notice that the navigate buttons are not set to Exit the interaction, or to Continue, or to Try Again. Instead, they are set to Return. You can only do this with Perpetual but-tons: buttons that are not erased after displayed on the screen, but that remain visible and they can be clicked, even if the participant is in another interaction. The Return option means that if a participant is in another interaction and presses the button, they will Return to the location of the button and continue from there. This could be practical if you want to show a button on screen which is constantly available to par-ticipant, for example a ‘Help’ button. Here however, it is just the standard setting. This is because if the navigate buttons are not set to perpetual, the flowline will not con-tinue, and the navigate buttons will be shown, but not the subsequent maps you want to navigate through. Run the Authorware piece. As you can see, we can browse through the page, and exit the framework. However, we are still not content. We want to fix 2 problems; first of all, we want participants to be able to exit a framework only when they are on the last page, so that they will at least have seen (and hopefully have read) all previous pages. Second, now participants go back to page 1 if they click on the ‘next page’ button when they are on page 4. We will solve both problems in the same way, namely by creating the variable PageNumber to keep track of the page we are on. Right-click on the first display icon and select ‘calculation…’ to open a calculation icon attached to the display icon. Inside, type PageNumber := 1. Authorware will set the variable PageNumber to 1 when displaying this display icon. Attach calcula-tion icons to the other pages as well the change the variable PageNumber to the cor-responding page numbers. We can now tell Authorware which buttons should be ac-tive on which page through the Active If: field on the Response Tab of each navigate button by for example typing: PageNumber <> 1 if we want the button to be active if the page number isn’t one (which world be appropriate for the previous page button), of PageNumber = 4 for the Exit Framework button to be active only on page 4. While you are on in the Exit Framework button properties window, and click the ‘Buttons…’ button. Change the to something participants will recognize as an exit button, for example a normal button with ‘Exit’ on it. TIP: When working with frameworks, put all display icons you want to keep displayed over the different pages on the flowline inside the framework, where the standard ‘Gray Navigation Panel’ is located. After showing you the standard function of a framework, we will now use it to navi-gate between 2 text entries interactions which we want to show on the same screen. Save this framework as Framework if you think you will use it in the future, and open a new Authorware piece by clicking File>New>File. Instead of browsing through different pages, we want participants (or the experi-menter) to browse through several text entries attached to the framework. First, drop a map icon to the right of the framework icon and name it ParticipantNumber. In this we will build a text entry interaction. Open the map, drop an interaction icon on the flowline and name it ParticipantEntry, then drop a calculation icon next to it.

Page 66: Authorware Programming Guide for Reseachers- 2nd Edition

13. IS THAT THE BEST YOU CAN DO?

- 65 -

TIP: Instead of always dropping a map icon next to an interaction icon, and placing a calculation icon in the map, directly attaching a calculation icon to the interaction icon will save you some clicks. Choose text entry and click ‘OK’. Double click the text entry icon. For the title, type in a wildcard ‘*’ in the title field so that you can type in any number you want to and still exit the interaction. Set the branch to Exit Interaction. Double click the calculation icon. This is where we will save the text entry as the participant number. A common name for the participant number is PPNR, but personally I use: ParticipantNumberSave := NumEntry Close the icon. Then for the fore last icon we will discuss: the navigate ( ) icon. It won’t surprise anyone these icons are mostly used in-side Frameworks as an addition or replacement of the standard navigation panel. Drag-and-Drop it from the Icon bar to the end of the flowline. It will say the navi-gate icon is unlinked. That means right now the navi-gate icon is not set to navigate to anywhere. Where do we want this icon to navigate? This icon will navigate to the condition text entry, which we will create to the right of this map icon. To navigate to the next map attached to the framework, double click the navigate icon, and in the properties window in the Destination window select the ‘Nearby’ option. There are actually a lot of correct ways to set up the navigate icon correctly: When we have made the second map with the condition text entry, we could choose ‘Anywhere’ and select the Condition map, or we could select calculate

and type in the icon’s name. For now, in the ‘Nearby’ menu choose ‘Next’. If you do this, the navigate icon on the flowline will look like the picture on the left.

Since this is a good working text entry, copy past this map next to this one for the Condition text entry (be sure to place the white index hand on the right of the partici-pant map while pasting). Name the map Condition and in it change the word Partici-pantNumberSave in ConditionSave, and name the interaction icon ConditionEntry. Especially don’t forget to change the calculation icon. TIP: Copy-Paste carefully, especially when you are also copying variable

SIDESTEP ON NAVIGATING THROUGH YOUR PIECE Now you have seen the flowline isn’t a straightjacket. Actually, there are quite some options to move around more freely. One is the navigate button on the flow-line. Another useful way is to use the GoTo function within calculation icons. If you type: GoTo(IconID@"Question1") Authorware will jump to the icon some-where in your piece named ‘Question1’ and continue from there. Note that you must give the icon a unique name for the GoTo function to work. You can also use this combined with the if – then structure, e.g. If score < 200 then GoTo(IconID@”Test”).

Page 67: Authorware Programming Guide for Reseachers- 2nd Edition

13. IS THAT THE BEST YOU CAN DO?

- 66 -

names. Be sure to change the variable names immediately after copying. You don’t have to change the ‘next’ navigate icon, because in the last icon to the right of the framework icon, this means navigating to the first icon again, enabling you to change the text entries to correct them if necessary. Now we need a display screen to clarify what we are typing in where. Where would be the best place to put this? It depends on what you want: if you need a different display screen with each text entry, put different display icons in the 2 maps. We are more in-terested in 1 display screen where the different text en-tries will appear. To achieve this, put the display icon within the framework icon and name it ExperimenterScreen. Open it and type: Enter the participant number and condition. To be able to know which text entry you are in, make the screen look something like the example above. Run the experiment. Chances are, the text entry will not be on the right spot. Open the Control panel (Ctrl+2) and pause the presentation to move the text entry to the right place on the presentation screen. Press enter, pause it again, and relocate the second text entry. Then, in the framework icon, preserve the interaction icon but de-lete all the buttons and the navigation panel, yelling: U-G-L-Y, you ain’t got no alibi, you’re ugly! You’re ugly! We put our own navigate icons (without buttons) in the 2 maps. Now we can fill in the participant number and the condition. Again. And again. But there’s not yet a way to exit the interaction. We must create an exit button, next to the interaction icon inside the framework. Drag a navigate icon to the right of the interac-tion icon and choose a ‘button’ interaction. Again Author-ware tells you the button is unlinked. Double-Click the but-ton to go to the properties window. The title of this button is ‘unlinked’, change it to the more appropriate ‘continue’. Furthermore, assign a keyboard key to exit the framework, for example the letter ‘c’ by typing it in the Key(s) field. Now double-click the navigate icon itself. From the Desti-nation pull-down menu choose ‘Nearby’ and then check the radiobutton for Exit Framework/Return. This tells Authorware to continue with the flowline below the framework icon. Enlarge the continue button. The bigger a button is, the easier it is for yourself and your participants to click it. Run the piece again. Pause it to place the continue button in a better location (al-though it doesn’t really matter that much). Type in some numbers. First of all, you will

Page 68: Authorware Programming Guide for Reseachers- 2nd Edition

13. IS THAT THE BEST YOU CAN DO?

- 67 -

notice the letters disappear from the screen after entering them. Even if you disable the option ‘Erase text on exit’ in the properties, Text Interaction Options screen, or set the Properties: Response Erase pull-down menu to ‘Don’t Erase’, the text will disap-pear because these options are valid only until you encounter a new interaction, and here we are jumping between 2 text entry interactions. If you want to see your text entry on the screen to be able to check if you typed in the right participant number, go to the ExperimenterScreen display icon in the framework icon. First, in the properties screen, check the option ‘Update Displayed Variables’. Now open the display icon and type {ParticipantNumberSave} and {ConditionSave}, presuming these are the names you used to store the variables. Don’t worry to much about their location, we will move them to the right location later. Run the piece again. You will notice the numbers do not appear exactly on the same spot where you typed them. To change the position of the text, pause the piece and double-click the text. TIP: When moving one of several items in the display screen, be sure to only select the part you want to move. After double-clicking, all the parts on the display screen are selected. Click again on the correct word to move only that. This actually is a lot of work if you want to be pre-cise, but there is no other way to do this. Changing the mode of the text entry and text on the display screen to ‘transparent’ makes it easier to let the numbers overlap exactly. Too bad there’s no option in Authorware to keep the entry text displayed on the screen. Run the piece again. You will notice that after entering the condition number, the cur-sor will jump to the participant number entry again, but the number has disappeared. I admit, we are only fine-tuning for educational purposes here, but there is a way to solve this problem. We can pre-set the entry for a text entry interaction, so that we only have to press return to confirm the entry. Go to the ParticipantEntry interaction. We want to tell this interaction to display the text entry of the experimenter when we enter the interaction for the second time. We can tell interaction icons specific things with calculation icons. We could just put a calculation icon above the interaction icon. But Authorware has also the option to at-tach a calculation icon to an interaction icon. Go to the interaction icon and right-click, and from the menu choose ‘Calculation…’. A calculation window will open. In the window, type: If ParticipantNumberSave <> 0 then PresetEntry := Participant-NumberSave This means that if the Participant number is no longer 0, so after it has been entered by the experimenter, the saved value should be used as a preset entry. A preset entry can also be very convenient if you want par-ticipants to write a story and later ask them if they want to add something to the story. Close the calculation window. You will see a small calculation icon attached to the upper left corner of the interaction icon. It does the same thing as a calculation icon just before the interaction icon, but it can

Page 69: Authorware Programming Guide for Reseachers- 2nd Edition

13. IS THAT THE BEST YOU CAN DO?

- 68 -

come in handy to attach it to the interaction icon itself. Run the piece again. You can fill in the numbers and easily edit them, and click on the continue button to exit or press ‘c’. Save this as ExperimenterScreen, because you will put this at the beginning of every experiment you will run. You can even add more number in this first screen by copying the maps to the right of the framework and changing all the names. That’s another useful part of your experiment! Now if we fill in the participant number and the condition and press enter, we can change the participant number. However, if we do so, but forget to press the Enter button, Authorware will not guide the program through the calculation icon inside the text entry interaction map, and so the value will not be updated. If the participant number was 12, and we change it to 13 without pressing the Enter key, it remains 12. This is even a bigger problem if you want participants to type in a value and press enter before clicking the continue button, because if they don’t press enter, the text entry will not be stored. Thankfully, there is another way to save a text entry. Underneath the interaction, drop a calculation icon on the flowline. Name it SaveIcon and open it. Inside it, type ParticipantNumberSave := Entry-Text@“ParticipantEntry” and underneath it type: ConditionSave := En-tryText@“ConditionEntry”. This is a much more elegant way to save text en-tries, and I recommend you use this instead of the calculation icon inside the text en-try interaction map. This way you don’t have to force participants to press the Enter key before continuing. Keep this in mind. You can use the additional @”SomeName” behind more variables, for example in Repcount@“PreviousLoop” to refer to a specific variable. Authorware keeps track of all these system variables throughout the interaction. In this example, open the exit framework button, and in the Active If screen type: EntryText@”ConditionEntry <> “”. This means that the continue button is active only if there isn’t nothing (or if there is something) in the TextEntry field. Oh, yeah, I almost forgot. In this example I would discuss all the relevant icons ex-cept knowledge objects and DVD and digital movie icons. That means that we have

to incorporate the Motion icon into this example. Well, here we go. The motion icon enables you to introduce movable objects to your Authorware piece. Though this might be just what you want for your experiment to visualize something in a game people have to play, chances are you will never use this function. Drag a Motion icon beneath the ExperimenterScreen Display icon but above the in-teraction icon and name it MoveText. As with the erase icon, you have to specify which icon has to be moved. As long as you haven’t done this, the program will stop when you run it, and the properties window of the icon will be displayed. TIP: The program will automatically stop when it encounters an empty dis-play or calculation icon or an unlinked motion or erase icon. Whenever the program terminates unexpectedly, check if there’s an empty icon on the flow-line. We will use this to, when Authorware stops, click on the contents of the display

Page 70: Authorware Programming Guide for Reseachers- 2nd Edition

13. IS THAT THE BEST YOU CAN DO?

- 69 -

screen to tell Authorware to move the objects we click on. Run the piece. The con-tents of the display icon will be displayed, and the properties window, asking you to:

Click on the text, and the properties window will change into:

We won’t drag the text anywhere (making the motion icon move it there while run-ning). Also the setting ‘Wait until done’ is ok, and the time of the movement, 1 sec-ond, is fine. Close this icon. Right-Click on the display icon and open the properties window of the ExperimenterScreen. We will change the starting position of the text, resulting in the motion icon moving the text to the location we put the text to begin with. In the pull-down menu named positioning, change ‘No Change’ into ‘On Screen’. Now we can fill in the X and Y coordinates of the text. Set X and Y both to -50, making the text appear from the left top of the screen. You will see a stunning visual effect next time when you run the experi-ment. However, sometimes this option of moving object can be useful, so now you know. You’ve used all the icons, learned some important information, got acquainted with some functions and system variables and worked with some different interactions. Since this is supposed to be a beginner’s guide, we are almost done.

Page 71: Authorware Programming Guide for Reseachers- 2nd Edition

14. SO LONG, AND THANKS FOR ALL THE FISH!

- 70 -

14. So long, and thanks for all the fish! Hey, wait a minute! Are you sure? Aren’t you forgetting something? Now you know how to build an experiment in Authorware, don’t you want to know how you can save all the data so you can analyze it? If you are really sure you got all the info on pro-gramming you need to make your own experiment, just read through this chapter and you are really done, ok? When you are done building you experiment, you’ll have a lot of answers to questions you will want to store. Authorware can store the answers to questions in a text-file (ending with .txt) which you can open with the Notebook or in Word, or which you can read in a statistical program (SPSS has a read in text data command). Saving your data happens in a calculation icon. In your experiment, put the calcula-tion after your last variable has changed (usually after the last question you ask). The flowline needs to go through this data save icon, so be sure not to put it after the last screen where you will stop the program! Put a calculation icon on the flowline. Open it. There are 2 functions with which text data can be stored, WriteExtFile and Ap-pendExtFile. The first makes a new text file and saves the data in it, the second command adds the new data to an existing text file. When saving data from several participants to one file, you should use the AppendExtFile command.

Here you see an example of a calculation icon that stores data. Let’s take a closer look at it. The first line makes a new variable, named Data. It is a string variable, which means it contains all subsequent variables in one big string of values, with tabs in between. An example would be ‘1 3 5 9 2 43 1 3 2’. Some researchers prefer to put the names of every variable before its value(s) in the save file, so they can quickly tell which is which. To do this, you should change the expression to: Da-ta:=”ParticipantNumberSave”^ParticipantNumberSave^Tab^”Condition-Save”^ConditionSave^Tab^”AgeSave”^Agesave^Tab^”Answer1Save”^Answer1Save^Return. Now the names of your variables will be saved to your text save file as well. Beware, SPSS does not process text very well and might not dis-play your names in your dataset. In this example all the variables that need to be saved have names ending with ‘Save’. So, how do you make sure you don’t forget a variable? Well, best thing is to check and double-check if you have the answers to all the questions you asked written down. Another good way to check is to open the variable window by pressing Ctrl+Shift+V. In the category menu, select the name at the bottom of the menu, which will be the name you gave to your experiment. Select this, and in the scroll down menu beneath it you will see all the variables (except sys-

Page 72: Authorware Programming Guide for Reseachers- 2nd Edition

14. SO LONG, AND THANKS FOR ALL THE FISH!

- 71 -

tem variables) you used in creating the experiment. If you write all these names in the calculation icon, you’ll have all the data you want. But most of the time you only need a selection of these, for instance only the ones which have ‘Save’ as the last word in the variable name. TIP: If you want to save a lot of variables, all the names may not fit on the first line. To cut the long string of words in several pieces and place them on several lines, add a continuation ¬ symbol at the end of a line as you can see in the programming below by holding down the ‘Alt’ button while pressing ‘Enter’.

Now you want your string to have separations in between the different variables, so you know where one variable ends and the other begins. There are several options, and they all work. Most important is to hold on to one consistent way of working. In the example on the previous page, the spaces in between the variables are a Tab. Tab is a system variable as well. If you would rather have a space as a separator between variables, instead of the Tab you can type in “ ”. This way, you are actually inserting a word in between the variables, only here the word is a space. Alterna-tively, as some people do, you could have a variable SPACE, and tell Authorware SPACE := “ ” as in the example on this page. All these values together form a string. TIP: To create a string variable, you have to put a concatenation operator ^ between every variable to join character strings, and you can put a Tab or space between them for clarity for yourself. At the end of the string variable Data, you see Return. Return is a system variable as well, which makes the output file start a new line in the text file: a good way to keep your output organized. When saving your variables in the strong variable Data, there is one thing which is very important: you cannot add a list variable in a string variable. This will result in a conflict, and your data will not appear in the text file. You can think of it as trying to paste a row in excel in a word file: in order to succeed, the excel row needs to be converted into text. In order to save a list variable in the data strong variable, you will need to convert the list variable into a string variable. A list variable contains the [ ] brackets around all the values that tells Authorware the variable is a list. By stripping these brackets away from the list variable, the result will be a normal string variable. TIP: Always STRIP your list variables before saving them as part of a bigger string variable. The STRIP function in Authorware will do just what we need to remove the [ and ] characters from the list variable. Before saving the variable, but the following in a cal-culation icon:

Page 73: Authorware Programming Guide for Reseachers- 2nd Edition

14. SO LONG, AND THANKS FOR ALL THE FISH!

- 72 -

YourList := Strip("[];"; Yourlist) This programming will strip the [ ] and ; characters from your list. If for any reason you want to strip more character from your list, you can add them here as well. If you want to strip the “ character itself from your list, you have to place a \ in front of it, or Authorware will get confused. So: Strip("\""). If you prefer to save your data tab delimited, you want to replace the spaces between the values the strong variable which used to be a list variable by tabs. We use the REPLACE function for this, the replace the spaces (“ ”) in your list by tabs: YourList := Replace(" "; Tab; Yourlist) The AppendExtFile will add each new data string to the same file, at the end of the previous string. By putting a return at the end of your string, the next string of data will start on the next line in the data text file. TIP: Ending your data string with a Return variable will results in a well-organized data file. We made all our data into a string variable called Data because the Ap-pendExtFile can only write 1 string variable to the computers hard-drive. On the next line is the AppendExtFile function, followed by ( ) brackets to define the 2 pa-rameters. The first is the location and name of the file we are saving, and followed by a ; symbol is the string variable we want to save. TIP: Use a new variable name for the data file of a new experiment (but not sessions within an experiment) you run, even if you only add the date so you don’t accidentally overwrite old data. The location of where to save the data is also a variable name for Authorware, that’s why it’s put in between “ ”. A normal name would be “C:\\My Docu-ments\\Experiments\\Data23-02-2005.txt”. The data would be stored on the C drive in the Experiments folder inside the My Documents Folder, and named ‘Data23-02-2005.txt’. The string name we want to save is, of course, the Data string we defined before. An alternative to using a fixed path such as the one above is to use the system variable FileLocation to store your data in the same folder as where your program is running from. TIP: Instead of typing in the path (e.g., WriteExtFile(C:\\My Docu-ments\\Experiment)) you can use the system variable FileLocation, which will be the same location on the hard-drive as where the Authorware program is running from. Use for example: WriteExtFile(FileLocation^”Data”; Data). This is especially convenient if you run the experiment on a computer that features a directory structure different to the structure on your own computer (an example is saving to the Windows directory, which has a different name if the operating system is Windows NT). If you’ve used this method of saving, you’re able to find your data if you know where you’ve put your Authorware file. Note that you need to have permis-

Page 74: Authorware Programming Guide for Reseachers- 2nd Edition

14. SO LONG, AND THANKS FOR ALL THE FISH!

- 73 -

sion to create and change files on the hard drive to store text data, which is another reason why the system variable FileLocation is convenient; if you can copy-paste your program somewhere, you most likely also have the right to store your data there. TIP: Always check if the data is stored correctly before running an experi-ment. And when I say always, I mean always. There is so much that can go wrong, and you don’t want to forget variables. Best is to Test run, and import the data in SPSS to see if you have everything to analyze the data. You need to import your data eventually anyway, so creating the syntax to read in your data is not a waste of time. Sometimes, people want to store the data in variable filenames, most of the times the want files to start with the participant number. The location of where to store the data is, as I said before, a variable name for Authorware. Because it is a word and not a number, you have to put it in between quotation marks (“ ”) so Authorware will know it is a word and not a function or variable. You can put a variable in the name of the file location if you want. The name will then consist of a fixed name part that is the same for all data files, then a variable part, which is unique for every data file (usually the participant number, and an extension (such as the .txt part). To connect vari-ables, you had to add a ^ in between them. So having a variable name according to the participant number would be written as: “C:\\LocationOnHardDrive\\”^ParticipantNumberSave^”Data.txt”. Saving data in this way would result in a text file being save on the C-disk, in the folder specified in the LocationOnHardDrive part (for example My Documents) and in that folder would appear a text file for every participant, named 1Data.txt, 2Data.txt, etcetera. Note that appending the new data to the old file is useless if you save the data of every participant in a new text file, and you would have to import a lot of dif-ferent cases in SPSS, but sometimes, for example when saving qualitative data, this option can be useful. TIP: It might be useful to store any large text entries (e.g., if you ask partici-pants to write up what they did the day before) in a separate text file. This way it is easier to import your data into SPSS since there are no text entries of vari-able length in between your questionnaires. Did I say you always had to check if the data is written to the drive the way you want? Well, you have to. One more advice: When Authorware writes data to a disk, Author-ware changes the System Variable IOStatus. If every-thing goes right, the value is 0, is something goes wrong, the value is 1. Things almost always go right, but it never hurts to be safe, so we want Au-thorware to loop the data save calculation icon until IOStatus = 0. First, put the calcula-tion icon in a loop (see previous example and picture) and then set it on repeat until true, with in the text field IOStatus = 0 & Rep-Count > 0. RepCount is another system variable, counting how many times the par-ticipant repeated (went through) the loop, which has to be 1 time at least, so > then 0.

Page 75: Authorware Programming Guide for Reseachers- 2nd Edition

14. SO LONG, AND THANKS FOR ALL THE FISH!

- 74 -

One word of warning, though: if you plan to save your data to a server, always save on the harddisk of the computer first. If you use the IOstatus method described above and save to the server first, a server problem will cause you to lose your data (as Au-thorware will infinitely attempt to reach the (malfunctioning) server. The opposite of the WriteExtFile is the ReadExtFile option. In a similar way you write a text file, you can also use ReadExtFile to get data from a text file. This is a useful command if you want to exchange data between 2 computers, for example when you want two participants to work together in real-time. For example, we could first create a variable containing the data in the text file we are reading, and then retrieve the first value from that data. The programming would look like this: RetrievedData := ReadExtFile(“C:\\My Docu-ments\\Experiments\\Data.txt”) ValueWeNeed := GetLine(RetrievedData; 1) From the data we retrieve the first line (lines are separated by returns) and save it as ValueWeNeed.

Page 76: Authorware Programming Guide for Reseachers- 2nd Edition

15. NO AUTHORWARE PROGRAM IS AN ISLAND.

- 75 -

15. No Authorware Program is an Island. Your Authorware experiments, like yourself, like to feel connected. Really, they do. I wouldn’t go so far as calling your program a sentient being (although I’ve come close to doing so), but often, your program reaches out to others. Not other humans, natu-rally, but most often, to other programs, or to the network drive. In this chapter, you will learn two things. First of all, why and how you should jump from Authorware to another program. Harmless enough. Second, though, you will learn how to save data over a network, and how to read data over the network. This is a convenient trick for saving the data from multiple cubicles in a single text file, for example, but be warned. The potential of this simple technique reaches way further then storing your data. It enables communication between cubicles! Social psychologists often feel comfortable with being limited in their programming to building individual experi-ments, where participants are confronted with the pre-programmed ‘Other’. Now if, for whatever reason, it would be best for your next experiment to dramatically break with decennia of research by actually studying multiple individuals in a real interac-tion, after reading this chapter, you will actually be able to do so. No more hiding be-hind technical limitations, so beware! First of all, jumping to another program. This is a fairly straightforward matter, and has been briefly mentioned earlier in this workbook. Let’s say you are running an ex-periment where people have to solve difficult calculations. As a control condition, you decide they should do the same calculations, but by using a calculator. So, you want to start the Windows calculator at a certain moment in your experiment. Authorware has some built in functions for this, which can be found in the Jump category in the function window. We have 4 Jump function options. JumpFile and JumpFileRe-turn can only jump to other packaged Authorware programs. To start another pro-gram, like the calculator, we need JumpOut or JumpOutReturn. The only difference between the two is that JumpOutReturn means you want to return to the Author-ware program, whereas with JumpOut, the Authorware file will be terminated upon starting the other program you are jumping to. So, we need the function JumpOutReturn. All you need to do is specify the name (and location) of the program you want to start. First, before testing all this out, drop a wait icon on the flowline. The reason for this is, that if you start your Authorware file, the program automatically starts running it. Now if you made a serious mistake in your programming (and indicating a wrong location for a file is such a serious mis-take) your experiment will crash, the Authorware program terminates, and even if you have saved your experiment, when restarting your program, Authorware will start up your file, run it, and immediately crash again. You will lose ALL programming in your file, so watch out! TIP: while testing out new programming commands, never start with the cal-culation icon on the beginning of the flowline. Now we are starting the calculator, a program that is not located in the same folder as our experiment. Therefore, we need to write the following in a calculation icon:

Page 77: Authorware Programming Guide for Reseachers- 2nd Edition

15. NO AUTHORWARE PROGRAM IS AN ISLAND.

- 76 -

JumpOutReturn(“C:\WINDOWS\system32\Calc.exe”) Note the location of the calculator is put between “”. If you run this program, Author-ware will first ask you if you want to save any changes you made, and upon running the program, the calculator will appear, while your Authorware experiment will remain on the background. There is a second variable you can add to the JumpOutReturn function, namely the file to open with it (and you should also include the location of this file if it’s not lo-cated in the same folder as your Authorware experiment is located). For instance, to repeat an example given earlier: JumpOutReturn("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe"; “C:\\Video.flv") This command will open the VLC media player, and open a video (named Video.flv) located in the C:\\ folder. Now let’s get a little more specific. We can use a similar approach to start a second Authorware experiment from a first one. No why would we want to do such a thing? A good reason is when one experiment is yours, and the second experiment is made by someone else. You could combine these by copying your entire experiment to the experiment of the other, but there are some possible complications with that ap-proach. First of all, there is a font issue. If your standard font differs from the font of the other person, the first experiment you copy-paste in the second experiment will all of a sudden have the standard font of the second experiment, messing up your layout and buttons. Not nice. A second problem might occur if you refer to the names of specific icons. For instance, if you use DisplayIcon(IconID@”1”) to display an icon you titled “1”, then this command will no longer work if there is also an icon titled “1” in the other experiment. Similarly, functions like Goto(IconID@”...”) will not work if the icon title is the same as an icon in the other experiment. Overall, you will find that jumping from one experiment to another might be less work then copy-pasting one experiment into another, especially if it involves making some changes to your program due to font issues. So, how does this work? Overall, things are pretty similar to starting any other program. Only this time, we use JumpFile or JumpFileReturn instead of JumpOut and JumpOutReturn. How-ever, there is a catch: naturally, we don’t want to have to type in the Participant-Number and the Condition of the second experiment. We don’t need to, since we can pass variables from one program to the other. With JumpFile and JumpFile return, the second argument of the function is no longer a specific file you want to open with a specific program (this is unnecessary since JumpFile always opens another Au-thorware program), but the second argument is the variable or the variables you want to pass along. So, if you want to start Experiment2.exe from Experiment1, and the are both located in the same folder, and you want to pass along the Participant-Number (stored in the variable ParticipantNumberSave) you would need to pro-gram the following function: JumpFile(“Experiment2.exe” ; “ParticipantNumberSave”)

Page 78: Authorware Programming Guide for Reseachers- 2nd Edition

15. NO AUTHORWARE PROGRAM IS AN ISLAND.

- 77 -

TIP: If you want to start a second program which is located in the same fold-er as your experiment, you don’t need to specify the location, since Author-ware will automatically locate the file by it’s name. Note that again, arguments have “ ” on both sides; even the normal variable Partici-pantNumberSave has to be surrounded by them in order for Authorware to be able to pass along these variables. Pay attention to the fact that, in order to be able to pass along variables from one file to the other, the variables have to exist in both files, al-though this is pretty self-evident. Keep in mind to use JumpFile and not JumpOut when passing along variables between Authorware experiments. If you want to pass along more then one variable, things get pretty weird: although it doesn’t really make sense, all variables you want to pass along need to be separated by a “,”, as in the following example: JumpFile(“Experiment2.exe” ; “ParticipantNumberSave, Condition-Save, Var3”) Alternativly, you can pass along ALL variables from one file to the next, by using the wildcard *. JumpFile(“Experiment2.exe” ; “*”) For another specific example, namely how to start E-Prime, a widely used program to perform reaction time measurements, see Appendix 1 of this workbook for step by step instructions. Now another way to communicate between programs, is to instead of starting a new program, is sending data from one program to another. In the previous chapter, you learned how to use WriteExtFile to write a simple text file, and ReadExtFile to read the contents of a text file into a string. We can use this to pass along variables, and even do this over a network drive. In the next example, I’ll give you the programming needed to automatically assign a participantnumber to your Authorware experiment. First of all, you need access to a PC on the network that’s always on. Usually, labs have a set-up where one experimenter PC can access other PC’s, and data files can be passed back and forth. Find the Network Name of that PC. The simply read that data file (yes even though it’s on another computer): PPData := ReadExtFile ("\\\\PC-Networkname\\Folder\\PpNumberData.txt") And get the data from the text file PpNumberData.txt. PpNr := GetLine(PPData; 1) Add 1 to it (ParticipantNumberSave := ParticipantNumberSave+1) and then write it back to the same text file (overwriting the old variable) for the next PC to use:

Page 79: Authorware Programming Guide for Reseachers- 2nd Edition

15. NO AUTHORWARE PROGRAM IS AN ISLAND.

- 78 -

WriteExtFile ("\\\\PC-Networkname\\Folder\\PpNumberData.txt"; PpNr) Besides never having to type in your participant number now, you can exchange all kinds of information this way. And as a bonus, your Authorware program will be much happier communicating with other computers. Sweet!

Page 80: Authorware Programming Guide for Reseachers- 2nd Edition

16. HOW ABOUT PACKAGING?

- 79 -

16. How about packaging? Packaging your piece is an essential part of distributing your Authorware piece. You do not want participants to be able to pause the piece while running, or let them click-and-drag objects in the presentation window somewhere else and change the layout. When a piece is packaged, it will not be possible for the participant to change any-thing in the piece or to pause it by double-clicking. They will have to follow the flow-line. This is one of the few places where there is a difference between working on a Mac-intosh or a PC. I will only describe the packaging of files on a PC; if you work on a Mac, consult the Authorware help file. TIP: After the piece is packaged, there is only 1 way to manually quit the program while it’s running and that’s by pressing Ctrl+Q. First we have to set the publish settings. Go to File>Publish>Publish Settings. Most of the time you will not need the Web versions of your experiment, so uncheck the Publish For Web Player and Page options, otherwise Authorware will make and save 3 working versions on your computer. You can change the location of where to save the published file; I recommend you do this, because the standard location is not really practical. For example save the experiment to your desktop. The only choice you will have to make is if you want to include Runtime for Windows. Runtime changes your file from the .a7r format (the Authorware runtime file) to an executable file (.exe) allowing the piece to be run on any computer, regardless of whether Authorware is installed on it or not. Note that you usually can not send .exe files through email, because virus scanners treat them as a potential virus. The only reason to not include it is if the computer where you will run the piece already has Authorware installed on it, and if you really need the program to use as little disk space as possible. Since disk space isn’t that much of a problem nowadays, I would recommend to always include Runtime just to be sure. Is it this simple? Yes and no. When packaging your file Authorware generates certain .DLL files and a folder names XTRAS containing several files with a .X32 extension. What do these do? Well, the most general description is these are external files Au-thorware needs to play the packaged piece you’ve programmed. Which files Author-ware needs depend on what you have included in your experiment. Most common extras are needed to display pictures (.bmp, .jpg, .gif), audio files (.wav) or movie files. Authorware also adds the js32.dll file which is needed to run the experiment. TIP: All these files need to be added in the same folder as the packaged Au-thorware experiment. One of the most common mistakes is forgetting to in-clude these external files.

Page 81: Authorware Programming Guide for Reseachers- 2nd Edition

16. HOW ABOUT PACKAGING?

- 80 -

If Authorware can not find these ex-ternal files, it will display an error mes-sage (see picture) saying it can not find the Extra’s folder. An important tip is that the files Authorware makes when packaging are specific to the experiment, therefore it can be that your experiment will not work if you copy these files from another experi-ment. Again, always test if your experiment works the way you want it to on the com-puter you want your experiments to run from. Another thing not to forget is to install the right font on the computer your piece will be running on if you use a special font. Most of the time it is better to save yourself the trouble and choose one of the more common fonts installed on computers like Arial, Courier, Verdana or Times New Roman.

The icons of the runtime file and the unpackaged file are differ-ent. To the right you will see the unpackaged icon, to the left you see the packaged .exe file. After you have packaged a file, you can no longer open it in Authorware to make small changes. The packaged program will run, displaying everything

on the flowline, from start to finish. You can not change anything in a packaged file, so always save a version of the unpackaged file. If you packaged your experiment, it will run till the end of the flowline, and then stop. The final screen will be shown until you press Ctrl+Q on the keyboard. Alternatively, you can tell Authorware to quit the program. To do this, put a calculation icon on the end of the flowline. Inside, type: Quit()

Page 82: Authorware Programming Guide for Reseachers- 2nd Edition

17. BUGGER!

- 81 -

17. Bugger! Your Authorware experiment is like your child: when it’s new, it doesn’t really do any-thing. But then you feed it, it grows, you tell it to do certain things, it listens, but then. Then there is a time for every Authorware experiment to hit adolescence and to stop doing what you want it to. Hitting your computer will not make your Authorware experiment listen to what you want. Instead, you patiently need to interact with your program to see where it went wrong. Rest assured: whenever your program stops listening to you, know that you are not a bad parent, or a bad programmer. We all make small mistakes. But then again, we do not all make the same amount of mistakes, and as you have good par-enting, you have good programming, and both reduce the chance of problems further down the road. Here are some rules to adhere to if you want to be a good programmer. 1: Be organized. Use variable names that mean something if you want to remember what they will do in a week or more. Remember there are different kind of variables (integers, strings, lists) which require different programming and allow different op-erations to be performed on them. To help yourself remember this you can add the kind of variable in the name (e.g., AnswersList, CommentString, NameString). If you want to look really professional, name variabels LstAnswers, strComment and iAge. But whatever system you use, stick to it. Name your icons. Then put the icons that belong together in folders (so all instruc-tions in one folder, your manipulation in one folder, the task participants perform in one folder, the data save, etc). Then name the folders you just created so you know

what’s in them. This way, you can actually find something instead of browsing through 72 unnamed folders. On the bottom of the toolbar there is a colourful square containing 16 different colours, any of which you can use to make your Authorware icons a potpourri of sparkling colours. Select any icon and click on a colour to make it stand out among his neighbours.

This is especially helpful for when you want to remember you need to make some changes somewhere, or for colouring important icons. 2: Keep track of the flowline. If you want to be able to control your program, you need to know where it hangs out after dark and which icons it meets. Through which folders does your experiment go? Sometimes calculation icons are outside a loop when they should be inside it or the other way around. Sometimes you put some pro-gramming in a map attached to an interaction icon, but the program doesn’t pass through the folder when exiting the interaction. When using a decision icon set ‘To calculated path’, does the variable have the right value? Remember that is the value is zero, your program will skip all attached icons attached to the decision icon. Some-times you might use the GoTo function while programming and forget to delete it so you skip a part of your experiment. 3: Keep it simple. Use the same icons and variables when possible. Don’t copy and

Page 83: Authorware Programming Guide for Reseachers- 2nd Edition

17. BUGGER!

- 82 -

paste your entire experiment for the second condition. Don’t try to do fancy stuff that might cause a problem if you know a simple way that works just as well. If you did something in a very difficult way but think of a more elegant solution, re-program it. In the future you will benefit from it. If someone else already has something pro-grammed and you can use it, use it, unless you are intrinsically motivated to learn more and develop your programming skills. 4: Test as you go. It’s much easier to find a problem when you just programmed it. Program small bits and test them. If you try to fix a bug, never change more than one thing in your program without testing it. 5: Use variables. If you want to make a change in your experiment, what would you prefer? Either changing the waiting time inside a wait icon 38 times, or changing WaitTime := 3 to WaitTime := 5? Probably, unless you have sadomasochistic ten-dencies, the latter. If you have 2 conditions, and in one people should count red dots on the screen, and in the other they should count blue dots, why not use a variable you set at the beginning of your piece depending on the condition, if condition = 1 then CountWhat := “red dots” if condition = 2 then CountWhat := “blue dots”? Now you might have followed the advice above, but you still have program that doesn’t want to do what you want it to. That’s when you need to debug your piece. Now opposed to the rest of this guide, there is no step-by-step procedure to debug your piece that will fix your problem, since there are a lot of problems that can occur. I will try, however, to give you some directions for finding where you went wrong. Generally, there are 2 options when something is wrong with your experiment: 1: Your programming is ok, but you have to adjust a setting or correct the program-ming inside a calculation icon 2: Your programming sucks. If it’s 1, read on. If it’s the second, turn to page 1 and continue from there. So, you think there might be a setting wrong, or some programming didn’t turn out as you ex-pected? As Steven Seagal has taught us in Under Siege 2: Assumption is the mother of all fuck-ups. So never assume something does what you think it does, but always check if it indeed works the way you imagined while programming. First, check if a variable has the value you think it has. Open the variable window (Ctrl + Shift+ V), select the variable and look at the current value after you just encountered your prob-lem. Sometimes it’s just as useful to look at the initial value, namely when your vari-able is a list variable (then the initial value should be [], still one of the most common mistakes I see) or when you’ve started the program halfway while testing and the value of a variable that should have been changed earlier in the flowline is still 0 (in this case, change the variable to what it would be at the current place on the flowline if you ran the whole piece). This is all fine and dandy when the variable value changes only once, but it doesn’t help if you perform multiple computations and have a couple of functions do their thing on your value before you can pause the program, for example inside a calcula-

Page 84: Authorware Programming Guide for Reseachers- 2nd Edition

17. BUGGER!

- 83 -

tion icon. Consider the following: inside a calculation icon, you’ve put: Value := 5 Value := Round(Value/2) Value := Value*10 Now you see the current value of the “Value” variable is 30, and you are surprised because you assumed Authorware would Round down the 2,5. Now let’s say you have absolutely no clue what goes wrong and you want to see each step of your calculation inside the calculation icon. Authorware has just the variable for this, and it’s called the Trace function. The Trace function tells Authorware what to write to the Trace window, which can be found in the Control Panel (open with

Ctrl+2) by clicking on the show trace button. If you run the program now, you will see a screen resembling the picture on the right. It tells you where you are on the flowline: the number is the level (so how many maps deep you are), the second 3 letters are the kind of icon you passed through (so a CLC calculation icon, DEC decision icon, into a MAP, another CLC cal-culation icon and an INTeraction icon). With the Trace function you can display cus-tom text in the trace window, like the current value of a variable. If you would change the programming in the calculation icon to this: Value := 5 Trace("Value1 =") Trace(Value) Value := Round(Value/2) Trace("Value2 =") Trace(Value) Value := Value*10 and then run it, your Trace window should look like the one above here on the right. The Trace("Value1 =") line displays the text, and the second line Trave(Value) dis-plays the current value. (Note you could use one line here as well, with Trace(“Value 1=”^Value). If the values are what you want them to be but something is still wrong, look at the functions you use. Read the item descriptions and check if you used them the right way. Especially think about if the variable type (strings, lists, or integers) allow the function you want to perform upon them. Look at the standard settings of the icons you use. A text entry standard only accepts the word Untitled and you need to change it to * for the text entry to accept everything you type in (don’t ask me which programmer build this in Authorware, but he should be fired together with the person that didn’t set the ‘Update displayed variable’ setting in display icons to default). Most icons are set to ‘Erase after next Entry’ on the re-sponse tab. If you have a problem with disappearing visuals, check all erase settings. Check if you selected the right option in an icon, for example if you set a decision icon to “calculated path” instead of the Sequentially default option.

Page 85: Authorware Programming Guide for Reseachers- 2nd Edition

17. BUGGER!

- 84 -

There are many weird things that can go wrong and puzzle, intrigue or irritate you. Try to stay calm, or look at the program tomorrow if time allows it. Ask for help if pos-sible. You will probably have colleagues or fellow students who have already run in to the same problem you ran into. Ask them for help. If they don’t know, or if you don’t want to bother them (again) you can check the Au-thorware help files. You can either scroll through the index, search for a specific item or read through the tutorial. The Authorware help file actually is a very good guide to Authorware on its own if you are past the beginner’s level, so just check it out if you have a problem or want to do something in a nice way but don’t know how. Click Help>Tutorial to take a look at it. Though it is not aimed at making an experiment, it will show you the basics of Authorware in a different manner then we did here, which may be useful if you want to practice a little more and follow a step by step guide. However, it contains a lot of information you probably don’t need. The help function also offers a lot of step-by-step procedures to set up almost every possible interaction. Click search and type in ‘step’ to see all step-by-step explana-tions. To prevent you from running into problems, steal programs from other people. I am very serious. Often there is no need to spend hours to make something yourself if you can copy past it from someone else in a second. Ask someone if he or she has something you can use. However always try to understand what you stole, and use your own variable names to prevent problems. Maybe you can download something you need from the Macromedia site (www.macromedia.com/support/Authorware). Or take a look at the Show Me examples in the Macromedia folder (usually in C:\ProgramFiles\Macromedia\Authorware 7.0\ShowMe). These Show Me examples are most of the time advanced examples of what you can program in Authorware, so often they will be to hard to understand, but you might be able to figure out how they work and adept them for you own experiment. So what if you still have no clue after browsing the help file, asking everybody you know and searching the internet for hours? Then maybe you will find a fellow Au-thorware programmer on the Aware mailing list that is willing to help you. Browse to: http://ls.kuleuven.ac.be/archives/aware.html First, search the archives. If you have a problem, someone else will very likely have had the same problem, and maybe the answer to your question is already in the ar-chive. If it isn’t, and you really need an answer to your question, you can join the mailing list. If you follow all instructions, you will be able to ask your question to the list. Almost all questions are answered, so it’s a good last option. I’m on the list, but so are dozens of people who know a lot more about Authorware then I do. Good luck programming your experiments!

Page 86: Authorware Programming Guide for Reseachers- 2nd Edition

APPENDIX 1: THE BEST OF BOTH WORLDS

- 85 -

Appendix 1: The Best of Both Worlds So now you know enough to use Authorware for your questionnaires, condition spe-cific instructions and interactive elements of your experiment. But you can't use Au-thorware to perform reaction time experiments, or can you? Now without becoming too technical or bursting off into the Authorware versus E-Prime discussion some people seem to enjoy, here are two practical suggestions if you want to combine the interactive elements of Authorware and measuring reaction times. First solution: just use Authorware. Mark Tew and Kenneth McGraw compared E-Prime and Authorware's accuracy in measuring reaction times, and they came to the conclusion based on their tests that as long as the CPU load is low, there isn't that much difference between the two. That means that as long as your certain the com-puter you are running your experiment on isn't going to do any intensive tasks while running your experiment (like virus-scanners scanning the entire hard-drive, pro-grams backing up your computers hard-drive, etc) the variance due to the timing measurement errors will be very small, and increasing in the case of web-delivery of your Authorware package or a continuous loop performing a calculation while meas-uring the response time. These calculations were done on what would nowadays be considered old computers, and if you have computers with fast processor speed and a lot of internal memory, you actually shouldn't need to worry unless you want to per-form a critical timing study for an fMRI study for example. The article by Tew & McGraw can be found on their homepage: http://psychexps.olemiss.edu/Scrapbook/Timing_2002.pdf. Second solution: use Authorware to jumpstart E-Prime or MediaLab. Thanks to Paul de Groot from the Vrije Universiteit Amsterdam it's possible to start E-Prime from other applications, as Authorware, without having to fill in subject numbers or condi-tion settings and still get your data stored correctly for each participant. Here's how: To make life a lot easier, put all the files you will be using in the same folder. You need at least these four files: your Authorware file, your E-Prime file (the runtime ver-sion ending with .ebs), a batch file you'll make yourself and the program E-Kick. E-Kick is a small command line utility created by Paul de Groot, and you can download it here: http://step.psy.cmu.edu/scripts-plus/. Now what we will do is tell Authorware to run a batch file, and in the batch file we will write down the command to let E-Kick start our E-Prime program. This might seem complicated, but really it isn't. To start another program from Authorware, we can use the system function JumpOut or, if we want to come back to Authorware to ask some questions about the reaction time part participants performed in E-Prime, we can use JumpOutReturn. As we can read from the description of the function in the functions window: JumpOutReturn opens the application you specify in program and then Authorware continues its presentation in the background. Use JumpOutReturn only in calculation icons. Now we don't want to start an application, but a batch file, but that's no problem. Further-more, although the description of the function isn't very clear about this, it's also pos-sible to pass along values of variables from the Authorware program you are running to the program you start as is explained in the JumpFile and JumpFileReturn func-

Page 87: Authorware Programming Guide for Reseachers- 2nd Edition

APPENDIX 1: THE BEST OF BOTH WORLDS

- 86 -

tions specifically for opening other Authorware pieces. To accomplish this, drop a calculation icon on the flowline on the point where you want to start E-Prime, and in-side write: JumpOutReturn(FileLocation^"\\NameOfBatchFile.bat"; VariableNameToPass).

What does this line do? It tells Authorware to JumpOut (but return afterwards) to the file at the location your Authorware file itself is (so in the same folder) named NameOfBatchFile.bat, and transferring the value of a specific variable (most likely your participant number, but you can also add more variables, for example condition, as long as you put ; in between the variables) to the batch file. A batch file is nothing more then a text file containing a series of commands you could also type in on the command prompt of your computer. A batch file can start a program in a desired configuration, and that is exactly why we are using it here. We want E-Kick to start E-Prime in a specific configuration, namely with a participant number and perhaps condition number inserted without being prompted to type one in. To make a batch file, just create a new text file and save it as NameOfBatch-File.bat instead of NameOfBatchFile.txt. Inside the text file, write the following com-mand on one line: E-kick.exe NameOfE-PrimeExperiment.ebs sub-ject=%1. What does this mean? Basically, it tells your computer to start E-Kick (which has to be in the same folder) and use E-Kick to start a specific E-Prime ex-periment. E-Kick then configures your E-Prime program so that the subject variable is identical to the VariableNameToPass form the calculation icon in Authorware. You could also add session=%1 if you also want to specify a condition in E-Prime. If you run the Authorware file, the command line will quickly pop-up:

Page 88: Authorware Programming Guide for Reseachers- 2nd Edition

APPENDIX 1: THE BEST OF BOTH WORLDS

- 87 -

It will shut down again after E-Prime closes, and your Authorware piece will continue. That's it! E-Kick has some more advanced functions (read the read me file included in the download for more information) but this is most likely all you need to know. You can start Medialab from Authorware as well, using a batch file. In the first step, we will create a batch file, which has the participant number and the condition already filled in. This way, when MediaLab starts, it will not ask for the participant number halfway through your study. WriteExtFile("D:\\data\\MediaLabScript.bat";"\"c:\\my docu-ments\\medialab\\medialab.exe\""^""^"c:\\medialab\\samples\\sample1.exp,"^PPNR^","^Condition^"") The programming above will create a Batch file names MediaLabScript.bat in the folder D:\\data. It assumes Medialab is located here: c:\\my documents \\medialab\\medialab.exe. Your experiment is assumed to be located at c:\\medialab\\samples\\ folder (but you can change it to anywhere you like). The PPNR and Condition variables (in green) are the participant number and condition in Authorware, which will be written to the batch file so Medialab can use them. The second part is easy: you just jump to the batch file, and that will start medialab: JumpOutReturn("D:\\data\\MediaLabScript.bat")

Page 89: Authorware Programming Guide for Reseachers- 2nd Edition

- 88 -

Appendix 2: Experimenting Online Authorware is already suited for your online wishes. In the Publish screen, you can just check a box and Authorware will publish your experiment for the Authorware Web Player. This is a external program similar to the Flash Player. You might re-member having to install a flash player when your computer was really new and you started browsing the internet for the first time. The Authorware web player works in the same way: it will let Internet Explorer (and other browsers) to run your experi-ment. When you press publish settings and check ‘Publish for Web> Web Page’ and ‘Web Player”, you end up with an htm file, a .aam file and one or more .aas files. Well, that’s mighty fine, but what do they do? Basically, the .aam file is the runtime file, the internet equivalent of the .exe file. It tells the Web Player what it needs and where to find it. The .aas files contain the data, and are usually split up into several files so they can be downloaded faster. The .htm file can be used as a webpage which will do the same as the .aam file, but then in a browser. Now putting your experiment online is a very tricky thing: there are lot’s of variables to keep in mind, like the machine running your experiment (Mac or PC) and the browser that is used (Internet Explorer or Firefox) and I surely don’t know everything about these things. But in this appendix I will give you some advice on how to go about if you want to run your experiment online. There are two ways to do this: the first is storing the data using a php script, the second is to use FTP. Both require you have access to a properly set up server from where people can download your ex-periment, and where the data can be stored. I will first detail the php approach, which is probably the best way to set up internet experimenting. So what do we need? First, you need a .php script. PHP is a programming language that is designed to create dynamic webpages. You don’t need to learn it though, be-cause I will give you the php script you need, and you can just copy paste it and use it forever. You can create a php script by opening a simple .txt file, and then save it as data.php. Inside this file, copy-paste the following syntax: ?php /* read data from url: /data.php?data=here_is the_data */ $data = $_GET['data']; /* check if string is not empty */ if ($data <> "") { /* show what is written to file */ $filename = "colordata.txt"; print "writing: <b><font color=red> $data </font></b> to $filename" ; /* open datafile for 'append' */ $fp = fopen($filename, "a"); /* write data on new line ( \r\n ) */ $fw = fwrite( $fp, "$data\r\n" ); /* close file */ fclose( $fp ); } else { /* report string is empty */

Page 90: Authorware Programming Guide for Reseachers- 2nd Edition

- 89 -

echo "no data to write to file! "; } ?> After the /* symbols you can read a summary of what the programming does, if you are interested, but cutting things short, it get’s the data from your Authorware file that is running inside a webpage, and writes it to a data file in the same folder on the server. You need to place this file in a folder on your server, where you have the right to read and write to a data.txt file, which you also need to put on the server. Now all we need to do is put the right programming in our Authorware file at the point where we would normally store our data with a simple AppendExtFile. Now, however, you need to put the following: DataYouWantToSave := All^Tab^Your^Tab^Variables data:=URLEncode(DataYouWantToSave) re-sult:=ReadURL("http://www.servername.com/phpfile/data.php?data="^data) At this moment, you might be surprised to learn, that all there is to it. Make sure you work together with your IT team to set up the server correctly (so it can be accessed from outside your university’s network, and so you can store the data, etc), but then all you need to do is publish the web version of your experiment, and I’ll guide you through this now. Now that we changed the program so it works when we deliver the experiment on the web, how do we get it on the web? First of all, we need to publish our experiment for the web. In the menu bar, go to File>Publish>Publish Settings and check For Web Player and Web Page. I’ll focus on the last option, which creates a .htm file, but the .aam file created by the web player option works in a similar manner.

Page 91: Authorware Programming Guide for Reseachers- 2nd Edition

- 90 -

If you have checked the Web Page checkbox, you get Web Page tab at the bottom of the menu. Click it to set some extra options. Change the Width and Height to fit your

piece (or just click Match Piece) but keep in mind participants computer might have a 800 x 600 screen resolution, and also that if you present the screen at 800 x 600 some part of the screen might not be visible. As always, test before distributing. You can also change the window style to On Top, so your experiment will be dis-played on top of other screens. However, by choosing this, participants can not exit your experiment, which is not so nice. Therefore, in web experiments you might want to turn on the Title Bar to allow participants to close the screen. You don’t want par-ticipants in the lab to do this, but it isn’t nice to take over the participants’ pc, so press Ctrl+Shift+D and check Title Bar. Now hit publish, and you have yourself a nice web experiment! Go to the folder you published your experiment in, and look for the .htm file. Double click it. Now what will happen depends on your default browser. I’m a big Firefox fan myself, but I’ll first dis-cuss what will happen if your default browser is Internet Explorer. A browser window will open and you’ll see this yellow bar on top of it:

Because your piece might be harmful to a computer (you have the right to access the participants hard disk and delete files, for example) people have to explicitly allow the program to run. For us, it is irritating that participants get this message, but if we were participants and it was our own computer, we would want to be warned! If you click on the yellow bar and then click yes, the screen will load for a couple of seconds, and a new window will appear the first time participants run an Authorware experiment,

Page 92: Authorware Programming Guide for Reseachers- 2nd Edition

- 91 -

because they need to install the Authorware Web Player. The process for this is ex-tremely similar to installing the Flash web player (which most people have for viewing web pages made in flash, and is also made by former Macromedia), or at least, it is for Internet Explorer. They will see the ‘do you want to install this soft-ware’ window on the right and have to click ‘in-stall’. This might seem like a lot of work, but we aren’t there yet: more is asked of participants. That’s why it is very important to guide them through these steps before you ask them to click on the link to your experiment! After installing the web player, the next warning appears, asking them if they really want to run your experiment. This screen is the first screen which is actually part of your Authorware experi-ment, warning participants we will run a file and the file will be allowed to write to the partici-pants’ hard disk. Authorware can run in trusted mode (allowing you to access their hard disk) and non-trusted mode (not allowing you to access their hard disk), and we need the first to be able to store our data on the partici-pants’ computer. If you don’t want to filter out participants low in trust, you might want to explain why they receive all these warnings on the website they will start your experiment from, or in the email you will send them with the link to your experiment. In addition to all your variables you are saving, you might want to include some more information you can easily get with the help of some system variables. For example, use Day, Month and Year to store the date your participant performed the experi-ment, StartTime to know when the user started and SessionHours to know how long he or she spend performing your experiment, or use OSVersion to see on what kind of operating system they performed your experiment, and ScreenHeight and ScreenWidth to see the resolution of the participant’s monitor.

Page 93: Authorware Programming Guide for Reseachers- 2nd Edition

- 92 -

Now for an alternative approach, which is better suited if you have access to a par-ticipants PC (for example, you want to put your experiment online for students who use pc’s on the campus). Using an ftp server is the oldest and probably easiest way of transferring data to a server, but it’s also a bit outdated and more cumbersome than the php approach be-cause you will be storing the data file on the user’s harddrive first, and then send it to your server, thereby triggering firewall warnings, etc., as detailed below. An FTP server basically is a piece of hard disk space you can access over the internet by logging in. By converting your experiment to a web page in htm, and by putting all the files you need on the FTP server, people can run your experiment anywhere on the planet over the internet. The only thing you need to do is get your data from their hard disk to the FTP server. Now when your experiment is run, it is downloaded to the webplayer running from the participants computer. This means that when you use the WriteExtFile function, data will not be stored on the FTP server but on the participants own computer. To store data on the FTP server (so you also have the data) you need new functions. The FTP functions you need for this are not listed in the list of standard Authorware system functions. However, Authorware has left open room for the smart computer people to extend the basic program with exten-sions. There is a FTP extension which, although not part of the basic package, is so widely used it’s given alongside the pro-gram when you install Authorware. The extension is called ftp.u32 and is placed in your Authorware folder. To add the func-tionality this extension provides, you first have to load it. You can do this by going to the functions window and from the cate-gory dropdown menu select the name of your current experi-ment. As you will see, the Load button below the dropdown menu becomes active. If you click it, you can select the ftp.u32 file and open it. Then select all the functions that appears win-dow and click Load once more. All the FTP functions are now loaded and you can use them in your program. There is a whole list of functions, and in the description window you can see what they do (or you can look at the last page of this guide). I will guide you through the most important ones in the following step-by-step guide on how to write a data file to your FTP server. If you don’t have a FTP server, stop reading here and first ask your IT people for some help. The first thing you need to tell Authorware is to initialize the FTP session, and then you can communicate with the FTP server. In other words, first we will open the ftp connection, and then we will connect to the server. To do this, drop a calculation icon on the very beginning of the flowline. Inside, type: ftpID := FtpOpen() Status := FtpConnect(ftpID; "Server"; "21"; "YourLogin"; "Password")

Page 94: Authorware Programming Guide for Reseachers- 2nd Edition

- 93 -

Now the first thing you will notice is that the functions FtpOpen and FtpConnect do not turn black and bold after typing them in as with other functions. That’s because they are not system functions, but custom functions, and so it’s completely normal. The variable ftpID will be set to 1 if everything is ok in the first line. In the second line, we tell Authorware to connect the current ftpID to our ftp server (here you would type something like name.domain.com in between the brackets) for which the standard port in most cases is 21 (don’t ask me why, just type it in) followed by your login and password. Now here is a tricky part: most ftp functions are asynchronous. This simply means Authorware will perform the function, but will not wait until the function actually did what you wanted. Connecting to a ftp server, for instance, can take a couple of sec-onds, but Authorware will perform the function to connect to the server within milli-seconds and continue before the connection is also actually established: it’s like tell-ing your computer to shut down, but then having to wait some seconds before it is actually shut down. That’s why you have to build in a check to see if the function is completed before the program continues. This check will always work in the same manner. The ftpOpen function is not asyn-chronous, so we don’t need to check it. The second ftpConnect, however, is asyn-chronous, so should be checked until correctly performed. Drop a decision icon on the flowline, Set it to repeat until true, and in the field below type: RepCount > 0 & Status = 0. If the Status variable = 0 that means the function is correctly performed, if the program is still waiting or an error occurred, the value will be negative. Attach a map icon to the decision icon and inside drop a calculation icon. Since the value of Status will not be 0 right away (otherwise there would be no need for this check) we have to update the Status variable to see when it is 0. Inside the calculation icon, type: Status := FtpStatus( ftpID ) FtpStatus is also an FTP function, which updates the status of the last performed ftp function (in this case, the ftpConnect function). You can put a wait icon underneath the calculation icon set to 0,5 seconds if you don’t want to let the participants com-puter work to hard by continually looping. No that we are connected, we can store the data on our ftp server in a two step proc-ess. We first have to store the data on the participants computer, and then use an FTP function to copy the text file on the participants computer to the ftp server. Yes it would be a lot easier to directly store it on the ftp server, but that’s just not possible. To store the data on the participants computer, it’s most convenient to use the FileLocation function: that way you always know you are storing the data in an existing location you have the right to write files to. So for example use: WriteExtFile(FileLocation^“FileName.txt” ; Data) Now we can use the ftp function to transfer the data file to the ftp server. We will use the ftpAppend function, which is similar to the AppendExtFile system function. Status := FtpAppend( ftpID; "FileName.txt"; FileLoca-

Page 95: Authorware Programming Guide for Reseachers- 2nd Edition

- 94 -

tion^“FileName.txt”) The data in the text file FileName will be appended to the text file also named File-Name on the FTP server. Again, we have to wait until this function is performed cor-rectly, and we can use the same loop we just built: just copy paste it below the calcu-lation icon with the FtpAppend function. After this point, the data is on the server. Great! Now just for cleaning up: it’s good policy to not leave any rubble behind when you visit another place, and that goes for computers as well. Now we stored a file on the participants PC: where did that go? Most likely, the file is stored in the following loca-tion: C:\WINDOWS\system32\Macromed\AUTHORWA\NP32ASW\AW70. This is where the webplayer is located (in the Macromed folder is also where the Flash Player is installed on most PC’s) and if you followed my advice about using FileLoca-tion to store your data, this is where you’ll find it. Now if you want to be nice and clean up your data, this would be a good time to drop a new calculation icon on the flowline and in it type: Begone := DeleteFile(FileLocation^“FileName.txt”) Now all we need to do is disconnect from the ftp server, and close the ftp session. The disconnect function is again asynchronous, so we need to wait until it is correctly performed. Type: Status := FtpDisconnect( ftpID ) and again copy paste our loop to check if the operation is performed correct. Please note that we need to change the until true condition within the loop! Instead of Status = 0, we have to type Status = -3, since -3 is the value that is returned when every-thing went ok. Kinda weird, but if you don’t change it your program will loop for ever. Finally, close the ftp session with: Status := FtpClose( ftpID ) After this, you can also type Quit() inside a calculation icon to quit the experiment just like you would normally. As I said, when the data file is tranferred using FTP, depending on the security set-tings of the computer the experiment is running on, the firewall program, which keeps track of programs trying to contact a server over the internet, might warn the partici-pant our experiment is trying to write our data file to the ftp server. The firewall rec-ognizes this attempt as something which might be a security risk (we could be doing all sorts of things, like storing credit card data we found on the users computer to our own server) and asks the participant if he or she wishes to block the program or let our experiment connect to our FTP server. This security warning (see picture for the windows firewall warning, but there are a lot of other firewall programs) will appear when we use the FtpAppend function (and not after the FtpConnect function). Again, we need to carefully explain participant why we are making contact with the server (to store the data to our server) before they start the experiment, but it would be very nice to again explain this within your experiment just before you try to store the data

Page 96: Authorware Programming Guide for Reseachers- 2nd Edition

- 95 -

on the Ftp server. So, the first time, par-ticipants need to in-stall the Authorware Web Player with 3 clicks, and every time the have to give us permission to access their hard disk and make contact to our server. The keyword to accomplish this is trust. It is extremely easy to create an Au-thorware program that will install malicious software and delete important files. Now naturally you have no interest in doing so, but you should try your best to convince your participants of this if you don’t want to pre-select participants high in trust or low in computer knowledge. This time, I am not kidding!

You need to put the map you get while publishing the experiment (containing an XTRA folder, .u32 files, .aas and .aam files and the .htm page) on your server. Discuss with your colleagues on the IT department how to set up a system so your experiment is accessible from outside the university network. Translate your experiment in any language and sample the world’s population!

SIDESTEP ON SCREEN RESOLUTION PART 2 The problem with the difference in screen resolutions used by participants is that your experiment screen will be displayed in the centre of the screen, but any screens participants had open before will remain visible when your experiment is not taking up the entire screen (or isn’t set to the same resolution as the partici-pants PC). On the other hand, you can’t set you screen resolution to high because text and buttons might not be visible on a lower machine. Now that we have learned how to load .u32 files, we have a new way around this problem. There is an extension that will make the screen surrounding your experiment window black. You can download this .u32 file here: http://www.adobe.com/support/authorware/download.html (scroll down and download the ucd.zip file). Load the cover.u32 file as explained above and type id := Cover() in a calcu-lation icon at the beginning of your file and Uncover() in a calculation icon at the end.

Page 97: Authorware Programming Guide for Reseachers- 2nd Edition

- 1 -

Appendix 3: User comments Dear Mr. Lakens, Thank you for sharing your AW workbook. I have been using AW for several years and seen several teaching aids. I especially enjoyed your humorous approach to a fairly technical and dry subject. Very nice work! Diane (Besselsen) Low Educational Technology Office of State Courts Administration Hi Daniël and Chris, After months leaving Authorware programming aside, some skills tend to get lost. However, the exercise and workbook are friendly tools that couldn't be handier today. Where I come from, we explicitly recognize the effort behind useful things. So I wanted to tell you that, at least in my case, the teaching method you are using to ex-plain Authorware really pays off. See you around, Juan Pablo M. Hi Daniel: I'm the tech director of a public school district in Ohio, USA, and an absolute newbie to Authorware. I haven't been able to get training in the software because professional development is actually someone else's job re-sponsibility. I bought Authorware, but the documentation that came with the software was useless for me. Your guide is EXACTLY what I needed to start my Authorware learning. It is much appreciated, and thanks for sharing it with the group. Joseph R. Schiska Director of Technology Whitehall School District Beste Daniel, Via via heb ik jou Authorware manual gekregen. Ik vind het een zeer goede manual. Ik had al wat basiservaring in Authorware, maar heb veel nieuwe dingen geleerd! Goed & zeer duidelijk geschreven! Guido van Koningsbruggen Dear Daniel I just read your Authorware Beginners' Guide. It is amazing, I learned useful things on every page. Could you sell me a copy for a few beers? Wernher M. Brucks, PhD _______________________________________________________________________ Hi Daniel, The Authorware tutorial is extremely impressive. I especially like chapters with titles such as "Bugger!" Dr. Aiden P. Gregg Director of Undergraduate Studies School of Psychology, University of Southampton