home *** CD-ROM | disk | FTP | other *** search
- on loadParams
- set params to readParams()
- set the exitLock to 1
- when keyDown then checkKeyDown()
- set params to initBasicParams(params)
- put item 1 of params into field "soundFileName"
- if offset("noName", field "soundFileName") = 1 then
- put "noName" into field "soundFileName"
- end if
- if the machineType < 256 then
- exportSoundToFile()
- end if
- setColorDepth(1)
- set tmp to field "to" & RETURN & field "Mess" & RETURN & field "from"
- if the number of lines in tmp <= 3 then
- put RETURN & tmp into field "allmess"
- else
- put tmp into field "allmess"
- end if
- end
-
- on setColorDepth sw_start
- global prevColorDepth
- if sw_start then
- if the colorDepth <> 8 then
- set prevColorDepth to the colorDepth
- set the colorDepth to 8
- else
- set prevColorDepth to 0
- end if
- else
- deleteFile(the pathName & field "soundFileName")
- if prevColorDepth <> 0 then
- set the colorDepth to prevColorDepth
- end if
- end if
- end
-
- on deleteFile theFileName
- if the machineType < 256 then
- set f to FileIO(mnew, "read", theFileName)
- if objectp(f) then
- f(mDelete)
- end if
- end if
- end
-
- on checkKeyDown
- dontPassEvent()
- if the keyCode = 53 then
- set swOut to 1
- else
- set swOut to 0
- end if
- if the commandDown then
- if (the key = "Q") or (the key = "q") or (the key = ".") then
- set swOut to 1
- end if
- end if
- if swOut then
- when keyDown then nothing
- repeat with sprt = 1 to 48
- puppetSprite(sprt, 0)
- end repeat
- go("cprts1")
- end if
- end
-
- on exportSoundToFile
- if field "soundFileName" <> "noName" then
- set err to copyResToSnd(the pathName & field "soundFileName", field "soundFileName")
- if err <> "0" then
- alert(err)
- end if
- end if
- end
-
- on readParams
- global file
- if the machineType >= 256 then
- set fileName to the pathName & field "fName"
- set ret to EMPTY
- set file to FileIO(mnew, "read", fileName)
- if not objectp(file) then
- fileError(file)
- halt()
- end if
- set ret to file(mReadFile)
- file(mdispose)
- else
- set ret to getStrRes("AGprefs")
- end if
- set charsNum to integer(line 1 of ret)
- delete line 1 of ret
- if the number of chars in ret <> charsNum then
- alert("Inappropriate preferences file. Program aborting.")
- halt()
- end if
- return ret
- end
-
- on fileError file
- set err to string(file)
- alert("Problem accessing file, error=" && err)
- end
-
- on initBasicParams params
- put line 1 of params into field "From"
- put line 2 of params into field "To"
- set len to integer(line 3 of params)
- put line 4 to 3 + len of params into field "Mess"
- delete line 1 to 3 + len of params
- return params
- end
-