Topic 7 - Testing Functions -- WORKSHEET

1. How does one add testing functions to a card? [Create the buttons or objects on the card and assign testing functions from the Actions screen. There MUST be at least one correct answer on each card for proper operation.]

2. EXAMINE THE BUTTON SCRIPTS IN QUIZBUTS.STK AND DESCRIBE HOW THEY OPERATE. [THEY USE THE GETCURRENTSCORE CALLBACK TO DERIVE THE USER NAME AND OVERALL TEST SCORES. ALSO, A TEXT FILE IS OPENED FOR READING AND INPUT INTO A TEXT OBJECT.]

3. EXAMINE THE FOLLOWING SCRIPT WHICH WILL PROMPT THE USER FOR AN ANSWER WHICH IS WRITTEN TO A FILE. HOW COULD THE SCRIPT BE EDITED TO WRITE TEST RESULTS TO A FILE AS A USER PROGRESSES THROUGH A STACK?

;close any open files
CLOSEALL
;name the file to write to
MAKE "resultfile "demoresults
;ask the dialog question
SETRWPROMPT "Write\ your\ question\ here?
Make "TheAnswer READWORD
;open file for reading
OPEN :resultfile
SETWRITE :resultfile
PRINT :TheAnswer
;stop writing to file
SETWRITE []
;close files
CLOSEALL

[THE SCRIPT COULD BE CALLED WHEN THE USER CLICKS A RESPONSE BUTTON OR GOES TO AN