home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
editors
/
hypsh40b.arj
/
HYPDEVEL.LZH
/
EXAM.HSL
< prev
next >
Wrap
Text File
|
1991-04-24
|
7KB
|
289 lines
.REMARK
include(hsl.def)
.HEADER
--- Question $Q -------------------------- $x -------
.SCRIPT RESET
setvar(T,0)
setvar(C,0)
setvar(W,0)
setvar(O,0)
setvar(Q,0)
closein()
.REMARK test
test parentheses
.NOTE Name
Enter your name here
Name: inputfield($a~W20,setvar(a,%s))~Q
.
.SCRIPT SETUP
setopt(2,0)
setopt(*3,1)
mapkey(F0,frame(Summary))
note(Name)
.SCRIPT Timing
reseterr(timehun())
setvar(R,getkey())
setvar(T,timediff());setvar(O,=O+T)
testvar(R,_parameter);goto(_notequal,WRONG)
setvar(M,CORRECT - Well done~g)
setvar(C,=C+1)
goto(NEXT)
label(WRONG)
beep();setvar(W=W+1)
setvar(M,Wrong)
label(PMESS)
setvar(M,$M - the answer was number _parameter~g)
label(NEXT)
toggle(1)
.
.SCRIPT OPEN
setvar(x,popdir(*.XAM,noext));ifcond(_noresult,quitscript())
setvar(b,_time)
reseterr();openin($x.XAM);goto(_error,FILERR)
label(READ)
reseterr()
setvar(r,readrec())
goto(_error,FILERR)
setvar(p,upto(:,$r))
testvar(p,q);goto(_equal,QUESTION)
testvar(p,Q);goto(_equal,QUESTION)
goto(READ)
label(FILERR)
popmessage(Error reading file)
quitscript()
label(QUESTION)
script(Next)
.
.SCRIPT Next
-- set variables up
setvar(j,);loadvar(j,1);loadvar(j,2);loadvar(j,3);loadvar(j,4);
loadvar(j,5);loadvar(j,6)
setvar(k,);setvar(l,);setvar(m,);setvar(n,0);setvar(c,0);setvar(q,1)
testvar(r);goto(_equal,END)
setvar(Q=Q+1)
setvar(s,fromchar(:,$r))
setvar(j,frompos(2,$s))
label(GETLINE)
setopt(*T)
reseterr();setvar(h,readrec())
goto(_error,EOX)
setvar(i&N1$h)
testvar(i,~);ifcond(_equal,O*T1)
testvar(i,*);ifcond(_equal,O*T2)
testvar(i,');goto(_equal,GETLINE)
testvar(i);goto(_equal,GETLINE)
goto(T,QUESTIONS)
testvar(q,1);goto(_notequal,AFTER)
setvar(n=n+1)
goto($n)
goto(GETLINE)
label(1);setvar(k,$h);goto(GETLINE)
label(2);setvar(l,$h);goto(GETLINE)
label(3);setvar(m,$h);goto(GETLINE)
label(QUESTIONS)
setvar(s,flagval(T));testvar(s,2);ifcond(_equal,setvar(c=q))
setvar(h,frompos(2,$h))
lh$q;setvar(q=q+1)
goto(GETLINE)
label(AFTER)
setvar(i,&U:$h)
testvar(i,r);ifcond(_equal,setvar(g,frompos(3,$h)))
testvar(i,R);ifcond(_equal,setvar(g,frompos(3,$h)))
label(GETNEXT)
setopt(*T;reseterr())
setvar(h,readrec())
goto(_error,EOX)
setvar(i,upto(:,$h))
testvar(i,q);ifcond(_equal,O*T4)
testvar(i,Q);ifcond(_equal,O*T4)
goto(T,NEXTF)
goto(GETNEXT)
label(NEXTF)
setvar(r,$h)
frame(Question)
quitscript()
label(EOX)
setvar(r);setvar(h)
frame(Question)
quitscript()
label(END)
frame(Summary)
.
.SCRIPT Print
setvar(x,@D*.XAM);ifcond(_noresult,quitscript())
popmessage(Ready printer or <ESC> to cancel)
setopt(5,1)
setvar(b,$5)
reseterr();openin($x.XAM);goto(_error,FILERR)
output()
output(Practice Test File: $x)
output()
label(READ)
reseterr()
setvar(r,readrec())
goto(_error,FILERR)
setvar(p,upto(:,$r))
testvar(p,q);goto(_equal,QUESTION)
testvar(p,Q);goto(_equal,QUESTION)
goto(READ)
label(FILERR)
display(Error reading file)
quitscript()
label(QUESTION)
setvar(j);setvar(n,0);setvar(c,0);setvar(q,1);testvar(r);goto(_equal,END)
setvar(Q=Q+1);setvar(s,fromchar(:,$r));setvar(j,frompos(2,$s))
output(Question number $Q)
output();output($j)
label(GETLINE)
setopt(*T)
reseterr();setvar(h,readrec());goto(_error,EOX)
setvar(i,&N1$h)
testvar(i,~);ifcond(_equal,O*T1)
testvar(i,*);ifcond(_equal,O*T2)
testvar(i,');goto(_equal,GETLINE)
testvar(i);goto(_equal,GETLINE)
goto(T,QUESTIONS)
testvar(q,1);goto(_notequal,AFTER)
output($h)
goto(GETLINE)
label(QUESTIONS)
setvar(cat(s,flagval(T)));testvar(s,2);ifcond(_equal,setvar(c=q))
setvar(h,frompos(2,$h));testvar(q,1);ifcond(_equal,output())
output( ($q) $h)
setvar(q=q+1)
goto(GETLINE)
label(AFTER)
setvar(i,upto(:,$h))
testvar(i,r);ifcond(_equal,setvar(g,frompos(3,$h)))
testvar(i,R);ifcond(_equal,setvar(g,frompos(3,$h)))
output()
ifcond(R,output( Reference [$g]));output()
label(GETNEXT)
setopt(*T);reseterr()
setvar(h,readrec())
goto(_error,EOX)
setvar(i,upto(:,$h))
testvar(i,q);ifcond(_equal,O*T4)
testvar(i,Q);ifcond(_equal,O*T4)
goto(T,NEXTF)
goto(GETNEXT)
label(NEXTF)
setvar(r,$h)
goto(QUESTION)
label(EOX)
label(END)
output();closein();display(Print complete)
setvar(T,0);setvar(C,0);setvar(W,0);setvar(O,0);setvar(Q,0)
.
.FRAME MENU
.TITLE )Select Option
~DR Examination - main menu ~DT
[1] frameref(Take exam,script(OPEN),1)
[2] frameref(Print Questions (no refs),setopt(*R,);script(Print),2)
[3] frameref(Print Questions (with refs),setopt(*R,1);script(Print),3)
[4] frameref(Change name from ( $a ),note(Name);refresh(),4)
[q] frameref(Quit,Quit(),q)
actionref(,script(RESET))~Q
.
.FRAME Question
.TITLE Multiple choice selection
~DF
$j
$k
$l
$m
~DT
[1] $(1)
[2] $(2)
[3] $(3)
[4] $(4)
[5] $(5)
[6] Do not know the answer
~h1 $M
~h1 $g
~h1
~h1[n] actionref(Press 'n' for next question,toggle(1,x);script(Next),n)
~h1[s] actionref(--- or press 's' for summary ---,frame(Summary),s)
actionref(,script(Timing($c)))~Q
.
.FRAME Summary
.TITLE )Timing report
~DR Test results for $a - Test $x ~DT
Number of questions $Q
Number correct $C
Number wrong $W
$R
Average response time $A seconds
actionref(,localscript(calc))~Q
[p] actionref(Print summary sheet,localscript(Summary),p)
[m] actionref(Press 'm' to return to main menu,frame(MENU),m)
.
.REMARK
Calculate average response in seconds / hundredths
.SCRIPT calc
closein()
setvar(A=O/Q)
setvar(B=A/100)
setvar(A=A-B*100)
testvar(A,10);ifcond(_less,setvar(A,0$A))
setvar(A,$B.$A)
setvar(P=C*100/Q)
testvar(P,25);goto(_less,BAD)
testvar(P,50);goto(_less,AVERAGE)
testvar(P,75);goto(_less,GOOD)
setvar(G,Brilliant)
goto(DISP)
label(BAD)
setvar(G,Pretty aweful)
goto(DISP)
label(AVERAGE)
setvar(G,Average)
goto(DISP)
label(GOOD)
setvar(G,Very good)
label(DISP)
setvar(R,You scored $P percent correct - That's $G)
refresh()
.
.SCRIPT Summary
popmessage(Ready printer or <ESC> to cancel)
setopt(5,1)
output(" Test File: $x")
output()
output(" Name: $a")
output(" Date: $4")
output(" Test started: $b")
output()
output(" --- Summary of results ---")
output()
output(" Number of questions $Q")
output(" Number correct $C")
output(" Number wrong $W")
output()
output(" Percentage correct $P")
output()
output(" Average response time $A seconds")
output()
popmessage(Printout complete)
.