; Movie Maker 2 Installer Script
; For Use With Commodore's Installer Utility (Not Supplied)
; Movie Maker 2 ©1995 Graeme Blenkinsopp
; Installer And Installer Project Icon ©1991-93 Commodore-Amiga Inc

;Messages
(set #Welcome-String
	(cat "Welcome to the installer script for Movie Maker 2.\n"
	"This script will install Movie Maker 2 perfectly\n"
	"on your system with the minimum of fuss and WON'T\n"
	"copy files all over the place.\n\n"
	"        Movie Maker 2 ©1995 Graeme Blenkinsopp\n\n")
)
(set #Directory-Prompt
	(cat "Please Select A Destination Directory To Install\n"
	"Movie Maker 2 Into - A New Drawer Will Be Created.")
)
(set #Directory-Help
	(cat "Select A Directory - A New Drawer Will Be Created\n"
	"In The Directory You Choose.  All Files For Movie\n"
	"Maker 2 Will Then Be Copied Into The Newly Created Drawer")
)
(set #Out-Of-Space-Help
	(cat "Please ensure you have at least 3 MB of space\n"
	"remaining on your selected directory else the\n"
	"installation will fail.")
)
(set #movie_drawer
	(cat "MovieMaker2/")
)
(set #Make-Dir-Prompt
	(cat "The installer will now create a directory to\n"
	"install the files for Movie Maker 2.")
)
(set #Make-Dir-Help
	(cat "A new directory with icon will be created which\n"
	"will store the contents of the four Movie Maker 2 disks.")
)
(set #Insert-Disk-1
	(cat "Please insert Movie Maker Disk 1 into any drive.")
)
(set #Insert-Disk-2
	(cat "Please insert Movie Maker Disk 2 into any drive.")
)
(set #Insert-Disk-3
	(cat "Please insert Movie Maker Disk 3 into any drive.")
)
(set #Insert-Disk-4
	(cat "Please insert Movie Maker Disk 4 into any drive.")
)
(set #Disk-Help
	(cat "Insert the requested disk into any drive - you\n"
	"MUST do this else the installation cannot continue.")
)
(set #Copy-Disk-1-Files
	(cat "The installer will now copy files (not directories)\n"
	"from disk 1 to the destination directory.  Directories\n"
	"will be copied next.")
)
(set #Help-Disk-1-Copy
	(cat "This process copies only files from Movie1: that are\n"
	"not contained in any directories since the C, DEVS and LIBS\n"
	"drawers should not be copied to the destination directory.\n")
)
(set #Delete-Drawer-Question
	(cat "A Movie Maker 2 directory already exists here.\n"
	"Do you wish to continue with installation?\n\n"
	"NB: Clicking ABORT aborts the installation.")
)
(set #Delete-Drawer-Help
	(cat "The installer has detected a drawer named Movie\n"
	"Maker 2 in the destination directory you have selected.\n"
	"You can now either continue with the install which\n"
	"will erase all data previously in the directory.\n"
	"Or you can abort the installation by clicking ABORT.")
)
(set #Delete-Now-Prompt
	(cat "The installer will now erase the entire directory\n"
	"called MovieMaker2.")
)
(set #Delete-Now-Help
	(cat "The installer has found a directory called Movie Maker\n"
	"2 in the destination directory you specified.  In order for\n"
	"the installation to continue, this drawer and its contents\n"
	"must be deleted.")
)
(set #Abort-Message
	(cat "You have aborted the installation - Good for you!")
)
(set #Ask-AmigaGuide
	(cat "The Amigaguide.library has not been found on your\n"
	"system.  This could also mean you have not got an\n"
	"Amigaguide viewer.  Do you wish to copy ppguide to your\n"
	"C directory - Amigaguide will be copied as well.")
)

(set #AmigaGuide-Help
	(cat "The installer has checked your LIBS: drawer for\n"
	"the amigaguide.library and has not found it.  Since\n"
	"you do not have this library, it is possible you have\n"
	"not got an AmigaGuide file viewer.  Select YES if you\n"
	"wish to have ppguide copied to your C: directory.")
)
(set #AmigaGuide-Prompt
	(cat "The installer will install Amigaguide.library to\n"
	"your LIBS: drawer since you don't appear to have it.")
)
(set #AmigaGuide-Help
	(cat "If you wish to read the amigaguide document\n"
	"that comes with the game - you NEED this library.")
)
(set #DiskFont-Prompt
	(cat "The installer will install diskfont.library to\n"
	"your LIBS: drawer since you don't appear to have it.")
)
(set #DiskFont-Help
	(cat "Movie Maker 2 makes use of bitmap fonts.  In order\n"
	"for the operating system to use these fonts, it is\n"
	"necessary for it to have access to this library.\n"
	"Without the library, the game will not work.")
)
(set #MED-Prompt
	(cat "The installer will install medplayer.library to\n"
	"your LIBS: drawer since you don't appear to have it.")
)
(set #MED-Help
	(cat "Movie Maker 2 makes extensive use of music.  All\n"
	"music was composed using OctaMED and requires this\n"
	"library if the operating system is to play it.\n"
	"Without this library - the game will not work.")
)
(set #Power-Prompt
	(cat "The installer will install powerpacker.library\n"
	"to your LIBS: drawer since you don't appear to have it.")
)
(set #Power-Help
	(cat "Some of the files in Movie Maker 2 have been crunched\n"
	"in order to fit them onto floppy disk.  In order to\n"
	"decrunch them to their original size this library is\n"
	"essential.")
)
(set #Amos-Prompt
	(cat "The installer will now install amos.library to\n"
	"your LIBS: drawer.  Unless you have the amos.library\n"
	"from AMOS Professional, you must install this.")
)
(set #Amos-Help
	(cat "The game was written using AMOS Professional.\n"
	"In order for the game to work the operating system\n"
	"needs access to this library to execute the commands.\n"
	"The library on this disk is the version that AMOS\n"
	"Professional uses.  If you have a previous version of\n"
	"the library from Easy AMOS or AMOS The Creator -\n"
	"they will not work.  If in doubt - install the library.")
)
(set #Script-Warning
	(cat "The installer will now add some commands to\n"
	"the startup script for the game.  See Help for more\n"
	"information.")
)
(set #Script-Help
	(cat "Unlike most installer scripts which add assign\n"
	"commands to your user-startup or startup-sequence\n"
	"thus eating away at precious bytes of memory and\n"
	"providing you with humdreds of useless logical\n"
	"devices that you will hardly ever use - this better\n"
	"script will will create an AmigaDOS script so that\n"
	"only when you double-click on the Movie Maker 2\n"
	"icon will the devices be assigned.  If you cancel\n"
	"this option - the game will ask for the disks to\n"
	"be inserted.")
)
(set #Assign-Path1
	(cat "Assign Movie1: ")
)
(set #Assign-Path2
	(cat "Assign Movie2: ")
)
(set #Assign-Path3
	(cat "Assign Movie3: ")
)
(set #Assign-Path4
	(cat "Assign Movie4: ")
)
(set #End-Text
	(cat "It was my aim to make this the easiest and\n"
	"most informative way to install Movie Maker 2 to\n"
	"your hard disk with the minimum of fuss but at\n"
	"all times letting the user know what files is\n"
	"going where.  I think all installation sequences\n"
	"should be like this.\n\n"
	"Movie Maker 2 - © 1995 Graeme Blenkinsopp\n\n"
	"You MUST reboot first before trying to play the game")
)



;********************
;* Start The Script *
;********************

; Begin with a welcome message
(welcome #Welcome-String)

;Start completion percentage *** 0
(complete 0)

;Ask user to select a destination directory
(set movie_dest
	(tackon
		(askdir
			(prompt #Directory-Prompt)
			(help #Directory-Help)
			(default @default-dest)
			(disk)
		)
	"MovieMaker2"
	)
)

;Update completion *** 1
(complete 4.35)

(message
	"Movie Maker 2 requires 3MB of free hard disk space\n"
	"Please ensure you have enough space remaining.\n"
	(help #Out-Of-Space-Help)
)

;Log on to Disk 1
(askdisk
	(prompt #Insert-Disk-1)
	(help #Disk-Help)
	(dest "Movie1")
	(newname "Disk1")
)

;Check to see if Movie Maker 2 has already been installed.
(if (= 2 (exists movie_dest))
(
	(if (= 0 (askbool
			(prompt #Delete-Drawer-Question)
			(help #Delete-Drawer-Help)
			(default 1)
			(choices "Yes" "Abort")
		 )
	    )
	(
		(abort #Abort-Message)
	)
	)
)
)

;Update completion *** 2
(complete 8.7)
		
;We also have to delete the info icon - but the user does not
;need to be informed of this action.
(set temp_path 
	(cat movie_dest ".info")
)
(if (= 1 (exists temp_path))
(
	(delete temp_path
		(safe)
		(optional force)
	)
)
)

;Update completion *** 3
(complete 13.05)

;Make a directory with icon.
(makedir movie_dest
	(prompt #Make-Dir-Prompt)
	(help #Make-Dir-Help)
	(infos)
	(confirm)
)

;Update completion *** 4
(complete 17.4)

;Tell Installer where destination is.
(set @default-dest movie_dest)

;Copy files from Disk 1 To Destination (Except C:, DEVS: and LIBS:)
(copyfiles
	(prompt #Copy-Disk-1-Files)
	(help #Help-Disk-1-Copy)
	(source "Movie1:")
	(dest movie_dest)
	(pattern "#?")
	(files)
	(infos)
)

;Update completion *** 5
(complete 21.75)

;Unfortunately the installer has copied Disk.info which is of no use.
(set temp_path 
	(cat movie_dest "/Disk.info")
)
(if (= 1 (exists temp_path))
(
	(delete temp_path
		(safe)
		(optional force)
	)
)
)

;We also need to delete this Movie-Install script.
(set temp_path 
	(cat movie_dest "/Movie-Install")
)
(if (= 1 (exists temp_path))
(
	(delete temp_path
		(safe)
		(optional force)
	)
)
)

;And also Movie-Install.info
(set temp_path 
	(cat movie_dest "/Movie-Install.info")
)
(if (= 1 (exists temp_path))
(
	(delete temp_path
		(safe)
		(optional force)
	)
)
)

;Update completion *** 6
(complete 26.1)

;Make a directory for Graphics.
(set temp_path
	(cat movie_dest "/Graphics")
)
(makedir temp_path)

;Update completion *** 7
(complete 30.45)

;Copy the Graphics files over.
(copyfiles
	(source "Movie1:Graphics/")
	(dest temp_path)
	(pattern "#?")
)

;Update completion *** 8
(complete 34.8)

;Make a directory for Music
(set temp_path
	(cat movie_dest "/Music")
)
(makedir temp_path)

;Update completion *** 9
(complete 39.15)

;Now the contents of the Music drawer
(copyfiles
	(source "Movie1:Music/")
	(dest temp_path)
	(pattern "#?")
)

;Update completion *** 10
(complete 43.5)

;Make a directory for Fonts
(set temp_path
	(cat movie_dest "/Fonts")
)
(makedir temp_path)

;Update completion *** 11
(complete 47.85)

;Copy contents of FONTS drawer to destination directory NOT FONTS:
(copyfiles
	(source "Movie1:Fonts/")
	(dest temp_path)
	(pattern "#?")
)

;Update completion *** 12
(complete 52.2)

;Check if amigaguide.library exists and copy ppguide if it doesn't.
(if (= 0 (exists "LIBS:amigaguide.library"))
(
	(if (= 1 (askbool 
			(prompt #Ask-AmigaGuide)
			(help #AmigaGuide-Help)
			(default 1)
		 )
	    )
	(copyfiles
		(source "Movie1:C/ppguide")
		(dest "C:")
	)
	)
)
)

;Update completion *** 13
(complete 56.55)

;Copy amigaguide.library if it doesn't exist
(if (= 0 (exists "LIBS:amigaguide.library"))
(
	(copylib
		(prompt #AmigaGuide-Prompt)
		(help #AmigaGuide-Help)
		(source "Movie1:Libs/amigaguide.library")
		(dest "LIBS:")
		(confirm)
		(safe)
	)
)
)

;Update completion *** 14
(complete 60.9)

;Copy diskfont.library if it doesn't exist
(if (= 0 (exists "LIBS:diskfont.library"))
(
	(copylib
		(prompt #DiskFont-Prompt)
		(help #DiskFont-Help)
		(source "Movie1:Libs/diskfont.library")
		(dest "LIBS:")
		(confirm)
		(safe)
	)
)
)

;Update completion *** 15
(complete 65.25)

;Copy medplayer.library if it doesn't exist
(if (= 0  (exists "LIBS:medplayer.library"))
(
	(copylib
		(prompt #MED-Prompt)
		(help #MED-Help)
		(source "Movie1:Libs/medplayer.library")
		(dest "LIBS:")
		(confirm)
		(safe)
	)
)
)

;Update completion *** 16
(complete 69.6)

;Copy powerpacker.library if it doesn't exist
(if (= 0 (exists "LIBS:powerpacker.library"))
(
	(copylib
		(prompt #Power-Prompt)
		(help #Power-Help)
		(source "Movie1:Libs/powerpacker.library")
		(dest "LIBS:")
		(confirm)
		(safe)
	)
)
)

;Update completion *** 17
(complete 73.95)

;Copy amos.library anyway.
(copylib
	(prompt #Amos-Prompt)
	(help #Amos-Help)
	(source "Movie1:Libs/amos.library")
	(dest "LIBS:")
	(confirm)
	(safe)
)

;Update completion *** 18
(complete 78.3)

;First delete the previous script which the installer has copied
(set temp_path 
	(cat movie_dest "/MovieMaker2")
)
(delete temp_path)

;Update completion *** 19
(complete 82.65)

;Secondly create a text file with the assigns.
(textfile
	(prompt #Script-Warning)
	(help #Script-Help)
	(dest temp_path)
	(append #Assign-Path1 movie_dest "\n")
	(append #Assign-Path2 movie_dest "\n")
	(append #Assign-Path3 movie_dest "/Overflow\n")
	(append #Assign-Path4 movie_dest "\n\n")
	(include "Movie1:MovieMaker2")
	(confirm)
	(safe)
)

;Update completion *** 20
(complete 87)

;Check for Disk 2
(askdisk
	(prompt #Insert-Disk-2)
	(help #Disk-Help)
	(dest "Movie2")
	(newname "Disk2")
)

;Copy all files
(copyfiles
	(source "Movie2:")
	(dest movie_dest)
	(all)
)

;Update completion *** 21
(complete 91.35)

;Check for Disk 3
(askdisk
	(prompt #Insert-Disk-3)
	(help #Disk-Help)
	(dest "Movie3")
	(newname "Disk3")
)

;Change destination then copy all files
(set temp_path
	(cat movie_dest "/Overflow")
)
(copyfiles
	(source "Movie3:")
	(dest temp_path)
	(all)
)

;Update completion *** 22
(complete 95.7)

;Check For Disk 4
(askdisk
	(prompt #Insert-Disk-4)
	(help #Disk-Help)
	(dest "Movie4")
	(newname "Disk4")
)

;Copy all files from Disk 4
(copyfiles
	(source "Movie4:")
	(dest movie_dest)
	(all)
)

;Update completion *** 23
(complete 100)

;Wouldn't you know it? - we're at the end!
(message #End-Text)

;COMPLETE TOTAL AND UTTER END OF FILE.
;IT TOOK ME A FEW HOURS TO LEARN THIS SCRIPTING LANGUAGE
;AND A FEW HOURS TO WRITE THIS SCRIPT.
