### argon by shade & psykotyk

### show fictions leetass ansi

alias zecho if ([$1]) {xecho -x 0 -y $0 $1-}

@ srand($time())

alias argon {
  clear
  ^local an.
  ^local lines 0
  ^local ans $rand(2)
  @ an.h = fexist(~/argon/argon.lgo.$ans) != -1 ? open(~/argon/argon.lgo.$ans R T) :
  while (!eof($an.h)) {
    @ an.r = read($an.h)
    zecho $lines $an.r
    @ lines++
    }}

unless (getitem(loaded 0) == [yes]) {
^window double off
^set format_status %0
^set input_prompt [0m}

unless (getitem(showansi 0) == [no]) {
  argon
  @ setitem(showansi 0 no)}

### set up color tables.
^assign cl [0m
^assign names lk hk lr hr lg hg ly hy lb hb lm hm lc hc lw hw x cl
^assign colors [0;30m [0;1;30m [0;31m [0;1;31m [0;32m [0;1;32m [0;33m [0;1;33m [0;34m [0;1;34m [0;35m [0;1;35m [0;36m [0;1;36m [0;37m [0;1;37m [0m [0m
^assign colorsb [0;44;30m [0;1;44;30m [0;44;31m [0;1;44;31m [0;44;32m [0;1;44;32m [0;44;33m [0;1;44;33m [0;44;34m [0;1;44;34m [0;44;35m [0;1;44;35m [0;44;36m [0;1;44;36m [0;44;37m [0;1;44;37m [0;44m [0;44m
^assign names1 hk hr hg hy hb hm hc hw
^assign colors1 [1;30m [1;31m [1;32m [1;33m [1;34m [1;35m [1;36m [1;37m

for (@i=0,i<#names,@i++) {
  @ c.$word($i $names) = word($i $colors)
  @ c.bb.$word($i $names) = word($i $colorsb)}
for (@i=0,i<#names1,@i++) {
  @ c1.$word($i $names1) = word($i $colors1)}

@ colors = names = colorsb = names1 = colors1 = []
alias _gettwirl {
  @ twirl++
  @ twirl = twirl > 4 ? 1 : twirl
  switch ($twirl) {
  (1) {return -}
  (2) {return /
}
  (3) {return |}
  (4) {return \\
}}}

### load all modules

alias _percentbar {
  @ function_return = cl ## repeat(${[$2]*([$0]/[$1])} ) ## c.hk ## repeat(${[$2] - ([$2]*([$0]/[$1]))} ) ## cl}

do ^xecho -x 0 -y 0 $repeat(79  )

@ files = glob(~/argon/modules\/*.m)

^stack push set floating_point_math_var
^set floating_point_math_var on

fe ($files) ii {
  @ loaded++
  ^xecho -x 0 -y 0 $(c.hk)[$(c.lc)$_gettwirl()$(c.hk)]
  ^xecho -x 41 -y 0 $(c.hk)[$_percentbar($loaded $#files 10)$(c.hk)]
  ^xecho -x 54 -y 0 $(cl)loading$(c.hk).. $(c.hw)$[10]before(-1 . $after(-1 / $ii))$repeat(${10-strlen($before(-1 . $after(-1 / $ii)))}  )$(cl)
  ^load $ii}

@ files = twirl = []

^set floating_point_math_var off
^set format_status %4%W$0-
^window double on

### load savefiles
do loadarray $a.botfile botlist
do loadarray $a.ilinefile ilines
do loadarray $a.fkeyfile fkeys

unless (getitem(loaded 0) == [yes]) {
ge this script is covered under the GNU GPL.  there is no warranty.  to
ge view the license, type /license.  use of this script implies that you
ge accept the conditions of this license.  use /ahelp for help, /config for
ge config, and /theme and /format to set up cosmetics.
@ setitem(loaded 0 yes)}

### all finished!
do ^window split $a.topbar
ge argon (by shade & psykotyk) sucessfully loaded.  
