; The Problem's Australia EP Installer Script.
; Written with help of ASCII-Edit in March/May 1995.

;two vars for scrolling logo through window
SET scrollUP [30H[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B
SET scrollDN [0H[1A[1A[1A[1A[1A[1A[1A[1A[1A[1A[1A[1A[1A[1A[1A[1A[1A[1A[1A
SET empty "[1C >                                                                       "

SETFONT topaz.font 8

IF NOT Exists Australia-Install
  ECHO "You  have  either already installed Australia, or something weird happened!*nI can not find this directory:*n`CD`Australia-Install/"
  ECHO NOLINE "*n*n[3m > Press Return "
  SET >NIL: Return ?
  ENDCLI
ENDIF

;Install the cli-commands first
CD Australia-install
ECHO NOLINE "[1mPlease wait...[0m*n*nInstalling commands in C: ..."
COPY >NIL: Cli-Stuff/#? C:
COPY >NIL: ASCIIEdit.config S:
SetRGB >NIL: RESET
;
;The following part magically converts the "Install.DATA" file to a
;protracker module, loads it into SmartPlay and then deletes it...
IF EXISTS Install.DATA
  ECHO NOLINE "...done!*nLoading & Converting Install.DATA file ..."
  ECHO NOLINE >RAM:Header piano
  JOIN RAM:Header Install.DATA TO RAM:Mod.Piano
  DELETE >NIL: RAM:Header
  SP RAM:Mod.Piano NW NM NE NC
  DELETE >NIL: RAM:Mod.Piano
  ECHO "...done!"
ENDIF

ECHO "*ec"
TYPE TP-Logo.ASCII
WAIT 1

TYPE TP-AUSTRALIA.ASCII
WAIT 1

ECHO [21H[3CPress Return[38C[3m(C)1995 by The Problem[0m[21H
SET >NIL: Return ?

ECHO "*ec"
TYPE TP-AUSTRALIA.ASCII
WAIT 1

;scroll up half a screen and display info
ECHO [1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[14H
ECHO "[12H[13C[32m[1mWelcome to The Problem's Australia EP installer.[31m*n"
ECHO " This  script will fully install the Australia EP where you want it.  Please*n note  that  you  need  about 5 Mb of free space on your harddisk during the*n installation.  After installation, Australia will take up about ??Mb.[0m*n"
ECHO " It IS VITAL that you use this installer.  If you copy stuff by hand, we can*n ensure  you  that  some things in the EP won't work.  (Some files have been*n deliberately corrupted; they will be restored by the installer.)*n"
ECHO " Coming  up  is  a  [4mPath  Requester[0m in which you should choose a destination*n directory.   If you are unsure wether you have enough diskspace, cancel the*n requester to quit the installation procedure."
ECHO NOLINE "[28H[31C[3m Press Return [0m"
SET >NIL: Return ?
ECHO "[28H[31C              "

;where to install, the Path requester...
LAB Repeat
SET Path ""
SET Path `RequestFile DRAWER "Ram:" DRAWERSONLY TITLE "Select Path for AUSTRALIA!" POSITIVE "Install Here" NEGATIVE "Quit!"`

IF NOT $Path
  ECHO "[28H[1m  Are you sure you DON'T want to install Australia? (Y/N)[0m[43m[32m"
  SET YPos [29H
  SET YES "Yeah! I hate installing EP's! [3m(What?!) [0m"
  SET NO "No! O my God! What have I done!?! [3m(you pressed Quit!...) [0m"
  SET label Quit
  SKIP SUB_YesNo
ELSE
  SKIP DontQuit
ENDIF

LAB Quit
IF $answer EQ Y
  SP STOP
  ENDCLI
ELSE
  SKIP BACK Repeat
ENDIF

LAB DontQuit
ECHO [0m$scrollDN

LAB questions
ECHO "[2H[1m Okay, now please answer the following questions...[0m*n"

ECHO " Do you want 8-colour Magic WB icons (in stead of 4-colour)? (Y/N)"
ECHO "[32m[43m[5H$empty[5H[4C[0m"
ECHO "*n Do you want the new WB backdrop to be activated? (in prefs file!) (Y/N)"
ECHO "[32m[43m[8H$empty[8H[4C[0m"
ECHO "*n Do you run an 'interlaced' workbench? (Y/N)"
ECHO "[32m[43m[11H$empty[11H[4C[0m"
ECHO "*n Are you sure about all this? (Y/N)"
ECHO "[32m[43m[14H$empty[14H[4C"
ECHO "[32m[43m"

;the following makes use of the 'sub-routine', (see further down)
LAB Repeat2
  SET Ypos [5H
  SET YES "Yes please, give me the beautyfull ones!"
  SET NO "No, I want 4 colour icons..."
  SET label Repeat3
  SKIP SUB_YesNo

LAB Repeat3
  SET Q1 $answer
  SET Ypos [8H
  SET YES "Yes, I guess I do."
  SET NO "No, just leave me alone will you!"
  SET label Repeat4
  SKIP SUB_YesNo

LAB Repeat4
  SET Q2 $answer
  SET Ypos [11H
  SET YES "Yes, I've got loads of memory and/or own a multiscan monitor!"
  SET NO "No, I'm just an honest bloke! (Or I own a 1 GIG HD instead!)"
  SET label Repeat5
  SKIP SUB_YesNo

LAB Repeat5
  SET Q3 $answer
  SET Ypos [14H
  SET YES "Yes, I'm not stupid you know!"
  SET NO "No, I made a little mistake."
  SET label Continue
  SKIP SUB_YesNo

LAB Continue
  SET Q4 $answer
  ECHO NOLINE "[0m*n*n*n[24C[41m[30m Hit The Return Key! (Again) [0m"
  SET >NIL: Return ?

  IF $Q4 EQ N
    ECHO "[1A[24C          Try again!         "
    SKIP BACK questions 
  ENDIF

  ECHO $scrollUP$scrollUP


;And now for the backdrops...
ECHO "*ec"
ECHO "You  will  now have the opportunity to select which background picture will*nbe  installed.   Wether or not you have chosen to activate it, we will copy*nit  to  your  [1mSYS:Prefs/Patterns[0m  directory."

SET label BACKSELEC1
IF $Q1 EQ Y
  SKIP Pics8col
ELSE
  SKIP Pics4col
ENDIF

LAB BACKSELEC1
ECHO "*n*n*n[17C[43m[32m  1  [34C  2  [0m"
IF $Q3 EQ Y
  ECHO "[29H  [43m[32m      These are nonlaced versions. A laced version will be installed!    [0m"
ENDIF

LAB BACKSELEC2
ECHO NOLINE "[6H[3mEnter your choice:                  [0m[17D"
SET >NIL: back ?

CD Backdrops/
SET patterns "SYS:Prefs/Patterns/AustBugles"
IF NOT EXISTS SYS:Prefs/Patterns/"
  MakeDir >NIL: SYS:Prefs/Patterns
ENDIF
IF NOT VAL "$back" EQ 1
  IF NOT VAL "$back" EQ 2
    SKIP BACK BACKSELEC2
  ELSE
    IF $Q1 EQ Y
      IF $Q3 EQ Y
        COPY >NIL: Bugles2.HL $patterns
      ELSE
        COPY >NIL: Bugles2 $patterns
      ENDIF
    ELSE
      IF $Q3 EQ Y
        COPY >NIL: Bugles4.HL $patterns
      ELSE
        COPY >NIL: Bugles4 $patterns
      ENDIF
    ENDIF
  ENDIF
ELSE
  IF $Q1 EQ Y
    IF $Q3 EQ Y
      COPY >NIL: Bugles.HL $patterns
    ELSE
      COPY >NIL: Bugles $patterns
    ENDIF
  ELSE
    IF $Q3 EQ Y
      COPY >NIL: Bugles3.HL $patterns
    ELSE
      COPY >NIL: Bugles3 $patterns
    ENDIF
  ENDIF
ENDIF

;Copy window backdrop
COPY >NIL: AustraliaWindows sys:prefs/patterns/

CD /
DELETE >NIL: Backdrops ALL
ECHO "*ec"
TYPE TP-AUSTRALIA.ASCII
ECHO "[2H[1mThe selected pattern has been installed.[0m"
IF $Q2 EQ Y
  IF $Q1 EQ Y
    COPY >NIL: WbPattern8.prefs SYS:Prefs/Env-Archive/Sys/WbPattern.prefs
    ECHO "[5HAn 8 colour Window Backdrop has been copied to your [1mSYS:Prefs/Patterns[0m*ndirectory. This backdrop has also been actived in [1mWBPattern.prefs![0m"
  ELSE
    COPY >NIL: WbPattern4.prefs SYS:Prefs/Env-Archive/Sys/WbPattern.prefs 
    ECHO "[5HAn 8 colour Window Backdrop has been copied to your [1mSYS:Prefs/Patterns[0m*ndirectory. This backdrop can be actived using [1mWBPattern![0m"
  ENDIF
  ECHO "[3HAnd it has been activated ([3mWbPattern.prefs [0mfile has been altered)."
ELSE
  ECHO "[3HUse [3mWbPattern [0mto put it on your worbench!"
ENDIF

DELETE >NIL: WbPattern#?.prefs
WBPattern FROM SYS:Prefs/Env-Archive/Sys/WbPattern.prefs USE

ECHO NOLINE "[8H[3mPress Return... [0m"
SET >NIL: Return ?
ECHO [29H[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[14H

;Superb usage of 'list' in order to rename the iconz.
ECHO NOLINE "[23CNow installing your icons..."
IF $Q1 EQ Y
  LIST #? >RAM:Iconz LFORMAT "DELETE >NIL: *"%P%S*"" ALL SUB .info2
ELSE
  LIST >RAM:Iconz LFORMAT "DELETE >NIL: *"%P%M.info*"*nRENAME >NIL: *"%P%S*" *"%P%M.info*"" ALL SUB .info2
ENDIF
EXECUTE >NIL: RAM:Iconz
DELETE >NIL: RAM:Iconz
ECHO "...FINISHED!!!"

;WOW! a scroll! You saw that?!
ECHO "$scrollDN$scrollDN*ec"

;move outside the Australia-install dir...
CD /
SET Path "$Path"Australia
ECHO "[1mAnd now... All HELL will break loose! Just a second...[0m[3m*n"
COPY Australia-install $Path ALL

ECHO NOLINE "[0m*nCleaning up..."
DELETE >NIL: Australia-install ALL

;create a script in ram to delete this installer...
ECHO >RAM:KillInstaller "WAIT 3*nCD *"`CD`*"*nDELETE Australia-install ALL*nDELETE Australia.#?"
CD $Path

ECHO "*ec"
TYPE TP-Logo.ASCII
ECHO "[28H[1m    That's IT! The Australia EP is yours for EVER! Explore The Outback!"
ECHO NOLINE "[0H[31C[3mPress Return[0m"
SET >NIL: Return ?

ECHO "$scrollDN$scrollDN"
TYPE TP-Australia.ASCII
ECHO [29H[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[10H
ECHO "[32m[1m[6C- This installer was created by the following Problem members-[31m"
ECHO "*n[33CGraphics[0m*n[33CSolution*n[32CAlcoRhythm"
ECHO "*n[29C[1mCoding/Scripting[0m*n[32CAlcoRhythm*n[33CSolution"
ECHO "*n[34C[1mDesign[0m*n[36CWanda"
ECHO "*n[29C[1mQuality Assurance[0m*n[34CCSilla*n[33CInfinity"
ECHO "*n[35C[1mMusic[0m*n[32CAlcoRhythm"
ECHO NOLINE "[31C[3m Press Return "
SET >NIL: Return ?

ECHO "$scrollDN$scrollDN"
TYPE TP-Australia.ASCII
ECHO [29H[1B[1B[1B[1B[1B[1B[1B[1B[1B[1B[10H
ECHO " [32m[1mThe Australia EP project is brought to you by The Problem Collective 1995[0m*n[8C- It may only be spread in the original unchanged archive -*n"
ECHO "[10C[32m[1mMusic:[32CGraphics:[31m*n[10CAlcoRhythm[28CMushRoom[0m (Logos)*n[10C[1mSolution[30CAlcoRhythm/Solution[0m (Icons)*n"
ECHO "[34C[32m[1mCoding:[31m*n[21CAlcoRhythm[0m (ASCII-Editor, SetRGB)*n*n[23C[32m[1mThe Problem wishes to thank:[31m*n[21CPeter Hjelt[0m (Excellent SmartPlay)*n[26C[1mJohn Hendrix[0m (FastView)"
ECHO "[22C[1mHellRaiser[0m (The Twilight Zone)*n[25C[1mLeo Elsinga[0m (TP Internet)*n[23C[1mAcid Software[0m (Blitz Basic 2)*n[19C[1mAnd The People Of Australia[0m (Outback)*n"
ECHO "[21C[33m[1m[4mWe're The Problem, Gotta Love Us![0m"
ECHO NOLINE "[31C[3m Press Return "
SET >NIL: Return ?

ECHO "$scrollDN$scrollDN"
ECHO "[15H[21C[33m[1mWe're The Problem, Gotta Love Us![0H[0m"

;delete the ASCII-logos
DELETE >NIL: TP-#?.ASCII

;move the Australia icon
CD /
RENAME >NIL: Australia/Australia.info Australia.info

;delete this installer...
RUN >NIL: C:EXECUTE RAM:KillInstaller

;but first stop smartplay and endcli...
SP STOP
ENDCLI



;the SUB_YesNo routine needs the following variables:
;$Ypos     - the line number string ([xH, x is the line number)
;$YES      - the text to replace a positive answer (y/Y) with
;$NO       - the text to replace a negative answer (n/N) with

LAB SUB_YesNo
  ECHO NOLINE "$Ypos$empty$Ypos[4C"

  SET answer ""
  SET >NIL: answer ?

  IF "$answer" EQ "y"
    SET answer "Y"
  ENDIF
  IF "$answer" EQ "n"
    SET answer "N"
  ENDIF
  IF "$answer" EQ "Y"
    ECHO "$Ypos[4C$YES"
  ELSE 
    IF "$answer" EQ "N"
      ECHO "$Ypos[4C$NO"
    ELSE
      SKIP BACK SUB_YesNo
    ENDIF
  ENDIF
SKIP BACK $label

LAB Pics8col
CD Backdrops/
pictocli >NIL: bugles 20 68
pictocli >NIL: bugles 155 68
pictocli >NIL: bugles 20 153
pictocli >NIL: bugles 155 153
pictocli >NIL: bugles2 330 68
pictocli >NIL: bugles2 465 68
pictocli >NIL: bugles2 330 153
pictocli >NIL: bugles2 465 153
CD /
SKIP BACK $label

LAB Pics4col
CD Backdrops/
pictocli >NIL: bugles3 20 68
pictocli >NIL: bugles3 155 68
pictocli >NIL: bugles3 20 153
pictocli >NIL: bugles3 155 153
pictocli >NIL: bugles4 330 68
pictocli >NIL: bugles4 465 68
pictocli >NIL: bugles4 330 153
pictocli >NIL: bugles4 465 153
CD /
SKIP BACK $label
