home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 October
/
Chip_2001-10_cd1.bin
/
sharewar
/
gdidbpro
/
data1.cab
/
Example_Files
/
projects
/
default
/
calctest.scp
< prev
next >
Wrap
Text File
|
2000-05-26
|
2KB
|
84 lines
##########################################################
# GDIdb demo script (c) 1997 Global Data Industries
#
# This script will time the time it takes you to evaluate
# an arithmetic expression, and test the answer to see if
# it's correct.
##########################################################
##########################################################
# declare variables used by script
&defvar(?var1?,?timeval?,?oldtime?,?time?)
##########################################################
# Print the information screen
&cls
&print("Calculation Test Demo Script")
&print("------------------------------------------")
##########################################################
# start script main execution loop
&do
{
# get the current time in seconds
&assign(?oldtime?,?gdidbtime.h?*60*60+?gdidbtime.m?*60+?gdidbtime.s?)
# get the user's answer to the problem
&assign(?var1?,"quit")
&input(?var1?,"What's 2+6*8\?")
# get the new time (in seconds)
&assign(?timeval?,?gdidbtime.h?*60*60+?gdidbtime.m?*60+?gdidbtime.s?)
# calculate the time taken to respond (in seconds)
&assign(?time?,?timeval?-?oldtime?)
# check that ?var1? does not equal "quit"
&strtrim(?var1?,"?var1?")
&if("?var1?",ne.nc,"quit",AND,"?var1?",ne,"")
{
&if(?var1?==2+6*8)
{
&print("Correct!")
&if(?time?<4)
{
&print("You took ?time? seconds to answer- that was quick!")
}
&else
{
&print("You were a bit slow though. (?time? seconds)")
}
# user got it right, so end script
&print
&break
}
&else
{
&print("Wrong!")
}
}
&else
{
&print("What's wrong- too complicated for you\? ;-)")
&print("You took ?time? seconds to think about that.")
}
&msgbox(?var1?,"Do you want another go\?",yesno|iconquestion)
&cls
} &while (?var1?==6)