home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club KidSoft Volume 3 #3
/
CKSPCV33.BIN
/
movies
/
catalog.dir
/
00005_Script_5
< prev
next >
Wrap
Text File
|
1995-07-19
|
5KB
|
190 lines
--More movie scripts
on consonantDown
global gAnswerString, gInputString, gPosition,¼
gCurrentAnswer, gCurrentInput, gInputIndex, gMIAWOpen, SUnlockCode
if gMIAWOpen = TRUE or the visible of sprite SUnlockCode = FALSE then exit
if the selStart = length(gAnswerString) then
set endFlag to TRUE
else
set endFlag to FALSE
end if
if the commandDown = TRUE then -- Let command keys through
set wantsToQuit = FALSE
if the key = "q" then
set wantsToQuit = TRUE
else
if the machineType = 256 then -- also check for escape on the PC
if charToNum(the key) = 27 then
set wantsToQuit = TRUE
end if
end if
end if
if wantsToQuit = TRUE then
answer "Really quit Club KidSoft?", "", "No", "Quit", 175, "QuitKidSoftDialogClose"
else
pass
end if
pass
else
if the keyCode = 123 then
set endFlag to FALSE
exit
else if the keyCode = 124 then
exit
else if the keyCode = 125 or the keyCode = 126 then
dontPassEvent
exit
end if
set curKey = charToNum(the key)
if the key = BACKSPACE then
deleteHandler
else if the key = RETURN and the number of chars in field "Unlock Code" < 17 then
dontPassEvent
else if IsOKCancelKey(the key) = "OK" then
dontPassEvent
TryUnlock(script "Unlock Now")
else if not alphaTest(the key) then
dontPassEvent
-- Ignore the key if RETURN, or not a letter (upper or lower)
else -- must be a letter key
dontPassEvent
if the number of chars of field "Unlock Code" > 16 then
exit
end if
set gAnswerString to the text of field "Unlock Code"
-- set gPosition to the selStart
if curKey >= 97 then
set curKey = curKey - 32
end if
if char 1 of gAnswerString = " " then
put numToChar(curKey) into char 1 of gAnswerString
else if the selStart <> 0 then
put numToChar(curKey) after char the selStart of gAnswerString
else
put numToChar(curKey) before char 1 of gAnswerString
end if
set numChars = the number of chars of gAnswerString
set gAnswerString to formatAnswer()
set the text of field "Unlock Code" to gAnswerString
set daLength to length(gAnswerString)
if daLength = 5 or daLength = 9 or daLength = 14 then
set the selEnd to the selEnd + 2
set the selStart to the selEnd
else
set the selEnd to the selEnd + 1
set the selStart to the selEnd
end if
-- set the selEnd to length(gAnswerString)
-- set the selStart to length(gAnswerString)
if numChars = 17 then
global SUnlockNow
set the visible of sprite SUnlockNow = TRUE
updateStage
exit
else
global SUnlockNow
set the visible of sprite SUnlockNow = FALSE
updateStage
exit
end if
end if
end if
end consonantDown
on formatAnswer
global gAnswerString
set daLength to length(gAnswerString)
if daLength < 3 then
return gAnswerString
else
repeat with i = 1 to daLength
set howFar to offset("-", gAnswerString)
if howFar then
delete char howFar of gAnswerString
end if
end repeat
end if
put "-" after char 3 of gAnswerString
if daLength < 7 then
-- return gAnswerString
else if daLength < 12 then
put "-" after char 7 of gAnswerString
-- return gAnswerString
else
put "-" after char 7 of gAnswerString
put "-" after char 12 of gAnswerString
-- return gAnswerString
end if
if the last char of gAnswerString = "-" then
set i = the length of gAnswerString
delete char i of gAnswerString
end if
return gAnswerString
end
on alphaTest letter
set asKey to charToNum(letter)
if (asKey < 65) or (asKey > 90 and asKey < 97) or (asKey > 122) then
return 0
else
return 1
end if
end alphaTest
on deleteHandler
global gAnswerString
dontPassEvent
if the selStart = 4 or the selStart = 8 or the selStart = 13 then
delete char (the selStart - 1) of gAnswerString
else
delete char the selStart of gAnswerString
end if
set gAnswerString to formatAnswer()
set the selStart to the selStart - 1
set the selEnd to the selStart
set the text of field "Unlock Code" to gAnswerString
if char (the selStart) of gAnswerString = "-" then
set the selStart to the selStart - 1
set the selEnd to the selStart
end if
set numChars to the number of chars of field "Unlock Code"
if numChars < 17 then
global SUnlockNow
set the visible of sprite SUnlockNow = FALSE
updateStage
end if
end