; A&Cscript - Startup and logon routines A&C=Borg en klus=Diag
; ----------------------------------------------------------

alias klus.startup {
  echo -s ** (startup.mrc) Error: Cannot find critical module: startup.mrc. Will attempt to repair A&Cscript. 
  echo -s ** (startup.mrc) Launching A&Cklus...
  if ($script(A&Cklus.mrc)) { klus | halt }
  else {
    echo -s ** A&Cklus is not present as a script, attempting to load.... 
    var %tmp = system\modules\A&Cklus\A&Cklus.mrc
    if ($isfile(system\modules\A&Cklus\A&Cklus.mrc)) {
      .load -rs %tmp | echo -s ** A&Cklus loaded | echo -s ** NOTE: Make sure A&Cklus resets the script files to default 
      if ($isalias(klus)) { klus | halt }
    }
    else { echo -s ** Fatal error: A&Cklus not found. Please reinstall A&Cscript. | halt }
  }
}
}


ON *:START: { klus.startup
onstart
prestart 
}

alias prestart {
; A&Cscript Reparatie File
; ----------------------------------------
var %tmp = $indir $+ bupdate.tmp | if ($isfile(%tmp)) { .remove %tmp }
if ($script(bupdate.mrc)) { .unload -rs bupdate.mrc }
