Advertisement
Guest User

pcpack

a guest
Jul 4th, 2015
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 348.71 KB | None | 0 0
  1. {
  2.   [ "redcast/setup" ] = "local w, h = term.getSize()\
  3. function clearScr()\
  4.  term.clear()\
  5.  term.setCursorPos(1,1)\
  6. end\
  7. clearScr()\
  8. if fs.exists(\"startup\") then\
  9.  print(\"Press any key to boot from disk...\")\
  10.  local timer = os.startTimer(5)\
  11.  repeat\
  12.    event, timer = os.pullEvent()\
  13.    if event == \"timer\" then\
  14.      clearScr()\
  15.      shell.run(\"startup\")\
  16.      clearScr()\
  17.      term.setTextColour(colours.yellow)\
  18.      print(\"CraftOS 1.7\")\
  19.      return\
  20.      --os.shutdown()\
  21.    elseif event == \"key\" then\
  22.      break\
  23.    end\
  24.  until event == \"timer\" or event == \"key\"\
  25. end\
  26. function printCentered(string, y)\
  27.  local x = (w/2)-(#string/2)\
  28.  term.setCursorPos(x,y)\
  29.  print(string)\
  30. end\
  31. function renderBaseSetup()\
  32.  term.setBackgroundColour(colours.blue)\
  33.  term.setTextColour(colours.white)\
  34.  clearScr()\
  35.  print(\"RedCast Public Beta Setup\")\
  36.  print(\"=========================\")\
  37. end\
  38. renderBaseSetup()\
  39. print(\"This program will install RedCast Public Beta\")\
  40. print(\"on your system.\")\
  41. print()\
  42. print(\"Press C to continue, press Q to quit.\")\
  43. repeat\
  44.  local event, key = os.pullEvent(\"key\")\
  45.  if key == keys.c then\
  46.    break\
  47.  elseif key == keys.q then\
  48.   os.reboot()\
  49.  end\
  50. until key == keys.c or key == keys.q\
  51. renderBaseSetup()\
  52. local file = fs.open(\"disk/eula\", \"r\")\
  53. print(file.readAll())\
  54. file.close()\
  55. print()\
  56. print(\"Press Y to agree.\")\
  57. print(\"Press N to disagree.\")\
  58. repeat\
  59.  local event, key = os.pullEvent(\"key\")\
  60.  if key == keys.y then\
  61.    break\
  62.  elseif key == keys.n then\
  63.    os.reboot()\
  64.  end\
  65. until key == keys.y or key == keys.n\
  66. renderBaseSetup()\
  67. print(\"There are two types of installation.\")\
  68. print(\"Upgrade Install\")\
  69. print()\
  70. print(\"This upgrades a current installation.\")\
  71. print(\"Press U to select this.\")\
  72. print()\
  73. print(\"Clean Install\")\
  74. print()\
  75. print(\"This makes a fresh install.\")\
  76. print(\"Press C to select this.\")\
  77. \
  78. function upgradeInstall()\
  79.  renderBaseSetup()\
  80.  printCentered(\"Checking for previous RedCast installs...\",4)\
  81.  sleep(2)\
  82.  if fs.exists(\"startgui\") and fs.exists(\"devconfig\") then\
  83.    renderBaseSetup()\
  84.    print()\
  85.    print(\"Upgrade to the latest version? Y/N\")\
  86.    while true do\
  87.      local event, key = os.pullEvent(\"key\")\
  88.      if key == keys.y then\
  89.        break\
  90.      elseif key == keys.n then\
  91.        renderBaseSetup()\
  92.        print()\
  93.        print(\"Rebooting...\")\
  94.        sleep(2)\
  95.        os.reboot()\
  96.      end\
  97.    end\
  98.    renderBaseSetup()\
  99.    local files = fs.list(\"disk/files\")\
  100.    printCentered(\"Upgrading files...\",4)\
  101.    for i,v in pairs(files) do\
  102.      if fs.exists(v) and v ~= \"devconfig\" then\
  103.        fs.delete(v)\
  104.      end\
  105.      if v ~= \"devconfig\" then\
  106.        fs.copy(\"disk/files/\"..v, v)\
  107.      end\
  108.    end\
  109.    sleep(2)\
  110.    renderBaseSetup()\
  111.    print(\"Replace configuration file? Y/N\")\
  112.    while true do\
  113.      local event, key = os.pullEvent(\"key\")\
  114.      if key == keys.y then\
  115.        if fs.exists(\"devconfig\") then\
  116.          fs.delete(\"devconfig\")\
  117.        end\
  118.        fs.copy(\"disk/files/devconfig\",\"devconfig\")\
  119.        break\
  120.      end\
  121.    end\
  122.    renderBaseSetup()\
  123.    print(\"Remove the disk.\")\
  124.    sleep(3)\
  125.    os.reboot()\
  126.  else\
  127.    cleanInstall()\
  128.  end\
  129. end\
  130. \
  131. function cleanInstall()\
  132.  renderBaseSetup()\
  133.  print(\"Format Drive C:?\")\
  134.  print(\"Y/N\")\
  135.  repeat\
  136.    local event, key = os.pullEvent(\"key\")\
  137.    if key == keys.y then\
  138.      local rootFiles = fs.list(\"/\")\
  139.      for i,v in pairs(rootFiles) do\
  140.        if v ~= \"disk\" and v ~= \"rom\" then\
  141.          fs.delete(v)\
  142.        end\
  143.      end\
  144.      break\
  145.    elseif key == keys.n then\
  146.      break\
  147.    end\
  148.  until key == keys.y or key == keys.n\
  149.  renderBaseSetup()\
  150.  printCentered(\"Copying files to drive C...\",4)\
  151.  sleep(3)\
  152.  local installFiles = fs.list(\"disk/files\")\
  153.  for i,v in pairs(installFiles) do\
  154.    fs.copy(\"disk/files/\"..v, v)\
  155.  end\
  156.  renderBaseSetup()\
  157.  print(\"Please remove the disk.\")\
  158.  sleep(10)\
  159.  os.reboot()\
  160. end\
  161. \
  162. while true do\
  163.  local event, key = os.pullEvent(\"key\")\
  164.  if key == keys.u then\
  165.    upgradeInstall()\
  166.    break\
  167.  elseif key == keys.c then\
  168.    cleanInstall()\
  169.    break\
  170.  end\
  171. end",
  172.   [ "quicktype/startgame" ] = "--     \
  173. --  QuickType - A small mini-game.\
  174. --     Made by UseTheForce Productions\
  175. --     \
  176. --     Credits:\
  177. --     Luke M.\
  178. --\
  179. \
  180. if not fs.exists(\"CCQT/UTFPro\") then\
  181.     fs.makeDir(\"CCQT\")\
  182.     local UTFPro = fs.open(\"CCQT/UTFPro\", \"w\")\
  183.     UTFPro.writeLine(\"bbbbbbbbbbbbb9\")\
  184.     UTFPro.writeLine(\"b7bb88888777b9\")\
  185.     UTFPro.writeLine(\"b7bb7b8b7bbbb9\")\
  186.     UTFPro.writeLine(\"b7bb7b8b77bbb9\")\
  187.     UTFPro.writeLine(\"b7bb7b8b7bbbb9\")\
  188.     UTFPro.writeLine(\"b7777b8b7bbbb9\")\
  189.     UTFPro.writeLine(\"bbbbbbbbbbbbb9\")\
  190.     UTFPro.writeLine(\"99999999999999\")\
  191.     UTFPro.close()\
  192. end\
  193. \
  194. img = paintutils.loadImage(\"CCQT/UTFPro\")\
  195. local score = 0\
  196. local dgtime = 5\
  197. \
  198. function clear()\
  199.     term.clear()\
  200.     term.setCursorPos(1,1)\
  201. end\
  202. \
  203. clear()\
  204. \
  205. function saveScore(value)\
  206.     file = fs.open(\"CCQT/highscore.txt\", \"w\")\
  207.     file.writeLine(value)\
  208.     file.close()\
  209. end\
  210. \
  211. function getScore()\
  212.     if not fs.exists(\"CCQT/highscore.txt\") then\
  213.         file = fs.open(\"CCQT/highscore.txt\", \"w\")\
  214.         file.writeLine(\"0\")\
  215.         file.close()\
  216.         getScore()\
  217.     else\
  218.         file = fs.open(\"CCQT/highscore.txt\", \"r\")\
  219.         highscore = file.readAll()\
  220.         file.close()\
  221.         return tonumber(highscore)\
  222.     end\
  223. end\
  224. \
  225. function gsleep()\
  226.     sleep(tonumber(gtime))\
  227.     return \"HI\"\
  228. end\
  229. \
  230. function easyQuestion()\
  231.     local letters = {\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\"}\
  232.     local question = {letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)]}\
  233.     return question[1]..question[2]..question[3]..question[4]..question[5]..question[6]\
  234. end\
  235. \
  236. function hardQuestion()\
  237.     local letters = {\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"}\
  238.     local question = {letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)]}\
  239.     return question[1]..question[2]..question[3]..question[4]..question[5]..question[6]\
  240. end\
  241. \
  242. function insaneQuestion()\
  243.     local letters = {\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\", \":\", \"{\", \"}\", \"[\", \"]\", \"!\", \"@\", \"#\", \"$\", \"%\", \"%\", \"^\", \"&\", \"*\", \"(\", \")\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\", \"/\", \"\\\\\"}\
  244.     local question = {letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)], letters[math.random(1, #letters)]}\
  245.     return question[1]..question[2]..question[3]..question[4]..question[5]..question[6]\
  246. end\
  247. \
  248. function easy()\
  249.     clear()\
  250.     eword = easyQuestion()\
  251.     print(\"Score: \"..score)\
  252.     print(\"\")\
  253.     print(eword)\
  254.     io.write(\"> \")\
  255.     einput = io.read()\
  256.     if string.lower(einput) == string.lower(eword) then\
  257.         print(\"Correct!\")\
  258.         isCorrect = true\
  259.     elseif string.lower(einput) ~= string.lower(eword) then\
  260.         print(\"Incorrect! You have lost.\")\
  261.         isCorrect = false\
  262.         hs = getScore()\
  263.         if tonumber(score) > tonumber(hs) then\
  264.             print(\"New High Score!!!\")\
  265.             saveScore(score)\
  266.         end\
  267.             sleep(1)\
  268.             return false\
  269.     end\
  270. end\
  271. \
  272. function hard()\
  273.     clear()\
  274.     hword = hardQuestion()\
  275.     print(\"Score: \"..score)\
  276.     print(\"\")\
  277.     print(hword)\
  278.     io.write(\"> \")\
  279.     hinput = io.read()\
  280.     if hinput == hword then\
  281.         print(\"Correct!\")\
  282.         isCorrect = true\
  283.     elseif einput ~= eword then\
  284.         print(\"Incorrect! You have lost.\")\
  285.         isCorrect = false\
  286.         hs = getScore()\
  287.         if tonumber(score) > tonumber(hs) then\
  288.             print(\"New High Score!!!\")\
  289.             saveScore(score)\
  290.         end\
  291.             sleep(1)\
  292.             return false\
  293.     end\
  294. end\
  295. \
  296. function insane()\
  297.     clear()\
  298.     iword = insaneQuestion()\
  299.     print(\"Score: \"..score)\
  300.     print(\"\")\
  301.     print(iword)\
  302.     io.write(\"> \")\
  303.     iinput = io.read()\
  304.     if iinput == iword then\
  305.         print(\"Correct!\")\
  306.         isCorrect = true\
  307.     elseif einput ~= eword then\
  308.         print(\"Incorrect! You have lost.\")\
  309.         isCorrect = false\
  310.         hs = getScore()\
  311.         if tonumber(score) > tonumber(hs) then\
  312.             print(\"New High Score!!!\")\
  313.             saveScore(score)\
  314.         end\
  315.             sleep(1)\
  316.             return false\
  317.     end\
  318. end\
  319. \
  320. function moreInfo()\
  321.     clear()\
  322.     print(\"          <[QuickType for RedCast]>\")\
  323.     print(\"                     Info\")\
  324.     print(\"\")\
  325.     print(\"All you have to do is copy what comes up on the screen as fast as you can. The time you typed in the beginning was how long you have to type the word in the time between when it appears and when you have to type it.\\n\")\
  326.     print(\"Easy: Not case-sensitive. Only Letters. Just copy!\")\
  327.     print(\"\")\
  328.     print(\"Hard: Case-sensitive. Only letters.\")\
  329.     print(\"\")\
  330.     print(\"Insane: Case-sensitive. Letters, numbers, symbols.\")\
  331.     print(\"\")\
  332.     print(\"Press any key to continue...\")\
  333.     while true do\
  334.         event = os.pullEvent()\
  335.         if event == \"key\" then\
  336.             parallel.waitForAll(unosleep, hi)\
  337.             start()\
  338.         end\
  339.     end\
  340. end\
  341. \
  342. function unosleep()\
  343.     sleep(0.5)\
  344. end\
  345.     \
  346. function hi()\
  347.     print(\"\")\
  348.     print(\"                       ...\")\
  349. end\
  350. \
  351. function start()\
  352.     score = 0\
  353.     gtime = htime\
  354.     hs = getScore()\
  355.     repeat  \
  356.         clear()\
  357.         print(\"             <[[[QuickType]]]>     High Score: \"..hs)\
  358.         print(\"           Choose your Gamemode:\")\
  359.         print(\"\")\
  360.         print(\"                Easy (e)\")\
  361.         print(\"                Hard (h)\")\
  362.         print(\"               Insane (i)\")\
  363.         print(\"              More Info (m)\")\
  364.         print(\"                Exit (ex)\")\
  365.         print(\"\")\
  366.         io.write(\"                > \")\
  367.         gamemode = string.lower(io.read())\
  368.         \
  369.         if gamemode == \"e\" then\
  370.             gtype = \"easy\"\
  371.         \
  372.         elseif gamemode == \"h\" then\
  373.             gtype = \"hard\"\
  374.             \
  375.         elseif gamemode == \"i\" then\
  376.             gtype = \"insane\"\
  377.         elseif gamemode == \"easter\" then\
  378.   term.clear()\
  379.   term.setCursorPos(2,2)\
  380.   print(\"RedCast Easter Egg!\")\
  381.   textutils.slowPrint(\"Thanks for choosing RedCast!\")\
  382.   sleep(2)\
  383.   term.setBackgroundColour(colours.red)\
  384.   term.setTextColour(colours.white)\
  385.         elseif gamemode == \"ex\" then\
  386.             print(\"Goodbye!\")\
  387.             sleep(2)\
  388.             clear()\
  389.             error()\
  390.             \
  391.         elseif gamemode == \"m\" then\
  392.             moreInfo()\
  393.             \
  394.         else\
  395.             print(\"Invalid Answer\")\
  396.             sleep(1)\
  397.         end\
  398.     until gtype ~= nil\
  399.     clear()\
  400.     print(\"Are you ready? (y/n)\")\
  401.     io.write(\"> \")\
  402.     local input = string.lower(io.read())\
  403.     if input == \"y\" then\
  404.         clear()\
  405.         if gtype == \"easy\" then \
  406.             geasy()\
  407.             start()\
  408.         elseif gtype == \"hard\" then \
  409.             ghard() \
  410.             start()\
  411.         elseif gtype == \"insane\" then \
  412.             ginsane()\
  413.             start()\
  414.         else\
  415.             print(\"An Unknown Error Occurred...\")\
  416.             sleep(2)\
  417.             error()\
  418.         end\
  419.     else\
  420.         start()\
  421.     end\
  422. end\
  423. \
  424. function geasy()\
  425.     x = parallel.waitForAny(gsleep, easy)\
  426.     if x == 2 then\
  427.         if isCorrect == false then\
  428.             start()\
  429.         else\
  430.             score = score + 1\
  431.             gtime = gtime - 0.2\
  432.             sleep(1)\
  433.             geasy()\
  434.         end\
  435.     end\
  436.     if x == 1 then\
  437.         print(\"\\nTime is up! You lose!\")\
  438.         if score > hs then\
  439.             print(\"New High Score!\")\
  440.             saveScore(score)\
  441.         end\
  442.         sleep(2)\
  443.         return \"HI\"\
  444.     end\
  445. end\
  446. \
  447. function ghard()\
  448.     x = parallel.waitForAny(hard, gsleep)\
  449.     if x == 1 then\
  450.         if isCorrect == false then\
  451.             start()\
  452.         else\
  453.             score = score + 1\
  454.             gtime = gtime - 0.2\
  455.             sleep(1)\
  456.             geasy()\
  457.         end\
  458.     end\
  459.     if x == 2 then\
  460.         print(\"\\nTime is up! You lose!\")\
  461.         if score > hs then\
  462.             print(\"New High Score!\")\
  463.             saveScore(score)\
  464.         end\
  465.         sleep(2)\
  466.         return \"HI\"\
  467.     end\
  468. end\
  469. \
  470. function ginsane()\
  471.     x = parallel.waitForAny(insane, gsleep)\
  472.     if x == 1 then\
  473.         if isCorrect == false then\
  474.             start()\
  475.         else\
  476.             score = score + 1\
  477.             gtime = gtime - 0.2\
  478.             sleep(1)\
  479.             geasy()\
  480.         end end\
  481.     if x == 2 then\
  482.         print(\"\\nTime is up! You lose!\")\
  483.         if score > hs then\
  484.             print(\"New High Score!\")\
  485.             saveScore(score)\
  486.         end\
  487.         sleep(2)\
  488.         return \"HI\"\
  489.     end\
  490. end\
  491. \
  492. print(\"Getting highscore...\")\
  493. hs = getScore()\
  494. function timew()\
  495.     io.write(\"Enter time > \")\
  496.     htime = tonumber(io.read())\
  497.     if htime == nil then\
  498.         print(\"Must be a number\")\
  499.         timew()\
  500.     elseif htime < 0 then\
  501.         print(\"Must be greater than 0\")\
  502.         timew()\
  503.     elseif htime > 10 then\
  504.         print(\"Must be less than or equal to 10\")\
  505.         timew()\
  506.     else\
  507.         gtime = htime\
  508.     end\
  509. end\
  510. timew()    \
  511. print(\"Initializing...\")\
  512. sleep(0.82946)\
  513. clear()\
  514. sleep(1)\
  515. if term.isColor() then\
  516.     paintutils.drawImage(img, 19, 4)\
  517.     term.setCursorPos(11, 13)\
  518.     term.setBackgroundColor(colors.black)\
  519.     write(\"UseTheForce Productions Presents\")\
  520. else\
  521.     term.setCursorPos(11, 10)\
  522.     write(\"UseTheForce Productions Presents\")\
  523. end\
  524. sleep(3)\
  525. term.setBackgroundColor(colors.black)\
  526. clear()\
  527. start()",
  528.   cube = "\
  529.            eeeeeeeeeeeeeee\
  530.            eeeeeeeeeeeeeee\
  531.            eeeeeeeeeeeeeee\
  532.            eeeeeeeeeeeeeee\
  533.            eeeeeeeeeeeeeee\
  534.            eeeeeeeeeeeeeee\
  535.            eeeeeeeeeeeeeee\
  536.            eeeeeeeeeeeeeee\
  537.            eeeeeeeeeeeeeee\
  538.            eeeeeeeeeeeeeee",
  539.   [ ".copyprotect" ] = "BDFHJLNP",
  540.   [ "goldrunner/levels/07_pyramid" ] = "        8     bbbb  0 b     b                    \
  541.        8b bbbb    8bbb  5  b                    \
  542.        8b        8bbb   8  b                    \
  543.        8bbbbbbbbbbbbbbbbbbbb                    \
  544.        8                                        \
  545.        8                          ddd          b\
  546.        8                         c   bbbbbbbbbcb\
  547.        8                         c      4bbb  cb\
  548. b       8ddd ddddddd   e   dddddddc      bbb4  cb\
  549. bbbbbbbbb   c       bbbbbbb       c      4bbb  cb\
  550. b       b   c      bbb444bbb      c      bbb4  cb\
  551. b   4   b   c     bbb4   4bbb     c      4bbb  cb\
  552. b  bbb  b   c    bbb4     4bbb    c      7777  cb\
  553. b 4   4 b   c   bbb4       4bbb   cbbbbbbbbbbbbbb\
  554. b bbbbb b   c  bbb           bbb  c             b\
  555. bddd4dddb   c bbbbbbbbbbbbbbbbbbb c cbbb        b\
  556. b4  b  4    c      e       e      c cbbb 4444   b\
  557. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  558.   [ "goldrunner/levels/classic_002" ] = "bbbbbbbbbb   4                       5bbbbbbbbbb\
  559. bbbbbbbbbbc77b77c           4        cbbbbbbbbbb\
  560. bbbbbbbbbbc     c    cbbbbbbbbbc 4   cbbbbbbbbbb\
  561. bbbbbbbbbbc 4 e c    c         cbbbb1cbbbbbbbbbb\
  562. bbbbbbbbbbcb7b7bc    c         c     8bbbbbbbbbb\
  563. bbbbbbbbbbc     cddddcdddddd  ec     8bbbbbbbbbb\
  564. bbbbbbbbbbc     c    c     cbbb777777cbbbbbbbbbb\
  565. bbbbbbbbbbc     c    c  4  c         cbbbbbbbbbb\
  566. bbbbbbbbbbc   e c 4  cbbbbbc         cbbbbbbbbbb\
  567. bbbbbbbbbb7bbb7bb7bb7c         cbbbcbbbbbbbbbbbb\
  568. bbbbbbbbbb7bbb7      c         c   c  bbbbbbbbbb\
  569. bbbbbbbbbb74  7      c   ddddddc   c 4bbbbbbbbbb\
  570. bbbbbbbbbbbbbbbbbbcbbb7777     c  bbbbbbbbbbbbbb\
  571. bbbbbbbbbb        c            c      bbbbbbbbbb\
  572. bbbbbbbbbb        c   0        c      bbbbbbbbbb\
  573. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  574. 7777777777777777777777777777777777777777777777777",
  575.   [ "goldrunner/levels/09_skyislands" ] = "                                                 \
  576.                        05          ddddd 4e4    \
  577.     4ddddddd           cc               bbcbb   \
  578.  bbbc       4          ccddddd     4      c     \
  579.   4 c       4     dddddcc     bbbb        c  4  \
  580.  bcbb       4    4     cc     b44bddd  4  c4    \
  581.   c4       bbbbbbbb    cc     bbbb   bbbbbbbb   \
  582.  bbcb        4  4      ccdddddddd    b  e 44b   \
  583.    c        4    4     cc            b cbbbbb   \
  584.    c ddd               cc         4  b4c    b   \
  585.  bbbb   bbbbbbbbbbbb   cc      cbbb  bbcddc b   \
  586.         bbbbbbbbbbbb   cc    4 c4    b c  c b   \
  587.           b4    c  ddddcc  bbbbbbb   b4c4bc4b   \
  588.         c bbbbbbc 4b   cc            bbbbbbbb   \
  589.         c4b4   ec  b   cc                4      \
  590.         bbbbbbbbbbbb   cc                       \
  591. 7            e       4  cc  4                   7\
  592. 7b7b7b7b7b7b7b7b7b7b7b7b77b7b7b7b7b7b7b7b7b7b7b77",
  593.   pack = "local function listAll(_path, _files)\
  594.  local path = _path or \"\"\
  595.  local files = _files or {}\
  596.  for _, file in ipairs(fs.list(path)) do\
  597.    local path = fs.combine(path, file)\
  598.    if fs.isDir(path) and file ~= \"rom\" then\
  599.      listAll(path, files)\
  600.    else\
  601.      if file ~= \"startup\" and file ~= \"rom\" then\
  602.        table.insert(files, path)\
  603.      end\
  604.    end\
  605.  end\
  606.  return files\
  607. end\
  608. function getAll()\
  609.  files = listAll()\
  610.  data = {}\
  611.  for i,v in pairs(files) do\
  612.    f = fs.open(v,\"r\")\
  613.    data[v] = f.readAll()\
  614.    f.close()\
  615.  end\
  616.  return data\
  617. end\
  618. function save(table,pref)\
  619.  for i,v in pairs(table) do\
  620.    f = fs.open(pref..i,\"w\")\
  621.    f.writeLine(v)\
  622.    f.close()\
  623.  end\
  624. end",
  625.   [ "redcast/files/lang/en" ] = "return {\
  626.  start = {\
  627.    welcome = \"Welcome to RedCast.\",\
  628.    revolution = \"The console revolution.\",\
  629.    setup = \"Press DEL to enter setup.\",\
  630.    free = \"You have %free% bytes left.\"\
  631.  },\
  632.  disk = {\
  633.    detect = \"Disk detected.\",\
  634.    media = \"Media disk detected.\",\
  635.    playquestion = \"Would you like to play the music?\",\
  636.    play = \"Now playing %title%\"\
  637.  },\
  638.  gui = {\
  639.    advancedonly = \"This GUI can not be run on monochrome computers.\",\
  640.    menu = {\
  641.      restart = \"Restart\",\
  642.      shutdown = \"Shutdown\",\
  643.      chatmanager = \"Chat\",\
  644.      paint = \"Paint\",\
  645.      redspace = \"RedSpace\",\
  646.      floppy = \"Floppy\",\
  647.      credits = \"Credits\"\
  648.    },\
  649.    paint = {\
  650.      open = \"Enter new/existing file name: \"\
  651.    },\
  652.    redspace = {\
  653.      id = \"Enter server ID: \"\
  654.    }\
  655.  }\
  656. }",
  657.   [ "goldrunner/startgame" ] = "--[[\
  658.     Gold Runner\
  659.     \
  660.     Inspired by the game by Doug Smith\
  661.     Collect all the gold while not being eaten by the monks!\
  662. \
  663.     Written by: Nitrogen Fingers\
  664. ]]--\
  665. \
  666. local version = 1.0\
  667. local reponame = \"Gold Runner\"\
  668. local requiresColour = true\
  669. if requiresColour then\
  670.     print(\"This game can only be played on an Advanced Computer.\")\
  671. end\
  672. \
  673. local function displayNitrosoftTitle()\
  674.     shell.run(\"clear\")\
  675.     local _w,_h = term.getSize()\
  676.     local _t1,_t2 = \"nitrosoft\", \"games\"\
  677.     term.setCursorPos(math.floor(_w/2-#_t1), math.floor(_h/2))\
  678.     if term.isColour() then term.setTextColour(colours.blue) end\
  679.     term.write(_t1)\
  680.     term.setCursorPos(math.floor(_w/2-#_t2/2),math.floor(_h/2)+1)\
  681.     term.setTextColour(colours.white)\
  682.     term.write(_t2)\
  683.     term.setCursorPos(math.floor(_w/2-#_t1), math.floor(_h/2)+2)\
  684.     if term.isColour() then term.setTextColour(colours.yellow) end\
  685.     term.write(string.rep(\"$\",#_t1*2))\
  686.     if term.isColour() then\
  687.         term.setBackgroundColour(colours.green)\
  688.         term.setCursorPos(_w/2+#_t1-4, math.floor(_h/2)-2)\
  689.         term.write(\"  \")\
  690.         term.setCursorPos(_w/2+#_t1-4, math.floor(_h/2)-1)\
  691.         term.write(\"  \")\
  692.         term.setBackgroundColour(colours.lime)\
  693.         term.setCursorPos(_w/2+#_t1-3, math.floor(_h/2)-1)\
  694.         term.write(\"  \")\
  695.         term.setCursorPos(_w/2+#_t1-3, math.floor(_h/2))\
  696.         term.write(\"  \")\
  697.     end\
  698.     term.setBackgroundColour(colours.black)\
  699.     term.setTextColour(colours.white)\
  700.     term.setCursorPos(1,_h)\
  701.     term.write(\"v\"..version)\
  702.     os.pullEvent(\"key\")\
  703. end\
  704. displayNitrosoftTitle()\
  705. \
  706. local w,h = term.getSize()\
  707. \
  708. local running = true\
  709. local started = false\
  710. local nextLevel = false\
  711. \
  712. local inLevelSelect = false\
  713. local inLevelEditor = false\
  714. local levelEditName = nil\
  715. local hexnums = { [10] = \"a\", [11] = \"b\", [12] = \"c\", [13] = \"d\", [14] = \"e\" , [15] = \"f\" }\
  716. \
  717. local titleLoaded = false\
  718. local menSel = \"none\"\
  719. local titleOptions = { \"New Game\", \"Select Level\", \"Create Level\", \"Quit\" }\
  720. local inGameOptions = { \"Restart\", \"Edit Level\", \"Back to Title\", \"Quit\" }\
  721. local levelEditOptions = { \"Save\", \"Play Level\", \"Save and Exit\", \"Discard and Exit\" }\
  722. local menIndex = 1\
  723. \
  724. local maxnamelen = 14\
  725. \
  726. local drawOffsetX = 1\
  727. local drawOffsetY = 0\
  728. \
  729. local map = {}\
  730. local goldMap = {}\
  731. local blockTimers = {}\
  732. local blockIntv = 5\
  733. \
  734. local monks = {}\
  735. local monkTimer = -1\
  736. local monkSpawnIntv = 3\
  737. local monkTrapIntv = blockIntv/2\
  738. \
  739. local goldCount = 0\
  740. local maxGoldCount = 0\
  741. local playerLives = 3\
  742. local playerScore = 0\
  743. local plspawnX = 0\
  744. local plspawnY = 0\
  745. \
  746. local plX = 0\
  747. local plY = 0\
  748. local pfalling = false\
  749. local moveTimer = -1\
  750. local shootTimer = -1\
  751. local spawnTimer = -1\
  752. local moveIntv = 0.15\
  753. \
  754. local exX = 0\
  755. local exY = 0\
  756. \
  757. local levelList = {}\
  758. local currentLevel = 1\
  759. local levelLot = 1\
  760. \
  761. local titleLevel = {\
  762.     \"                                                 \";\
  763.     \"                                  dddddddddddc   \";\
  764.     \"                                 4           c   \";\
  765.     \"      4                                    4 c   \";\
  766.     \"  bbbbbbc                               bcbbbb   \";\
  767.     \"  b 4 b c                                c       \";\
  768.     \"  bbbbb c  4                  dd 0     4 c 4     \";\
  769.     \"        bbcb                    bbb     bbbbc    \";\
  770.     \"          c                                 c    \";\
  771.     \"          c                             ddd c  eb\";\
  772.     \"     dddddc                          bcb   cbbbbb\";\
  773.     \"    c                                 c    c bbbb\";\
  774.     \"b4  c                                4c     bb44b\";\
  775.     \"bbb c    4  e                   bbbcbbbbbbbbbbbbb\";\
  776.     \"bbbbbbbbbbbbbbc           4        cbbbbb 4  bbbb\";\
  777.     \"bbbbbbfff44fbbc 4     cbbbbbbb     cbbbbbbb bbbbb\";\
  778.     \"bbbbffffbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 4 bbbbbbb\";\
  779.     \"bbbffbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb5  bbbbbbbbb\";\
  780. }\
  781. \
  782. local function parseValue(x, y, lchar)\
  783. if tonumber(lchar, 16) then\
  784.     lchar = math.pow(2, tonumber(lchar,16))\
  785.     \
  786.     if lchar == colours.blue then\
  787.       map[y][x] = 0\
  788.     elseif lchar == colours.brown then\
  789.       map[y][x] = 'H'\
  790.     elseif lchar == colours.yellow then\
  791.       goldMap[y][x] = 1\
  792.       goldCount = goldCount + 1\
  793.     elseif lchar == colours.orange then\
  794.       map[y][x] = 'V'\
  795.     elseif lchar == colours.green then\
  796.       map[y][x] = '-'\
  797.     elseif lchar == colours.lightGrey then\
  798.       map[y][x] = 'h'\
  799.     elseif lchar == colours.grey then\
  800.       map[y][x] = '#'\
  801.     elseif lchar == colours.white then\
  802.       plX = x\
  803.       plspawnX = x\
  804.       plY = y\
  805.       plspawnY = y\
  806.     elseif lchar == colours.lime then\
  807.       exX = x\
  808.       exY = y\
  809.     elseif lchar == colours.red then\
  810.       table.insert(monks, {\
  811.         --X and Y, clear enough\
  812.         x = x, y = y;\
  813.         --Where they spawn when they die\
  814.         spawnX = x, spawnY = y;\
  815.         -- Any gold they're carring- it's a 1 in 5\
  816.         gold = false;\
  817.         -- Whether or not they're falling\
  818.         falling = false;\
  819.         -- Timer if they're dead to respawn\
  820.         dead = nil;\
  821.         --Whether or not the monk has just spawned\
  822.         justSpawned = true;\
  823.         --Whether or not the monk has just escaped\
  824.         justEscaped = false;\
  825.         -- Current aim- it's \"up\", \"down\", \"across\" or \"none\"\
  826.         behaviour = \"none\";\
  827.         -- The desired x position to travel to, when one is necessary.\
  828.         desX = nil;\
  829.         -- The escape timer\
  830.         trapped = nil;\
  831.       })\
  832.     end\
  833.  end\
  834. end\
  835. \
  836. local function loadMap(_sPath)\
  837.  if not fs.exists(_sPath) then return false end\
  838.  map = {}\
  839.  goldMap = {}\
  840.  monks = {}\
  841.  goldCount = 0\
  842.    \
  843.  local file = fs.open(_sPath, \"r\")\
  844.  local line = file:readLine()\
  845.  while line do\
  846.    goldMap[#map+1] = {}\
  847.    map[#map+1] = {}\
  848.    for i=1,math.min(#line,49) do\
  849.      local lchar = string.sub(line,i,i)\
  850.      parseValue(i, #map, lchar)\
  851.    end\
  852.    if #map == 18 then break end\
  853.    line = file:readLine()\
  854.  end\
  855.  file:close()\
  856.  maxGoldCount = goldCount\
  857.  titleLoaded = false\
  858.  return true\
  859. end\
  860. \
  861. --When something moves or something needs to be drawn, we\
  862. --just change the appropriate tile with this method.\
  863. local function updateMap(x,y)\
  864.     term.setCursorPos(x + drawOffsetX, y + drawOffsetY)\
  865.     term.setBackgroundColour(colours.black)\
  866.    if plX == x and plY == y and map[y][x] ~= 0 then\
  867.      term.setTextColour(colours.white)\
  868.       if map[y][x] == 1 then term.setBackgroundColour(colours.lightBlue)\
  869.       elseif map[y][x] == \"V\" then term.setBackgroundColour(colours.blue) end\
  870.      term.write(\"&\")\
  871.    elseif map[y][x] == 'H' then\
  872.      term.setTextColour(colours.brown)\
  873.      term.write(\"H\")\
  874.     --Level Editor stuff\
  875.     elseif map[y][x] == 'h' and (goldCount == 0 or inLevelEditor) then\
  876.       if inLevelEditor then term.setTextColour(colours.lightGrey)\
  877.       else term.setTextColour(colours.brown) end\
  878.       term.write(\"H\")\
  879.     elseif map[y][x] == '&' and inLevelEditor then\
  880.       term.setTextColour(colours.pink)\
  881.       term.write('&')\
  882.     elseif map[y][x] == 'V' then\
  883.       term.setBackgroundColour(colours.blue)\
  884.       if inLevelEditor then\
  885.         term.setTextColour(colours.orange)\
  886.         term.write(\"V\")\
  887.       else\
  888.         term.write(\" \")\
  889.       end\
  890.    elseif map[y][x] == '-' then\
  891.      term.setTextColour(colours.brown)\
  892.      term.write(map[y][x])\
  893.    elseif map[y][x] == '#' then\
  894.      term.setBackgroundColour(colours.grey)\
  895.      term.write(\" \")\
  896.    elseif type(map[y][x]) == \"number\" then\
  897.      local uchar = ' '\
  898.       if map[y][x] == 3 then\
  899.         term.setBackgroundColour(colours.lightBlue)\
  900.      elseif map[y][x] == 2 and goldMap[y][x] == 1 then\
  901.        term.setTextColour(colours.yellow)\
  902.        uchar = '$'\
  903.      elseif map[y][x] == 1 then\
  904.        term.setBackgroundColour(colours.lightBlue)\
  905.      elseif map[y][x] == 0 then\
  906.        term.setBackgroundColour(colours.blue)\
  907.      end\
  908.      term.write(uchar)\
  909.    elseif goldMap[y][x] == 1 or goldMap[y][x] == 2 then\
  910.      term.setTextColour(colours.yellow)\
  911.       term.write(\"$\")\
  912.    elseif exX == x and exY == y and (goldCount == 0 or inLevelEditor) then\
  913.      term.setTextColour(colours.lime)\
  914.      term.write(\"@\")\
  915.    else\
  916.      term.write(\" \")\
  917.    end\
  918. end\
  919. \
  920. --It's silly to iterate through all monks when drawing tiles, so\
  921. --we do it separately.\
  922. local function drawMonk(monk)\
  923.     term.setCursorPos(monk.x + drawOffsetX, monk.y + drawOffsetY)\
  924.     if monk.justSpawned then term.setTextColour(colours.pink)\
  925.     else term.setTextColour(colours.red) end\
  926.     if map[monk.y][monk.x] == 1 then term.setBackgroundColour(colours.lightBlue)\
  927.     elseif map[monk.y][monk.x] == \"V\" then term.setBackgroundColour(colours.blue)\
  928.     else term.setBackgroundColour(colours.black) end\
  929.     term.write(\"&\")\
  930. end\
  931. \
  932. --Draws the map for the first time. It barely changes, so we really\
  933. --only call this the once.\
  934. local function drawMap()\
  935.  term.setBackgroundColour(colours.black)\
  936.  term.clear()\
  937.  for y=1,#map do\
  938.    for x=1,49 do\
  939.       updateMap(x,y)\
  940.    end\
  941.  end\
  942.  for _,monk in pairs(monks) do drawMonk(monk)end\
  943. end\
  944. \
  945. --When all coins have been collected, we add in invisble ladders and\
  946. --the end game portal.\
  947. local function drawEndgameMap()\
  948.  for y=1,#map do\
  949.    for x=1,49 do\
  950.       if map[y][x] == 'h' or (exX == x and exY == y) then\
  951.         updateMap(x,y)\
  952.       end\
  953.    end\
  954.  end\
  955. end\
  956. \
  957. --Sets the map back to defaults, so we can start afresh\
  958. local function resetMap()\
  959.     goldCount = maxGoldCount\
  960.     for i=1,#goldMap do\
  961.         for j=1,49 do\
  962.             if goldMap[i][j] == 0 then goldMap[i][j] = 1 end\
  963.             if goldMap[i][j] == 2 then goldMap[i][j] = nil end\
  964.         end\
  965.     end\
  966.     for _,monk in pairs(monks) do\
  967.         monk.justSpawned = true\
  968.         monk.dead = nil\
  969.         monk.trapped = nil\
  970.         monk.justEscaped = false\
  971.         monk.falling = false\
  972.         monk.behaviour = \"none\"\
  973.         monk.x = monk.spawnX\
  974.         monk.y = monk.spawnY\
  975.     end\
  976.     \
  977.     for _,timer in pairs(blockTimers) do\
  978.         map[timer.y][timer.x] = 0\
  979.     end\
  980.     blockTimers = {}\
  981.     plX = plspawnX\
  982.     plY = plspawnY\
  983.     \
  984.     moveTimer = -1\
  985.     shootTimer = -1\
  986.     spawnTimer = -1\
  987.     monkTimer = -1\
  988.     pfalling = false\
  989. end\
  990. \
  991. --Draws the HUD. This also rarely changes, so we update it when something happens.\
  992. local function drawHUD()\
  993.  term.setCursorPos(2,19)\
  994.  term.setBackgroundColour(colours.black)\
  995.  term.clearLine()\
  996.  term.setTextColour(colours.blue)\
  997.  term.write(\"Score: \")\
  998.  term.setTextColour(colours.yellow)\
  999.  term.write(string.rep(\"0\", 5-math.floor(math.log10(playerScore + 1)))\
  1000.    ..playerScore)\
  1001.  term.setTextColour(colours.yellow)\
  1002.  term.setCursorPos(25 - #levelList[currentLevel]/2, 19)\
  1003.  term.write(levelList[currentLevel])\
  1004.  local lstr = \"Men: \"\
  1005.  term.setCursorPos(50 - #lstr - math.floor(math.log10(playerLives)), 19)\
  1006.  term.setTextColour(colours.blue)\
  1007.  term.write(lstr)\
  1008.  term.setTextColour(colours.yellow)\
  1009.  term.write(playerLives..\"\")\
  1010. end\
  1011. \
  1012. --Draws the list of levels known, with respect to screen\
  1013. --real estate\
  1014. local function drawLevelList()\
  1015.     local minLev = ((levelLot-1) * 10 + 1)\
  1016.     local maxLev = minLev + math.min(10, #levelList - (levelLot-1) * 10) - 1\
  1017.     \
  1018.     term.setCursorPos(7, 2)\
  1019.     term.setBackgroundColour(colours.black)\
  1020.     term.clearLine()\
  1021.     for j = 1,49 do updateMap(j,2) end\
  1022.     \
  1023.     term.setBackgroundColour(colours.black)\
  1024.     term.setTextColour(colours.white)\
  1025.     term.setCursorPos(7, 2)\
  1026.     local msg = \"Levels \"..minLev..\" to \"..maxLev..\" of \"..#levelList\
  1027.     term.write(msg)\
  1028.     \
  1029.     term.setTextColour(colours.yellow)\
  1030.     term.setCursorPos(4, 2)\
  1031.     if levelLot > 1 then term.write(\"<-\")\
  1032.     else term.write(\"  \") end \
  1033.     \
  1034.     term.setCursorPos(8 + #msg, 2)\
  1035.     if maxLev < #levelList then term.write(\"->\")\
  1036.     else term.write(\" \") end\
  1037.     \
  1038.     for i = 1,10 do\
  1039.         term.setCursorPos(1, 3+i)\
  1040.         for j = 1,49 do updateMap(j,3+i) end\
  1041.         term.setTextColour(colours.white)\
  1042.         term.setBackgroundColour(colours.black)\
  1043.         term.setCursorPos(17, 3+i)\
  1044.         if i + (levelLot-1)*10 - 1 < maxLev then\
  1045.             term.write(levelList[10 * (levelLot-1) + i])\
  1046.         end\
  1047.     end\
  1048. end\
  1049. \
  1050. --Loads up and draws up the title screen, for a nice\
  1051. --intro to Gold Runner\
  1052. local function loadTitleScreen()\
  1053.  map = {}\
  1054.  goldMap = {}\
  1055.  monks = {}\
  1056.  goldCount = 0\
  1057.  for i=1,#titleLevel do\
  1058.     local line = titleLevel[i]\
  1059.    goldMap[#map+1] = {}\
  1060.    map[#map+1] = {}\
  1061.    for i=1,math.min(#line,49) do\
  1062.      local lchar = string.sub(line,i,i)\
  1063.      parseValue(i, #map, lchar)\
  1064.    end\
  1065.    if #map == 18 then break end\
  1066.  end\
  1067.  maxGoldCount = goldCount\
  1068.  \
  1069.  drawMap()\
  1070.  term.setCursorPos(1,19)\
  1071.  term.setBackgroundColour(colours.blue)\
  1072.  term.clearLine()\
  1073.  \
  1074.  menIndex = 1\
  1075.  titleLoaded = true\
  1076. end\
  1077. \
  1078. --Opens an in-game menu to display a series of options.\
  1079. local function inGameMenu(menuList)\
  1080.     menIndex = 1\
  1081.     \
  1082.     local squareTop,squareBottom = 4,6 + #menuList * 2\
  1083.     local squareSize = 0\
  1084.     for i=1,#menuList do squareSize = math.max(squareSize, #menuList[i] + 6) end\
  1085.     \
  1086.     for y=squareTop,squareBottom do\
  1087.         term.setCursorPos(w/2 - squareSize/2, y)\
  1088.         term.setBackgroundColour(colours.lightBlue)\
  1089.         term.write(string.rep(\" \", squareSize))\
  1090.         \
  1091.         if y ~= squareTop and y ~= squareBottom then\
  1092.             term.setCursorPos(w/2 - squareSize/2 + 1, y)\
  1093.             term.setBackgroundColour(colours.black)\
  1094.             term.write(string.rep(\" \", squareSize - 2))\
  1095.         end\
  1096.         \
  1097.         if y ~= squareTop and y ~= squareBottom and y % 2 == 0 then\
  1098.             local opt = menuList[(y - squareTop) / 2]\
  1099.             term.setCursorPos(w/2 - #opt/2, y)\
  1100.             term.setTextColour(colours.white)\
  1101.             term.write(opt)\
  1102.         end\
  1103.     end\
  1104.     \
  1105.     local p1 = nil\
  1106.     repeat\
  1107.         for i=1,#menuList do\
  1108.             term.setBackgroundColour(colours.black)\
  1109.             term.setTextColour(colours.yellow)\
  1110.             if i == menIndex then\
  1111.                 term.setCursorPos(w/2 - squareSize/2 + 1, squareTop + i * 2)\
  1112.                 term.write(\">\")\
  1113.                 term.setCursorPos(w/2 + squareSize/2 - 2, squareTop + i * 2)\
  1114.                 term.write(\"<\")\
  1115.             else\
  1116.                 term.setCursorPos(w/2 - squareSize/2 + 1, squareTop + i * 2)\
  1117.                 term.write(\" \")\
  1118.                 term.setCursorPos(w/2 + squareSize/2 - 2, squareTop + i * 2)\
  1119.                 term.write(\" \")\
  1120.             end\
  1121.         end\
  1122.         _,p1 = os.pullEvent(\"key\")\
  1123.         \
  1124.         if p1 == keys.up and menIndex > 1 then menIndex = menIndex - 1\
  1125.         elseif p1 == keys.down and menIndex < #menuList then menIndex = menIndex + 1 end\
  1126.     until p1 == keys.enter\
  1127.     \
  1128.     return menuList[menIndex]\
  1129. end\
  1130. \
  1131. --Checks to see if any given desired move is legal. Monks and players both use this.\
  1132. local function isLegalMove(initX,initY,finX,finY)\
  1133.     if finY < 1 or finY > #map or finX < 1 or finX > 49 then \
  1134.         return false \
  1135.     end\
  1136.     \
  1137.     if map[finY][finX] ~= 0 and map[finY][finX] ~= '#' then\
  1138.         --This reports 'self moves' as being illegal, but that's fine\
  1139.         for _,monk in pairs(monks) do\
  1140.             if monk.x == finX and monk.y == finY then return false end\
  1141.         end\
  1142. \
  1143.         if finY == initY-1 and (map[initY][initX] == \"H\" or (map[initY][initX] == \"h\" and goldCount == 0))\
  1144.             then return true\
  1145.         elseif finY == initY+1 and (map[finY][finX] == \"H\" or (map[finY][finX] == \"h\" and goldCount == 0)\
  1146.                 or (type(map[finY][finX]) == \"number\" and map[finY][finX] > 0) or map[finY][finX] == nil or\
  1147.                 map[finY][finX] == \"V\" or map[finY][finX] == \"-\" or (map[finY][finX] == 'h' and goldCount ~= 0)) \
  1148.             then return true\
  1149.         elseif finX == initX-1 or finX == initX+1 then \
  1150.             return true \
  1151.         end\
  1152.     end\
  1153. end\
  1154. \
  1155. --Moves the player to a given step.\
  1156. local function movePlayer(x,y,ignoreLegal)\
  1157.     if not ignoreLegal and not isLegalMove(plX,plY,x,y) then return false end\
  1158.     \
  1159.     local ox = plX\
  1160.     local oy = plY\
  1161.     plX = x\
  1162.     plY = y\
  1163.     \
  1164.     updateMap(ox,oy)\
  1165.     updateMap(x,y)\
  1166.     if goldMap[y][x] == 1 or goldMap[y][x] == 2 then\
  1167.         if goldMap[y][x] == 1 then goldMap[y][x] = 0\
  1168.         else goldMap[y][x] = nil end\
  1169.         goldCount = goldCount - 1\
  1170.         playerScore = playerScore + 5\
  1171.         if started then drawHUD() end\
  1172.         if (goldCount == 0) then\
  1173.             drawEndgameMap()\
  1174.         end\
  1175.     elseif exX == plX and exY == plY and goldCount == 0 then\
  1176.         started = false\
  1177.         nextLevel = true\
  1178.     end\
  1179.     \
  1180.     pfalling = (y < #map and map[y][x] ~= '-' and map[y][x] ~= 'H' and not (map[y][x] == 'h' and goldCount == 0) \
  1181.         and (map[y+1][x] == nil or map[y+1][x] == \"V\" or map[y+1][x] == 2 or map[y+1][x] == '-'))\
  1182.     if (y < #map and map[y+1][x] == 'h' and goldCount ~= 0) then pfalling = true end\
  1183.     for _,monk in pairs(monks) do\
  1184.         if monk.x == plX and monk.y == plY + 1 then pfalling = false break end\
  1185.     end\
  1186.     \
  1187.     return true\
  1188. end\
  1189. \
  1190. --This is a quick evaluation to save some space and check if the monk is either\
  1191. --picking up (or dropping) any gold.\
  1192. local function updateMonkGold(monk)\
  1193.     --When walking over gold they'll occasionally pick it up\
  1194.     if not monk.gold and (goldMap[monk.y][monk.x] == 1 or goldMap[monk.y][monk.x] == 2) then\
  1195.         --There's a 1 in 5 they pick it up\
  1196.         local pickup = math.random(1,5)\
  1197.         if pickup == 1 then\
  1198.             if goldMap[monk.y][monk.x] == 1 then\
  1199.                 goldMap[monk.y][monk.x] = 0\
  1200.             else\
  1201.                 goldMap[monk.y][monk.x] = nil\
  1202.             end\
  1203.             monk.gold = true\
  1204.             return\
  1205.         end\
  1206.     --When carrying gold they'll occasionally drop it\
  1207.     end if monk.gold and goldMap[monk.y][monk.x] ~= 1 and not map[monk.y][monk.x] then\
  1208.         --It's a much smaller chance that they'll drop it\
  1209.         local drop = math.random(1,30)\
  1210.         if drop == 1 then\
  1211.             if goldMap[monk.y][monk.x] == 0 then\
  1212.                 goldMap[monk.y][monk.x] = 1\
  1213.             else\
  1214.                 goldMap[monk.y][monk.x] = 2\
  1215.             end\
  1216.             monk.gold = false\
  1217.             return\
  1218.         end\
  1219.     end\
  1220. end\
  1221. \
  1222. local function updateMonks()\
  1223.     for _,monk in pairs(monks) do\
  1224.         --Before we start moving we check if he's falling or not. \
  1225.         if not monk.trapped and not monk.dead and not monk.justSpawed then\
  1226.             monk.falling = (monk.y < #map and map[monk.y][monk.x] ~= '-' and map[monk.y][monk.x] ~= \"H\" and not\
  1227.                 (map[monk.y][monk.x] == 'h' and goldCount == 0) and (map[monk.y+1][monk.x] == nil or map[monk.y+1][monk.x] == \"V\" or\
  1228.                 map[monk.y+1][monk.x] == 2 or map[monk.y+1][monk.x] == '-') and type(map[monk.y][monk.x] ~= \"number\"))\
  1229.             for _,omonk in pairs(monks) do\
  1230.                 if omonk.x == monk.x and omonk.y == monk.y + 1 then monk.falling = false break end\
  1231.             end\
  1232.             if monk.x == plX and monk.y == plY + 1 then monk.falling = false end\
  1233.         end\
  1234.     \
  1235.         --Our first move check; if he's trapped or dead, he's going nowhere\
  1236.         if monk.trapped then\
  1237.             --Trapped monks also drop any gold they're carrying\
  1238.             if monk.gold then\
  1239.                 if goldMap[monk.y-1][monk.x] == 0 then\
  1240.                     monk.gold = false\
  1241.                     goldMap[monk.y-1][monk.x] = 1\
  1242.                 elseif goldMap[monk.y-1][monk.x] == nil then\
  1243.                     monk.gold = false\
  1244.                     goldMap[monk.y-1][monk.x] = 2\
  1245.                 end\
  1246.                 updateMap(monk.x,monk.y-1)\
  1247.             end\
  1248.         elseif monk.dead then\
  1249.         --He then checks immediately to see whether or not he's falling.\
  1250.         \
  1251.         --If he's just spawned he takes a second to orient himself\
  1252.         elseif monk.justSpawned then\
  1253.             monk.justSpawned = false\
  1254.             --We evaluate their falling behaviour here (as freed monks CAN stand on air)\
  1255.             monk.falling = (monk.y < #map and map[monk.y][monk.x] ~= '-' and map[monk.y][monk.x] ~= \"H\" and not\
  1256.                     (map[monk.y][monk.x] == 'h' and goldCount == 0) and (map[monk.y+1][monk.x] == nil or map[monk.y+1][monk.x] == \"V\" or\
  1257.                     map[monk.y+1][monk.x] == 2 or map[monk.y+1][monk.x] == '-') and type(map[monk.y][monk.x] ~= \"number\"))\
  1258.             for _,omonk in pairs(monks) do\
  1259.                 if omonk.x == monk.x and omonk.y == monk.y + 1 then monk.falling = false break end\
  1260.             end\
  1261.             if monk.x == plX and monk.y == plY + 1 then monk.falling = false end\
  1262.         --Then we consider if he's just gotten out of a hole\
  1263.         elseif monk.justEscaped then\
  1264.             monk.justEscaped = false\
  1265.             updateMonkGold(monk)\
  1266.             --He tries the player side first\
  1267.             local playerSide = (plX-monk.x) / math.abs(plX-monk.x)\
  1268.             if isLegalMove(monk.x, monk.y, monk.x + playerSide, monk.y) then\
  1269.                 monk.x = monk.x + playerSide\
  1270.                 updateMap(monk.x - playerSide, monk.y)\
  1271.             elseif isLegalMove(monk.x, monk.y, monk.x - playerSide, monk.y) then\
  1272.                 monk.x = monk.x - playerSide\
  1273.                 updateMap(monk.x + playerSide, monk.y)\
  1274.             end\
  1275.             drawMonk(monk)\
  1276.         --Then we evaluate falling\
  1277.         elseif monk.falling then\
  1278.             monk.behaviour = \"none\"\
  1279.             updateMonkGold(monk)\
  1280.             monk.y = monk.y + 1\
  1281.             monk.desX = nil\
  1282.             --If they fall into a land tile the player has dug up (unlike holes in the terrain) the monk is considered 'trapped' and will be able to climb out again later\
  1283.             if type(map[monk.y][monk.x]) == \"number\" then\
  1284.                 monk.trapped = os.startTimer(monkTrapIntv)\
  1285.                 monk.falling = false\
  1286.             else\
  1287.                 monk.falling = (monk.y < #map and map[monk.y][monk.x] ~= '-' and map[monk.y][monk.x] ~= \"H\" and not\
  1288.                     (map[monk.y][monk.x] == 'h' and goldCount == 0) and (map[monk.y+1][monk.x] == nil or map[monk.y+1][monk.x] == \"V\" or\
  1289.                     map[monk.y+1][monk.x] == 2 or map[monk.y+1][monk.x] == '-') and type(map[monk.y][monk.x] ~= \"number\"))\
  1290.                 for _,omonk in pairs(monks) do\
  1291.                     if omonk.x == monk.x and omonk.y == monk.y + 1 then monk.falling = false break end\
  1292.                 end\
  1293.                 if monk.x == plX and monk.y == plY + 1 then monk.falling = false end\
  1294.                 if monk.justEscaped then monk.falling = false end\
  1295.             end\
  1296.             updateMap(monk.x, monk.y-1)\
  1297.             drawMonk(monk)\
  1298.         --If he's on his feet and not trapped, he's allowed to think about where to move\
  1299.         elseif monk.y == plY then\
  1300.             --Is the monk on the same level as the player? How lucky! They'll just walk towards him\
  1301.             updateMonkGold(monk)\
  1302.             monk.desX = plX\
  1303.             monk.behaviour = \"across\"\
  1304.         --Y difference takes precedence over X (as in the original, makes them a bit smarter)\
  1305.         elseif monk.y < plY then\
  1306.             --If they can move down, they will\
  1307.             if isLegalMove(monk.x,monk.y,monk.x,monk.y+1) and not monk.justEscaped then\
  1308.                 monk.y = monk.y+1\
  1309.                 updateMap(monk.x, monk.y-1)\
  1310.                 drawMonk(monk)\
  1311.                 monk.desX = nil\
  1312.                 --A down move can lead to a fall, so we check if they're now falling.\
  1313.                 monk.falling = (monk.y < #map and map[monk.y][monk.x] ~= '-' and map[monk.y][monk.x] ~= \"H\" and not\
  1314.                     (map[monk.y][monk.x] == 'h' and goldCount == 0) and (map[monk.y+1][monk.x] == nil or map[monk.y+1][monk.x] == \"V\" or\
  1315.                     map[monk.y+1][monk.x] == 2 or map[monk.y+1][monk.x] == '-') and type(map[monk.y][monk.x] ~= \"number\"))\
  1316.                 for _,omonk in pairs(monks) do\
  1317.                     if omonk.x == monk.x and omonk.y == monk.y + 1 then monk.falling = false break end\
  1318.                 end\
  1319.                 if monk.x == plX and monk.y == plY + 1 then monk.falling = false end\
  1320.             --Otherwise, it's off to the nearest ladder, monkey bars or perilous ledge to jump off\
  1321.             --assuming they haven't found one already\
  1322.             elseif monk.desX == nil then\
  1323.                 updateMonkGold(monk)\
  1324.                 if monk.behaviour ~= \"down\" then monk.desX = nil end\
  1325.                 monk.behaviour = \"down\"\
  1326.                 monk.desX = nil\
  1327.                 local cmLeft = true\
  1328.                 local cmRight = true\
  1329.                 --We try to find the nearest by searching alternate left and right at variable distance\
  1330.                 for i=1,math.max(monk.x - 1, 49 - monk.x) do\
  1331.                     if monk.x-i > 0 and cmLeft then\
  1332.                         --If a wall blocks the monks path, they can't keep going left or right\
  1333.                         cmLeft = map[monk.y][monk.x-i] ~= 0\
  1334.                         --But if it's all clear, they look for something to climb/jump down\
  1335.                         if cmLeft and (map[monk.y+1][monk.x-i] == \"H\" or (map[monk.y+1][monk.x-i] == 'h' and goldCount == 0)\
  1336.                             or map[monk.y+1][monk.x-i] == nil or map[monk.y][monk.x-i] == '-') then\
  1337.                             monk.desX = monk.x-i\
  1338.                             break\
  1339.                         end\
  1340.                     end\
  1341.                     if monk.x+i < 50 and cmRight then\
  1342.                         --If a wall blocks the monks path, they can't keep going left or right\
  1343.                         cmRight = map[monk.y][monk.x+i] ~= 0\
  1344.                         --But if it's all clear, they look for something to climb/jump down\
  1345.                         if cmRight and (map[monk.y+1][monk.x+i] == \"H\" or (map[monk.y+1][monk.x+i] == 'h' and goldCount == 0)\
  1346.                             or map[monk.y+1][monk.x+i] == nil or map[monk.y][monk.x+i] == '-') then\
  1347.                             monk.desX = monk.x+i\
  1348.                             break\
  1349.                         end\
  1350.                     end\
  1351.                 end\
  1352.             end\
  1353.         --If the player isn't level or beneath them, he is above- so the monk must\
  1354.         --climb up to reach him\
  1355.         elseif monk.y > plY then\
  1356.             if monk.behaviour ~= \"up\" then monk.desX = nil end\
  1357.             monk.behaviour = \"up\"\
  1358.             --Same deal again- try moving up first\
  1359.             if isLegalMove(monk.x,monk.y,monk.x,monk.y-1) then\
  1360.                 monk.y = monk.y-1\
  1361.                 updateMap(monk.x, monk.y+1)\
  1362.                 drawMonk(monk)\
  1363.                 monk.desX = nil\
  1364.                 --You can never move up and start falling, so we don't bother to check\
  1365.             --Otherwise they need ladders to climb up\
  1366.             elseif monk.desX == nil then\
  1367.                 updateMonkGold(monk)\
  1368.                 monk.behaviour = \"up\"\
  1369.                 monk.desX = nil\
  1370.                 local cmLeft = true\
  1371.                 local cmRight = true\
  1372.                 --We try to find the nearest by searching alternate left and right at variable distance\
  1373.                 for i=1,math.max(monk.x - 1, 49 - monk.x) do\
  1374.                     if monk.x-i > 0 and cmLeft then\
  1375.                         --If a wall blocks the monks path or a pit is in the way, they can't keep going left or right\
  1376.                         cmLeft = map[monk.y][monk.x-i] ~= 0 and (monk.y == #map or map[monk.y+1][monk.x-i] ~= nil\
  1377.                                 or map[monk.y][monk.x-i] == '-' or map[monk.y][monk.x-i] == \"H\" or (map[monk.y][monk.x-i] == \"h\"\
  1378.                                 and goldCount == 0))\
  1379.                         --But if it's all clear, they look for a ladder\
  1380.                         if cmLeft and (map[monk.y][monk.x-i] == \"H\" or (map[monk.y][monk.x-i] == 'h' and goldCount == 0)) then\
  1381.                             monk.desX = monk.x-i\
  1382.                             break\
  1383.                         end\
  1384.                     end\
  1385.                     if monk.x+i < 50 and cmRight then\
  1386.                         cmRight = map[monk.y][monk.x+i] ~= 0 and (monk.y == #map or map[monk.y+1][monk.x+i] ~= nil\
  1387.                                 or map[monk.y][monk.x+i] == '-' or map[monk.y][monk.x+i] == \"H\" or (map[monk.y][monk.x+i] == \"h\"\
  1388.                                 and goldCount == 0))\
  1389.                         if cmRight and (map[monk.y][monk.x+i] == \"H\" or (map[monk.y][monk.x+i] == 'h' and goldCount == 0)) then\
  1390.                             monk.desX = monk.x+i\
  1391.                             break\
  1392.                         end\
  1393.                     end\
  1394.                 end\
  1395.             end\
  1396.         end\
  1397.         \
  1398.         if not (monk.trapped or monk.dead) then\
  1399.             --Has the monk decided on moving left or right? If so we try to move him\
  1400.             if monk.desX and not monk.falling then\
  1401.                 local mdir = monk.desX - monk.x\
  1402.                 local mdir = mdir / math.abs(mdir)\
  1403.                 if isLegalMove(monk.x,monk.y,monk.x+mdir,monk.y) then\
  1404.                     monk.x = monk.x + mdir\
  1405.                     updateMap(monk.x - mdir, monk.y)\
  1406.                     drawMonk(monk)\
  1407.                 else\
  1408.                     --This allows re-evaluations if they get stuck- not ideal but good enough\
  1409.                     monk.desX = nil\
  1410.                 end\
  1411.             end\
  1412.             --And of course if we've reached the player, there's no need to do\
  1413.             --anything. The monk has won.\
  1414.             if monk.x == plX and monk.y == plY and spawnTimer == -1 then\
  1415.                 spawnTimer = os.startTimer(2)\
  1416.             end\
  1417.         end\
  1418.     end\
  1419. end\
  1420. \
  1421. local function updateBlockTimer(tid)\
  1422.     local remAt = nil\
  1423.     for i,v in ipairs(blockTimers) do\
  1424.         if v.timer == tid then\
  1425.             if map[v.y][v.x] == 3 then\
  1426.                 for _,monk in pairs(monks) do\
  1427.                     if monk.x == v.x and monk.y == v.y-1 then\
  1428.                         map[v.y][v.x] = 0\
  1429.                         remAt = i\
  1430.                         break\
  1431.                     end\
  1432.                 end\
  1433.                 if not remAt then\
  1434.                     map[v.y][v.x] = 2\
  1435.                     v.timer = os.startTimer(blockIntv)\
  1436.                 end\
  1437.             elseif map[v.y][v.x] == 2 then\
  1438.                 map[v.y][v.x] = 1\
  1439.                 v.timer = os.startTimer(0.1)\
  1440.             elseif map[v.y][v.x] == 1 then\
  1441.                 map[v.y][v.x] = 0\
  1442.                 --If the player is caught in a block, he dies\
  1443.                 if v.y == plY and v.x == plX then\
  1444.                     spawnTimer = os.startTimer(2)\
  1445.                 end\
  1446.                 for _,monk in pairs(monks) do\
  1447.                     if monk.x == v.x and monk.y == v.y then\
  1448.                         monk.dead = os.startTimer(monkSpawnIntv)\
  1449.                         --Easiest way to get them out of the way rather than evaluation\
  1450.                         monk.x = -1\
  1451.                         monk.y = -1\
  1452.                         monk.trapped = nil\
  1453.                     end\
  1454.                 end\
  1455.                 remAt = i\
  1456.             end\
  1457.             updateMap(v.x,v.y)\
  1458.             break\
  1459.         end\
  1460.     end\
  1461.     if remAt then table.remove(blockTimers,remAt) end\
  1462. end\
  1463. \
  1464. local function shootBlock(x,y)\
  1465.     if y <= #map and map[y][x] == 0 and (map[y-1][x] == nil \
  1466.             or map[y-1][x] == 2 or (map[y-1][x] == 'h' and goldCount > 0)) then\
  1467.         map[y][x] = 3\
  1468.         table.insert(blockTimers, {x = x; y = y; timer = os.startTimer(0.1);} )\
  1469.         updateMap(x,y)\
  1470.     end\
  1471. end\
  1472. \
  1473. local function handleEvents()\
  1474.     local id,p1,p2,p3 = os.pullEvent()\
  1475.     \
  1476.     if id == \"key\" then\
  1477.         --Menu Handling\
  1478.         if p1 == keys.up then\
  1479.             if menIndex > 1 then menIndex = menIndex - 1 end\
  1480.         elseif p1 == keys.down then\
  1481.             if inLevelSelect then \
  1482.                 if menIndex < math.min(10, #levelList - (levelLot-1)*10) then \
  1483.                     menIndex = menIndex + 1\
  1484.                 end\
  1485.             elseif menIndex < #titleOptions then menIndex = menIndex + 1 end\
  1486.         elseif p1 == keys.left and inLevelSelect and levelLot > 1 then\
  1487.             levelLot = levelLot - 1\
  1488.             drawLevelList()\
  1489.         elseif p1 == keys.right and inLevelSelect and levelLot * 10 < #levelList then\
  1490.             levelLot = levelLot + 1\
  1491.             if menIndex > math.min(10, #levelList - (levelLot-1)*10) then \
  1492.                 menIndex = math.min(10, #levelList - (levelLot-1)*10)\
  1493.             end\
  1494.             drawLevelList()\
  1495.         end\
  1496.     \
  1497.         --Game Handling\
  1498.         if p1 == keys.a and moveTimer == -1 and spawnTimer == -1 then\
  1499.             movePlayer(plX-1,plY)\
  1500.             moveTimer = os.startTimer(moveIntv)\
  1501.         elseif p1 == keys.d and moveTimer == -1 and spawnTimer == -1 then\
  1502.             movePlayer(plX+1,plY)\
  1503.             moveTimer = os.startTimer(moveIntv)\
  1504.         elseif p1 == keys.w and moveTimer == -1 and spawnTimer == -1 then\
  1505.             movePlayer(plX,plY-1)\
  1506.             moveTimer = os.startTimer(moveIntv)\
  1507.         elseif p1 == keys.s and moveTimer == -1 and spawnTimer == -1 then\
  1508.             movePlayer(plX,plY+1)\
  1509.             moveTimer = os.startTimer(moveIntv)\
  1510.         elseif p1 == keys.q and shootTimer == -1 and not pfalling and spawnTimer == -1 then\
  1511.             shootBlock(plX-1,plY+1)\
  1512.             shootTimer = os.startTimer(moveIntv)\
  1513.         elseif p1 == keys.e and shootTimer == -1 and not pfalling and spawnTimer == -1 then\
  1514.             shootBlock(plX+1,plY+1)\
  1515.             shootTimer = os.startTimer(moveIntv)\
  1516.         elseif p1 == keys.space and started then\
  1517.             started = false\
  1518.         elseif p1 == keys.enter then\
  1519.             if not started then\
  1520.                 if inLevelSelect then\
  1521.                     currentLevel = menIndex + (levelLot - 1) * 10\
  1522.                     menSel = \"New Game\"\
  1523.                 else\
  1524.                     menSel = titleOptions[menIndex]\
  1525.                 end\
  1526.             else\
  1527.                 started = false\
  1528.                 menIndex = 1\
  1529.                 menSel = inGameMenu(inGameOptions)\
  1530.             end\
  1531.         end\
  1532.     elseif id == \"timer\" then\
  1533.         if p1 == shootTimer then shootTimer = -1\
  1534.         elseif p1 == spawnTimer then\
  1535.             started = false\
  1536.         elseif p1 == moveTimer then\
  1537.             if pfalling then\
  1538.                 movePlayer(plX,plY+1)\
  1539.                 moveTimer = os.startTimer(moveIntv)\
  1540.             else\
  1541.                 moveTimer = -1\
  1542.             end\
  1543.         elseif p1 == monkTimer then\
  1544.             updateMonks()\
  1545.             monkTimer = os.startTimer(moveIntv * 2)\
  1546.         elseif updateBlockTimer(p1) then\
  1547.         else\
  1548.             for _,monk in pairs(monks) do\
  1549.                 if p1 == monk.trapped then\
  1550.                     --You can stand on a monk to force them to be killed- so we check for that\
  1551.                     --along with being buried in tunnels, etc.\
  1552.                     local stillTrapped = map[monk.y-1][monk.x] == 0 or (plX == monk.x and plY == monk.y-1)\
  1553.                     for _,omonk in pairs(monks) do\
  1554.                         if omonk.x == monk.x and omonk.y == monk.y-1 then\
  1555.                             stillTrapped = true\
  1556.                             break\
  1557.                         end\
  1558.                     end\
  1559.                     --Perpetually trapped monks will try to excape much more quickly\
  1560.                     if stillTrapped then\
  1561.                         --This needs to be tweaked\
  1562.                         monk.trapped = os.startTimer(0.75)\
  1563.                     else\
  1564.                         --When free, they head in your general direction, re-evaluate later\
  1565.                         monk.y = monk.y - 1\
  1566.                         --This is necessary to stop 'double jumping'\
  1567.                         monk.desX = nil\
  1568.                         monk.trapped = nil\
  1569.                         monk.behaviour = \"none\"\
  1570.                         monk.justEscaped = true\
  1571.                         \
  1572.                         updateMap(monk.x, monk.y+1)\
  1573.                         drawMonk(monk)\
  1574.                     end\
  1575.                     break\
  1576.                 elseif p1 == monk.dead then\
  1577.                     --Same deal- you can camp spawn\
  1578.                     local stillDead = plX == monk.spawnX and plY == monk.spawnY\
  1579.                     for _,omonk in pairs(monks) do\
  1580.                         if omonk.x == monk.spawnX and omonk.y == monk.spawnY then\
  1581.                             stillDead = true\
  1582.                             break\
  1583.                         end\
  1584.                     end\
  1585.                     --They'll spawn the second you give them the chance\
  1586.                     if stillDead then\
  1587.                         monk.dead = os.startTimer(0.5)\
  1588.                     else\
  1589.                         monk.x = monk.spawnX\
  1590.                         monk.y = monk.spawnY\
  1591.                         monk.dead = nil\
  1592.                         monk.justSpawned = true\
  1593.                         monk.behaviour = \"none\"\
  1594.                         drawMonk(monk)\
  1595.                         break\
  1596.                     end\
  1597.                 end\
  1598.             end\
  1599.         end\
  1600.     end\
  1601. end\
  1602. \
  1603. --[[            Level Editor            ]]--\
  1604. \
  1605. local pallette = {  \
  1606.     { t = colours.black, b = colours.blue, s = \" \", n = \"Solid Ground\", v = 0 },\
  1607.     { t = colours.orange, b = colours.blue, s = \"V\", n = \"Trap Ground\", v = \"V\" },\
  1608.     { t = colours.grey, b = colours.grey, s = \" \", n = \"Cement Ground\", v = \"#\" },\
  1609.     { t = colours.brown, b = colours.black, s = \"H\", n = \"Ladder\", v = \"H\" },\
  1610.     { t = colours.brown, b = colours.black, s = \"-\", n = \"Monkey Bars\", v = \"-\" },\
  1611.     { t = colours.white, b = colours.black, s = \"&\", n = \"Player Spawn\", v = \"player\" },\
  1612.     { t = colours.red, b = colours.black, s = \"&\", n = \"Mad Monk\", v = \"&\" },\
  1613.     { t = colours.yellow, b = colours.black, s = \"$\", n = \"Gold\", v = \"$\" },\
  1614.     { t = colours.lightGrey, b = colours.black, s = \"H\", n = \"Hidden Ladder\", v = \"h\" },\
  1615.     { t = colours.lime, b = colours.black, s = \"@\", n = \"Exit Portal\", v = \"@\" },\
  1616.     { t = colours.red, b = colours.black, s = \"ERASE\", n = \"Eraser\", v = nil } }\
  1617. local brushType = 1\
  1618. \
  1619. local function getHexOf(colour)\
  1620.     if not colour or not tonumber(colour) then \
  1621.         return \" \" \
  1622.     end\
  1623.     local value = math.log(colour)/math.log(2)\
  1624.     if value > 9 then \
  1625.         value = hexnums[value] \
  1626.     end\
  1627.     return value\
  1628. end\
  1629. \
  1630. local function drawFooter()\
  1631.     for i=1,h-1 do\
  1632.         if i % 2 == 0 then term.setBackgroundColour(colours.grey)\
  1633.         else term.setBackgroundColour(colours.yellow) end\
  1634.         term.setCursorPos(1,i)\
  1635.         term.write(\" \")\
  1636.         term.setCursorPos(w,i)\
  1637.         term.write(\" \")\
  1638.     end\
  1639.     \
  1640.     term.setBackgroundColour(colours.black)\
  1641.     term.setTextColour(colours.blue)\
  1642.     term.setCursorPos(2,h)\
  1643.     term.clearLine()\
  1644.     term.write(\"Editor Mode: \")\
  1645.     term.setTextColour(colours.yellow)\
  1646.     term.write(levelEditName)\
  1647.     local msg = \"Tool: \"..pallette[brushType].n..\" \"..pallette[brushType].s\
  1648.     term.setCursorPos(w - #msg - 1, 19)\
  1649.     term.setTextColour(colours.blue)\
  1650.     term.write(\"Tool: \")\
  1651.     term.setTextColour(colours.yellow)\
  1652.     term.write(pallette[brushType].n..\" \")\
  1653.     term.setBackgroundColour(pallette[brushType].b)\
  1654.     term.setTextColour(pallette[brushType].t)\
  1655.     term.write(pallette[brushType].s)\
  1656. end\
  1657. \
  1658. local function drawPallette(xpos,ypos)\
  1659.     local xdim = 7\
  1660.     local ydim = 5\
  1661.     local left = xpos\
  1662.     local top  = ypos\
  1663.     if xpos + xdim > w then left = left + (w - xpos - xdim) end\
  1664.     if ypos + ydim > h then top = top + (h - ypos - ydim) end\
  1665.     \
  1666.     --There's no easy way to do this... so we draw it manually :(\
  1667.     for i=0,4 do\
  1668.         term.setCursorPos(left, top + i)\
  1669.         term.setBackgroundColour(colours.black)\
  1670.         term.setTextColour(colours.red)\
  1671.         if i == 0 or i == 4 then term.write(\"*-----*\")\
  1672.         else term.write(\"*     *\") end\
  1673.     end\
  1674.     \
  1675.     for i=1,#pallette-1 do\
  1676.         local ypl = 1\
  1677.         local xmv = i\
  1678.         if i > 5 then ypl = 2 xmv = i - 5 end\
  1679.         \
  1680.         term.setCursorPos(left + xmv, top+ypl)\
  1681.         term.setBackgroundColour(pallette[i].b)\
  1682.         term.setTextColour(pallette[i].t)\
  1683.         term.write(pallette[i].s)\
  1684.     end\
  1685.     \
  1686.     term.setCursorPos(left + 1, top + 3)\
  1687.     term.setBackgroundColour(colours.red)\
  1688.     term.setTextColour(colours.black)\
  1689.     term.write(\"ERASE\")\
  1690.     \
  1691.     local _,button,x,y = os.pullEvent(\"mouse_click\")\
  1692.     \
  1693.     if button == 1 then\
  1694.         if y == top + 1 and x > left and x < left + 6 then\
  1695.             brushType = x-left\
  1696.         elseif y == top + 2 and x > left and x < left + 6 then\
  1697.             brushType = x-left+5\
  1698.         elseif y == top + 3 and x > left and x < left + 6 then\
  1699.             brushType = 11\
  1700.         end\
  1701.     end\
  1702.     \
  1703.     for y = top,top+ydim do\
  1704.         for x = left,left+xdim do   \
  1705.             --Not sure why the -2 is necessary\
  1706.             if map[y+drawOffsetY] then updateMap(x-2,y+drawOffsetY) end\
  1707.         end\
  1708.     end\
  1709.     drawFooter()\
  1710.     return\
  1711. end\
  1712. \
  1713. local function saveCurrentMap(path)\
  1714.     local file = io.open(shell.resolve(\".\")..\"/levels/\"..path, \"w\")\
  1715.     if not file then return false end\
  1716.     \
  1717.     drawMap()\
  1718.     drawFooter()\
  1719.     local msg = \"Saving..\"\
  1720.     term.setCursorPos(w/2-#msg/2, 5)\
  1721.     term.setTextColour(colours.yellow)\
  1722.     term.setBackgroundColour(colours.blue)\
  1723.     term.write(msg)\
  1724.     term.setCursorPos(w/2-9, 6)\
  1725.     term.setBackgroundColour(colours.red)\
  1726.     term.write(string.rep(\" \", 18))\
  1727.     term.setCursorPos(w/2-9,6)\
  1728.     term.setBackgroundColour(colours.lime)\
  1729.     \
  1730.     for y=1,#map do\
  1731.         local xstr = \"\"\
  1732.         for x=1,49 do\
  1733.             --This again...\
  1734.                 if map[y][x] == 0 then xstr = xstr..getHexOf(colours.blue)\
  1735.             elseif map[y][x] == \"V\" then xstr = xstr..getHexOf(colours.orange)\
  1736.             elseif map[y][x] == \"#\" then xstr = xstr..getHexOf(colours.grey)\
  1737.             elseif map[y][x] == \"H\" then xstr = xstr..getHexOf(colours.brown)\
  1738.             elseif map[y][x] == \"h\" then xstr = xstr..getHexOf(colours.lightGrey)\
  1739.             elseif map[y][x] == \"-\" then xstr = xstr..getHexOf(colours.green)\
  1740.             elseif map[y][x] == \"&\" then xstr = xstr..getHexOf(colours.red)\
  1741.             elseif goldMap[y][x] == 1 then xstr = xstr..getHexOf(colours.yellow)\
  1742.             elseif plX == x and plY == y then xstr = xstr..getHexOf(colours.white)\
  1743.             elseif exX == x and exY == y then xstr = xstr..getHexOf(colours.lime)\
  1744.             else xstr = xstr..\" \"\
  1745.             end\
  1746.         end\
  1747.         file:write(xstr..\"\\n\")\
  1748.         term.write(\" \")\
  1749.         sleep(0)\
  1750.     end\
  1751.     file:close()\
  1752.     return true\
  1753. end\
  1754. \
  1755. local function runLevelEditor()\
  1756.     inLevelEditor = true\
  1757.     term.setBackgroundColour(colours.black)\
  1758.     term.clear()\
  1759.     if not fs.exists(shell.resolve(\".\")..\"/levels/\"..levelEditName) then\
  1760.         map = {}\
  1761.         goldMap = {}\
  1762.         monks = {}\
  1763.         for i=1,18 do map[i] = {} goldMap[i] = {} end\
  1764.         plX = 2\
  1765.         plY = 2\
  1766.         plspawnX = plX\
  1767.         plspawnY = plY\
  1768.         exX = 48\
  1769.         exY = 17\
  1770.     else\
  1771.         loadMap(\"/levels/\"..levelEditName)\
  1772.         for _,monk in pairs(monks) do\
  1773.             map[monk.y][monk.x] = \"&\"\
  1774.         end\
  1775.         monks = {}\
  1776.     end\
  1777.     \
  1778.     drawMap()\
  1779.     drawFooter()\
  1780.     \
  1781.     while inLevelEditor do\
  1782.         local id,button,x,y = os.pullEvent()\
  1783.         if id == \"mouse_click\" or id == \"mouse_drag\" then\
  1784.             if button == 2 then \
  1785.                 drawPallette(x,y)\
  1786.             elseif x > drawOffsetX and x <= 49 + drawOffsetX and y > drawOffsetY and y <= 18 + drawOffsetY then\
  1787.                 if pallette[brushType].v == \"player\" then\
  1788.                     local ox = plX\
  1789.                     local oy = plY\
  1790.                     if plX == exX and plY == exY then\
  1791.                         exX = ox\
  1792.                         exY = oy\
  1793.                     end\
  1794.                     plX = x - drawOffsetX\
  1795.                     plY = y - drawOffsetY\
  1796.                     map[plY][plX] = nil\
  1797.                     goldMap[plY][plX] = nil\
  1798.                     updateMap(ox,oy)\
  1799.                 elseif pallette[brushType].v == \"@\" then\
  1800.                     local ox = exX\
  1801.                     local oy = exY\
  1802.                     if plX == exX and plY == exY then\
  1803.                         plX = ox\
  1804.                         plY = oy\
  1805.                     end\
  1806.                     exX = x - drawOffsetX\
  1807.                     exY = y - drawOffsetY\
  1808.                     map[plY][plX] = nil\
  1809.                     goldMap[plY][plX] = nil\
  1810.                     updateMap(ox,oy)\
  1811.                 elseif pallette[brushType].v == \"$\" then\
  1812.                     goldMap[y-drawOffsetY][x-drawOffsetX] = 1\
  1813.                     map[y-drawOffsetY][x-drawOffsetX] = nil\
  1814.                 elseif pallette[brushType].v == nil then\
  1815.                     map[y-drawOffsetY][x-drawOffsetX] = nil\
  1816.                     goldMap[y-drawOffsetY][x-drawOffsetX] = nil\
  1817.                 else\
  1818.                     map[y-drawOffsetY][x-drawOffsetX] = pallette[brushType].v\
  1819.                     goldMap[y-drawOffsetY][x-drawOffsetX] = nil\
  1820.                     --term.setCursorPos(1,19)\
  1821.                     --print(\"At \"..(x-drawOffsetX)..\", \"..(y-drawOffsetY)..\" have placed \"..pallette[brushType].v)\
  1822.                 end\
  1823.                 updateMap(x-drawOffsetX, y-drawOffsetY)\
  1824.             end\
  1825.         elseif id == \"mouse_scroll\" then\
  1826.             brushType = brushType + button\
  1827.             if brushType == 0 then brushType = #pallette\
  1828.             elseif brushType > #pallette then brushType = 1 end\
  1829.             drawFooter()\
  1830.         elseif id == \"key\" and button == keys.enter then\
  1831.             menSel = inGameMenu(levelEditOptions)\
  1832.             if menSel == \"Save\" then\
  1833.                 saveCurrentMap(levelEditName)\
  1834.                 drawMap()\
  1835.                 drawFooter()\
  1836.             elseif menSel == \"Save and Exit\" then\
  1837.                 saveCurrentMap(levelEditName)\
  1838.                 menSel = \"none\"\
  1839.                 inLevelEditor = false\
  1840.             elseif menSel == \"Discard and Exit\" then\
  1841.                 menSel = \"none\"\
  1842.                 inLevelEditor = false\
  1843.             elseif menSel == \"Play Level\" then\
  1844.                 saveCurrentMap(levelEditName)\
  1845.                 inLevelEditor = false\
  1846.             end\
  1847.         end\
  1848.     end\
  1849. end\
  1850. \
  1851. \
  1852. local function runLevelSelect()\
  1853.     if not titleLoaded then\
  1854.         loadTitleScreen()\
  1855.         monkTimer = os.startTimer(moveIntv * 1.5)\
  1856.     else \
  1857.         drawMap()\
  1858.         drawEndgameMap()\
  1859.         term.setCursorPos(1,19)\
  1860.         term.setBackgroundColour(colours.blue)\
  1861.         term.clearLine()\
  1862.     end\
  1863.     drawLevelList()\
  1864.     \
  1865.     menSel = \"none\"\
  1866.     repeat\
  1867.         handleEvents()\
  1868.         \
  1869.         term.setBackgroundColour(colours.black)\
  1870.         term.setTextColour(colours.yellow)\
  1871.         for i=1,10 do\
  1872.             term.setCursorPos(16,3+i)\
  1873.             if i == menIndex then\
  1874.                 term.write(\">\")\
  1875.             else\
  1876.                 term.write(\" \")\
  1877.             end\
  1878.         end\
  1879.     until menSel ~= \"none\"\
  1880.     inLevelSelect = false\
  1881.     menSel = \"New Game\"\
  1882. end\
  1883. \
  1884. local function runTitle()\
  1885.     loadTitleScreen()\
  1886.     term.setCursorPos(15,3)\
  1887.     term.setTextColour(colours.red)\
  1888.     term.setBackgroundColour(colours.black)\
  1889.     term.write(\"Gold Runner\")\
  1890.     term.setCursorPos(16,4)\
  1891.     term.write(\"By Nitrogen Fingers\")\
  1892.     \
  1893.     term.setTextColour(colours.white)\
  1894.     for i=1,#titleOptions do\
  1895.         term.setCursorPos(19, 5 + (i*2))\
  1896.         term.write(titleOptions[i])\
  1897.     end\
  1898.       \
  1899.     term.setCursorPos(16, 7)\
  1900.     term.setTextColour(colours.yellow)\
  1901.     term.write(\"->\")\
  1902.     \
  1903.     menSel = \"none\"\
  1904.     monkTimer = os.startTimer(moveIntv * 1.5)\
  1905.     \
  1906.     repeat\
  1907.         handleEvents()\
  1908.         \
  1909.         term.setBackgroundColour(colours.black)\
  1910.         term.setTextColour(colours.yellow)\
  1911.         for i=1,#titleOptions do\
  1912.             term.setCursorPos(16, 5 + i*2)\
  1913.             if menIndex == i then term.write(\"->\")\
  1914.             else term.write(\"  \") end\
  1915.         end\
  1916.     until menSel ~= \"none\"\
  1917. end\
  1918. \
  1919. local function playLevel()\
  1920.     loadMap(shell.resolve(\".\")..\"/levels/\"..levelList[currentLevel])\
  1921.     running = true\
  1922.     while running do\
  1923.         drawMap()\
  1924.         drawHUD()\
  1925.         os.pullEvent(\"key\")\
  1926.         movePlayer(plX,plY,true)\
  1927.         \
  1928.         monkTimer = os.startTimer(moveIntv * 1.5)\
  1929.         moveTimer = os.startTimer(moveIntv)\
  1930.         shootTimer = -1\
  1931.         spawnTimer = -1\
  1932.         \
  1933.         started = true\
  1934.         while started do\
  1935.             handleEvents()\
  1936.         end\
  1937.         \
  1938.         if menSel == \"Quit\" or menSel == \"Back to Title\" or menSel == \"Edit Level\" then\
  1939.             running = false\
  1940.             return\
  1941.         end\
  1942.         menSel = \"none\"\
  1943.         \
  1944.         if nextLevel then\
  1945.             if currentLevel == #levelList then \
  1946.                 started = false\
  1947.                 running = false\
  1948.                 break\
  1949.             else\
  1950.                 currentLevel = currentLevel + 1\
  1951.                 playerLives = playerLives + 1\
  1952.                 resetMap()\
  1953.                 loadMap(shell.resolve(\".\")..\"/levels/\"..levelList[currentLevel])\
  1954.             end\
  1955.             nextLevel = false\
  1956.         else\
  1957.             playerLives = playerLives-1\
  1958.             if playerLives > 0 then resetMap()\
  1959.             else \
  1960.                 running = false \
  1961.             end\
  1962.         end\
  1963.     end\
  1964.     \
  1965.     if nextLevel then\
  1966.         local msg = \"All levels defeated, Gold Runner!\"\
  1967.         term.setBackgroundColour(colours.black)\
  1968.         term.setTextColour(colours.lime)\
  1969.         term.setCursorPos(25 - #msg/2, 2)\
  1970.         term.write(msg)\
  1971.     else\
  1972.         local msg = \"Game over!\"\
  1973.         term.setBackgroundColour(colours.black)\
  1974.         term.setTextColour(colours.red)\
  1975.         term.setCursorPos(25 - #msg/2, 2)\
  1976.         term.write(msg)\
  1977.     end\
  1978.     currentLevel = 1\
  1979.     sleep(2)\
  1980. end\
  1981. \
  1982. term.clear()\
  1983. if not fs.exists(shell.resolve(\".\")..\"/levels\") then\
  1984.     error(\"Level directory not present!\")\
  1985. end\
  1986. levelList = fs.list(shell.resolve(\".\")..\"/levels\")\
  1987. if #levelList == 0 then\
  1988.     error(\"Level directory is empty!\")\
  1989. end\
  1990. \
  1991. runTitle()\
  1992. menIndex = 1\
  1993. \
  1994. while menSel ~= \"Quit\" do\
  1995.     if menSel == \"Select Level\" then\
  1996.         inLevelSelect = true\
  1997.         runLevelSelect()\
  1998.     elseif menSel == \"New Game\" then\
  1999.         playerLives = 3\
  2000.         playerScore = 0\
  2001.         playLevel()\
  2002.     elseif menSel == \"Create Level\" then\
  2003.         --This is a bit lazy... well it's all been a bit lazy :P\
  2004.         drawMap()\
  2005.         term.setCursorPos(1,19)\
  2006.         term.setBackgroundColour(colours.blue)\
  2007.         term.clearLine()\
  2008.         \
  2009.         term.setCursorPos(16,10)\
  2010.         term.setBackgroundColour(colours.black)\
  2011.         term.setTextColour(colours.white)\
  2012.         term.write(\"Enter level name:\")\
  2013.         term.setTextColour(colours.lime)\
  2014.         term.setCursorPos(17,11)\
  2015.         term.setCursorBlink(true)\
  2016.         local levelName = \"\"\
  2017.         \
  2018.         local id,p1\
  2019.         repeat\
  2020.             id,p1 = os.pullEvent()\
  2021.             if id == \"key\" and p1 == keys.backspace then\
  2022.                 levelName = string.sub(levelName, 1, #levelName - 1)\
  2023.             elseif id == \"timer\" and p1 == monkTimer then \
  2024.                 updateMonks()\
  2025.                 monkTimer = os.startTimer(moveIntv * 2)\
  2026.             elseif id == \"char\" and #levelName < 14 then\
  2027.                 levelName = levelName..p1\
  2028.             end\
  2029.             term.setTextColour(colours.lime)\
  2030.             term.setCursorPos(17,11)\
  2031.             term.write(levelName..string.rep(\" \",14 - #levelName))\
  2032.             term.setCursorPos(17 + #levelName ,11)\
  2033.         until id == \"key\" and p1 == keys.enter and #levelName > 0\
  2034.         \
  2035.         term.setCursorBlink(false)\
  2036.         levelEditName = levelName\
  2037.         runLevelEditor()\
  2038.         \
  2039.         if menSel == \"Play Level\" then\
  2040.             currentLevel = nil\
  2041.             levelList = fs.list(shell.resolve(\".\")..\"/levels\")\
  2042.             for num,name in pairs(levelList) do \
  2043.                 if name == levelName then\
  2044.                     currentLevel = num\
  2045.                     break\
  2046.                 end\
  2047.             end\
  2048.             menSel = \"New Game\"\
  2049.         else\
  2050.             menSel = \"none\"\
  2051.         end\
  2052.     elseif menSel == \"Edit Level\" then\
  2053.         levelEditName = levelList[currentLevel]\
  2054.         runLevelEditor()\
  2055.         term.setBackgroundColour(colours.black)\
  2056.         term.clear()\
  2057.         \
  2058.         if menSel == \"Play Level\" then\
  2059.             menSel = \"New Game\"\
  2060.         else\
  2061.             menSel = \"none\"\
  2062.         end\
  2063.     elseif menSel == \"none\" or menSel == \"Back to Title\" then\
  2064.         runTitle()\
  2065.     end\
  2066.     menIndex = 1\
  2067. end\
  2068. \
  2069. shell.run(\"clear\")",
  2070.   [ "goldrunner/levels/classic_010" ] = "bbbbbbbbbb          4              5  bbbbbbbbbb\
  2071. bbbbbbbbbb        cbbbbbbb  4      8  bbbbbbbbbb\
  2072. bbbbbbbbbb    4   c      bbbbbb    8  bbbbbbbbbb\
  2073. bbbbbbbbbbbbbbbbbbbbc         4    8  bbbbbbbbbb\
  2074. bbbbbbbbbb          cbbbbbb8bbbbbcbb  bbbbbbbbbb\
  2075. bbbbbbbbbbe         c      8     c    bbbbbbbbbb\
  2076. bbbbbbbbbbbbbbbbbbbbc      8 e   c   4bbbbbbbbbb\
  2077. bbbbbbbbbbbbbbbbbbbbcbbbbbbb77   cbbbbbbbbbbbbbb\
  2078. bbbbbbbbbbbbbbbbbbbbc            c    bbbbbbbbbb\
  2079. bbbbbbbbbbbbbbbbbbbbc       4 dddc    bbbbbbbbbb\
  2080. bbbbbbbbbbbb      bbc       bb   c    bbbbbbbbbb\
  2081. bbbbbbbbbbbb  44  bbc     4      c    bbbbbbbbbb\
  2082. bbbbbbbbbbbbbbbbbbbbbcbbbbbbbc   c    bbbbbbbbbb\
  2083. bbbbbbbbbb           c       bbbbbbbbcbbbbbbbbbb\
  2084. bbbbbbbbbb    4    0 c               cbbbbbbbbbb\
  2085. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  2086. 7777777777777777777777777777777777777777777777777",
  2087.   [ "goldrunner/levels/classic_005" ] = "bbbbbbbbbb         5                  bbbbbbbbbb\
  2088. bbbbbbbbbb         8       4      e   bbbbbbbbbb\
  2089. bbbbbbbbbbbbb      8      bbbbcbbbbbbbbbbbbbbbbb\
  2090. bbbbbbbbbb  bb     8     bb   c       bbbbbbbbbb\
  2091. bbbbbbbbbb   bb    8    bb    c       bbbbbbbbbb\
  2092. bbbbbbbbbb4e bbb   8  4bbb    c   4   bbbbbbbbbb\
  2093. bbbbbbbbbbbbcbbbb  8  bbbbcbbbcbbbbbbbbbbbbbbbbb\
  2094. bbbbbbbbbb  c   bb 8 bb   c           bbbbbbbbbb\
  2095. bbbbbbbbbb  c4e  bbcbb    c     4     bbbbbbbbbb\
  2096. bbbbbbbbbbcbbbc    c     bcbbcbbb     bbbbbbbbbb\
  2097. bbbbbbbbbbc   c              c        bbbbbbbbbb\
  2098. bbbbbbbbbbc   c    4     e   c        bbbbbbbbbb\
  2099. bbbbbbbbbbc   cbbbbbbbcbbbbbbcbbbbbcbbbbbbbbbbbb\
  2100. bbbbbbbbbbc           c            c  bbbbbbbbbb\
  2101. bbbbbbbbbbc           c  0         c  bbbbbbbbbb\
  2102. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  2103. 7777777777777777777777777777777777777777777777777",
  2104.   [ "goldrunner/levels/02_coalmine" ] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  2105. b        0                                      b\
  2106. bbbb     bb                 dddd          cb    b\
  2107. b      bbbb           e  cbb      4 4     cb 44 b\
  2108. bbbbbbbbbbbbbbbbbbbbcbbbbbbb    bbbbbbbbbbbb7777b\
  2109. b    b dddddddd     c                           b\
  2110. b     b             c            cbb            b\
  2111. b 44 b              c          cbbbb    4 4 4   b\
  2112. bbbbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbb7b7bbbbb7bbb\
  2113. bbbbbb4 bbbbcb4  4  4bb4  4bbbbbbbbbbb7bbb7b7b77b\
  2114. b bb     bbbcbbbbbbbbbbbbbbbbb                  b\
  2115. b           c                         7777777777b\
  2116. b           c     dd    ddddddddddddcb7777777777b\
  2117. bbbbbbbbbbbbbbbbbb  cbbb            cbbbb    5  b\
  2118. bbbbbbbbbbbbbbbbbb cbbb            c7b    8bbbbbb\
  2119. b                 cbbb             c7b    8 4 4 b\
  2120. b  4 4 4 4 4  cb  cbb              c7b  cbbbbbbbb\
  2121. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb777777777777b",
  2122.   disktron = "local isOpen=false\
  2123. for k,v in pairs({\"right\",\"left\",\"top\",\"bottom\",\"front\",\"back\"}) do\
  2124.     if peripheral.getType(v)==\"modem\" then\
  2125.         rednet.open(v)\
  2126.         isOpen=true\
  2127.     end\
  2128. end\
  2129. if not isOpen then\
  2130.     error(\"no modem attached\")\
  2131. end\
  2132. local Mx,My=term.getSize()\
  2133. local Cx,Cy=math.floor(Mx/2),math.floor(My/2)\
  2134. function maingame()\
  2135.     local lang={\"Waiting for player\",{[0]=\"^\",\">\",\"v\",\"<\"},{{\"|\",\"/\",\"|\",\"\\\\\"},{\"/\",\"-\",\"\\\\\",\"-\"},{\"|\",\"\\\\\",\"|\",\"/\"},{\"\\\\\",\"-\",\"/\",\"-\"}},\"You died.\",\"You won.\"}\
  2136.     local board=setmetatable({},{__index=function(s,n) s[n]={} return s[n] end})\
  2137.     for l1=99,-99,-1 do\
  2138.         board[l1][-99]={\"-\",3}\
  2139.     end\
  2140.     for l1=99,-99,-1 do\
  2141.         board[l1][99]={\"|\",3}\
  2142.     end\
  2143.     for l1=99,-99,-1 do\
  2144.         board[-99][l1]={\"-\",3}\
  2145.     end\
  2146.     for l1=99,-99,-1 do\
  2147.         board[99][l1]={\"|\",3}\
  2148.     end\
  2149.     board[100][100]={\"/\",3}\
  2150.     board[100][-100]={\"\\\\\",3}\
  2151.     board[-100][100]={\"/\",3}\
  2152.     board[-100][-100]={\"\\\\\",3}\
  2153.     local modem\
  2154.     local initheader=\"TRON:\"\
  2155.     local pnid\
  2156.     local function send(...)\
  2157.         rednet.send(pnid,string.sub(textutils.serialize({...}),2,-2))\
  2158.     end\
  2159.     local function decode(dat)\
  2160.         return textutils.unserialize(\"{\"..dat..\"}\")\
  2161.     end\
  2162.     local col\
  2163.     term.setCursorPos(math.floor(Cx-(#lang[1])/2),Cy)\
  2164.     term.setTextColor(colors.orange)\
  2165.     term.setBackgroundColor(colors.black)\
  2166.     term.clear()\
  2167.     term.write(lang[1])\
  2168.     rednet.broadcast(initheader..\"pingcon\")\
  2169.     local p1,p2\
  2170.     while true do\
  2171.         local p={os.pullEvent()}\
  2172.         if p[1]==\"rednet_message\" and p[2]~=os.getComputerID() then\
  2173.             if p[3]==initheader..\"pingcon\" then\
  2174.                 rednet.send(p[2],initheader..\"pongcon\")\
  2175.                 pnid=p[2]\
  2176.                 col={colors.blue,colors.red}\
  2177.                 p1={pos={x=2,y=1},dir=0}\
  2178.                 p2={pos={x=1,y=1},dir=0}\
  2179.                 break\
  2180.             elseif p[3]==initheader..\"pongcon\" then\
  2181.                 pnid=p[2]\
  2182.                 col={colors.red,colors.blue}\
  2183.                 p1={pos={x=1,y=1},dir=0}\
  2184.                 p2={pos={x=2,y=1},dir=0}\
  2185.                 break\
  2186.             end\
  2187.         end\
  2188.     end\
  2189.     term.setBackgroundColor(colors.black)\
  2190.     term.clear()\
  2191.     local frs=0\
  2192.     local fps=0 -- frame counter (debugging)\
  2193.     local function render()\
  2194.         frs=frs+1\
  2195.         term.setTextColor(colors.gray)\
  2196.         for l1=1,My do\
  2197.             term.setCursorPos(1,l1)\
  2198.             local pre=p1.pos.x%3\
  2199.             if (l1+p1.pos.y)%3==0 then\
  2200.                 if pre==1 then\
  2201.                     pre=\"--\"\
  2202.                 elseif pre==2 then\
  2203.                     pre=\"-\"\
  2204.                 else\
  2205.                     pre=\"\"\
  2206.                 end\
  2207.                 term.write(pre..string.rep(\"+--\",math.ceil(Mx/2)))\
  2208.             else\
  2209.                 if pre==1 then\
  2210.                     pre=\"  \"\
  2211.                 elseif pre==2 then\
  2212.                     pre=\" \"\
  2213.                 else\
  2214.                     pre=\"\"\
  2215.                 end\
  2216.                 term.write(pre..string.rep(\"|  \",math.ceil(Mx/2)))\
  2217.             end\
  2218.         end\
  2219.         term.setTextColor(colors.blue)\
  2220.         local num=0\
  2221.         for k,v in pairs(board) do\
  2222.             for l,y in pairs(v) do\
  2223.                 if (k-p1.pos.x)+Cx<=Mx and (k-p1.pos.x)+Cx>=1 and (l-p1.pos.y)+Cy<=My and (l-p1.pos.y)+Cy>=1 then\
  2224.                     term.setTextColor(col[y[2]] or y[2])\
  2225.                     term.setCursorPos((k-p1.pos.x)+Cx,(l-p1.pos.y)+Cy)\
  2226.                     term.write(y[1])\
  2227.                     num=num+1\
  2228.                 end\
  2229.             end     \
  2230.         end\
  2231.         term.setCursorPos(1,1)\
  2232.         if col[1]==colors.blue then\
  2233.             term.setTextColor(colors.blue)\
  2234.             term.write(\"BLUE\")\
  2235.         else\
  2236.             term.setTextColor(colors.red)\
  2237.             term.write(\"RED\")\
  2238.         end\
  2239.     end\
  2240.     local odr={[p1]=p1.dir,[p2]=p2.dir}\
  2241.     local function processmove(u)\
  2242.         local ccol\
  2243.         if u==p1 then\
  2244.             ccol=col[1]\
  2245.         else\
  2246.             ccol=col[2]\
  2247.         end\
  2248.         term.setTextColor(ccol)\
  2249.         if u==p1 and board[u.pos.x][u.pos.y] then\
  2250.             send(\"DIE\")\
  2251.             term.setCursorPos(Cx,Cy)\
  2252.             term.write(\"x\")\
  2253.             sleep(2)\
  2254.             term.setCursorPos(Cx-math.floor(#lang[4]/2),Cy)\
  2255.             term.setTextColor(colors.orange)\
  2256.             term.clear()\
  2257.             term.write(lang[4])\
  2258.             sleep(5)\
  2259.             term.setTextColor(colors.white)\
  2260.             term.setBackgroundColor(colors.black)\
  2261.             term.setCursorPos(1,1)\
  2262.             term.clear()\
  2263.             error(\"\",0)\
  2264.         end\
  2265.         if odr[u]~=u.dir then\
  2266.             board[u.pos.x][u.pos.y]={lang[3][odr[u]+1][u.dir+1],ccol}\
  2267.         end\
  2268.         if not board[u.pos.x][u.pos.y] then\
  2269.             if u.dir%2==0 then\
  2270.                 board[u.pos.x][u.pos.y]={\"|\",ccol}\
  2271.             else\
  2272.                 board[u.pos.x][u.pos.y]={\"-\",ccol}\
  2273.             end\
  2274.         end\
  2275.         local chr=board[u.pos.x][u.pos.y][1]\
  2276.         local shr={x=u.pos.x,y=u.pos.y}\
  2277.         if u.dir==0 then\
  2278.             u.pos.y=u.pos.y-1\
  2279.         elseif u.dir==1 then\
  2280.             u.pos.x=u.pos.x+1\
  2281.         elseif u.dir==2 then\
  2282.             u.pos.y=u.pos.y+1\
  2283.         else\
  2284.             u.pos.x=u.pos.x-1\
  2285.         end\
  2286.         odr[u]=u.dir\
  2287.         return chr,shr\
  2288.     end\
  2289.     local function renderchar(u)\
  2290.         local ccol\
  2291.         if u==p1 then\
  2292.             ccol=col[1]\
  2293.             term.setCursorPos(Cx,Cy)\
  2294.         else\
  2295.             ccol=col[2]\
  2296.             term.setCursorPos((p2.pos.x-p1.pos.x)+Cx,(p2.pos.y-p1.pos.y)+Cy)\
  2297.         end\
  2298.         term.setTextColor(ccol)\
  2299.         term.write(lang[2][u.dir])\
  2300.     end\
  2301.     function processturn(p,u)\
  2302.         local dirs={[keys.up]=0,[keys.right]=1,[keys.down]=2,[keys.left]=3}\
  2303.         if (odr[u]+2)%4~=dirs[p] then\
  2304.             u.dir=dirs[p]\
  2305.             renderchar(u)\
  2306.             if u==p1 then\
  2307.                 send(\"ROT\",u.dir)\
  2308.             end\
  2309.         end\
  2310.     end\
  2311.     render()\
  2312.     local move=os.startTimer(0.1)\
  2313.     local fct=os.startTimer(1)\
  2314.     while true do\
  2315.         local p={os.pullEvent()}\
  2316.         if p[1]==\"key\" then\
  2317.             if p[2]==keys.up or p[2]==keys.right or p[2]==keys.down or p[2]==keys.left then\
  2318.                 processturn(p[2],p1)\
  2319.             end\
  2320.         elseif p[1]==\"timer\" then\
  2321.             if p[2]==move then\
  2322.                 local ret,ret2=processmove(p1)\
  2323.                 move=os.startTimer(0.1)\
  2324.                 send(\"MOVE\",ret2,ret)\
  2325.             elseif p[2]==fct then\
  2326.                 fps=frs\
  2327.                 frs=0\
  2328.                 fct=os.startTimer(1)\
  2329.             end\
  2330.         elseif p[1]==\"rednet_message\" and p[2]==pnid then\
  2331.             local dat=decode(p[3])\
  2332.             if dat[1]==\"ROT\" then\
  2333.                 p2.dir=dat[2]\
  2334.                 renderchar(p2)\
  2335.             elseif dat[1]==\"DIE\" then\
  2336.                 p1.pos=p2.pos\
  2337.                 render()\
  2338.                 term.setTextColor(col[2])\
  2339.                 term.setCursorPos(Cx,Cy)\
  2340.                 term.write(\"x\")\
  2341.                 sleep(2)\
  2342.                 term.setCursorPos(Cx-math.floor(#lang[5]/2),Cy)\
  2343.                 term.setTextColor(colors.orange)\
  2344.                 term.clear()\
  2345.                 term.write(lang[5])\
  2346.                 sleep(5)\
  2347.                 term.setTextColor(colors.white)\
  2348.                 term.setBackgroundColor(colors.black)\
  2349.                 term.setCursorPos(1,1)\
  2350.                 term.clear()\
  2351.                 return\
  2352.             elseif dat[1]==\"MOVE\" then\
  2353.                 p2.pos=dat[2]\
  2354.                 board[p2.pos.x][p2.pos.y]={dat[3],col[2]}\
  2355.                 render()\
  2356.                 renderchar(p1)\
  2357.                 renderchar(p2)\
  2358.             end\
  2359.         end\
  2360.     end\
  2361. end\
  2362. local selected=1\
  2363. function rmain()\
  2364.     term.setBackgroundColor(colors.black)\
  2365.     term.clear()\
  2366.     term.setCursorPos(1,1)\
  2367.     term.setTextColor(colors.blue)\
  2368.     local txt=\"  _  _______________     ________    __       _\\n/ \\\\/  _____________\\\\   /  ____  \\\\  |  \\\\     / |\\n\\\\_/| /    / \\\\       | /  /    \\\\  \\\\ |   \\\\ __/  |\\n   | |    | |\\\\  ___/ |  |      |  ||    \\\\     |\\n   | |    | | \\\\ \\\\    |  |      |  ||   __\\\\    |\\n   | |    | |  \\\\ \\\\    \\\\  \\\\____/  / |  /   \\\\   |\\n   \\\\_/    \\\\_/   \\\\_/    \\\\________/  |_/     \\\\__|\"\
  2369.     local cnt=1\
  2370.     local cnt2=Cx-23\
  2371.     for char in string.gmatch(txt,\".\") do\
  2372.         if char~=\" \" and char~=\"\\n\" then\
  2373.             term.setCursorPos(cnt2,cnt)\
  2374.             term.write(char)\
  2375.         elseif char==\"\\n\" then\
  2376.             cnt=cnt+1\
  2377.             cnt2=Cx-23\
  2378.         end\
  2379.         cnt2=cnt2+1\
  2380.     end\
  2381.     local selections={\"Multiplayer\",\"Exit\"}\
  2382.     selected=((selected-1)%(#selections))+1\
  2383.     for k,v in pairs(selections) do\
  2384.         if k==selected then\
  2385.             term.setTextColor(colors.blue)\
  2386.             term.setCursorPos(Cx-(math.floor(#v/2)+1),k+10)\
  2387.             term.write(\">\"..v..\"<\")\
  2388.             term.setTextColor(colors.lightBlue)\
  2389.             term.setCursorPos(Cx-math.floor(#v/2),k+10)\
  2390.             term.write(v)\
  2391.         else\
  2392.             term.setTextColor(colors.lightBlue)\
  2393.             term.setCursorPos(Cx-math.floor(#v/2),k+10)\
  2394.             term.write(v)\
  2395.         end\
  2396.     end\
  2397. end\
  2398. rmain()\
  2399. while true do\
  2400.     p={os.pullEvent()}\
  2401.     if p[1]==\"key\" then\
  2402.         if p[2]==keys.up then\
  2403.             selected=selected-1\
  2404.             rmain()\
  2405.         elseif p[2]==keys.down then\
  2406.             selected=selected+1\
  2407.             rmain()\
  2408.         elseif p[2]==keys.enter then\
  2409.             if selected==1 then\
  2410.                 a,b=pcall(maingame)\
  2411.                 if not a and b~=\"\" then\
  2412.                     error(b,0)\
  2413.                 end\
  2414.                 rmain()\
  2415.             else\
  2416.             break\
  2417.             end\
  2418.         end\
  2419.     end\
  2420. end\
  2421. term.setCursorPos(1,1)\
  2422. term.clear()",
  2423.   [ "goldrunner/levels/classic_017" ] = "bbbbbbbbbb5                          8bbbbbbbbbb\
  2424. bbbbbbbbbb8                          8bbbbbbbbbb\
  2425. bbbbbbbbbb8         e                8bbbbbbbbbb\
  2426. bbbbbbbbbbcbbb1bbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbb\
  2427. bbbbbbbbbbcbbb1bbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbb\
  2428. bbbbbbbbbbc   4   bbddddddddbb       cbbbbbbbbbb\
  2429. bbbbbbbbbbc       4bc    e 4bb    e  cbbbbbbbbbb\
  2430. bbbbbbbbbbc  bbb  bbc bbbbbbbb  bbbbbcbbbbbbbbbb\
  2431. bbbbbbbbbbc  b4b  bbc       bb  bb4bbcbbbbbbbbbb\
  2432. bbbbbbbbbbc   0   bbc       bb  bbbbbcbbbbbbbbbb\
  2433. bbbbbbbbbbc  bbb  bbbbbbbbccbb  bb4bbcbbbbbbbbbb\
  2434. bbbbbbbbbbc  bbb  bbbbbbbbccbb  bbbbbcbbbbbbbbbb\
  2435. bbbbbbbbbbc  bbb  bb      c bb       cbbbbbbbbbb\
  2436. bbbbbbbbbbc  bbb  bb     4c bb    4  cbbbbbbbbbb\
  2437. bbbbbbbbbbbbbbbbbbbbcbbbbbbbbbcbbbbbbbbbbbbbbbbb\
  2438. bbbbbbbbbbbbbbbbb  4cbbbbbb 4 cbbbbbbbbbbbbbbbbb\
  2439. 7777777777777777777777777777777777777777777777777",
  2440.   [ "redcast/files/test" ] = "gs;7td4g",
  2441.   [ "goldrunner/levels/06_flowers" ] = " ddddddd                                         \
  2442. c       bbbbcddddddd        dddc    d 4ed   dddd \
  2443. c                   bbe44ebb   c 4 c bbb c 4    c\
  2444. c             4777  7b7777b7   bbbb       bbbb  c\
  2445. c             bb                                c\
  2446. c           4                     dd 4    4    4c\
  2447. c   4 e    bb     dd 4  4ddd        bb    bb   bc\
  2448. c   bbb             bb  b   c 4  0  bb          c\
  2449. c              4            c bb     4   4      c\
  2450. cb      4      bbb          c           bb      c\
  2451. cbb     bb     dddd   d 4d  c    4              c\
  2452. cbbbb              bbc bb   c         4   cd 5 dc\
  2453. c     4    4  4      c    4 c       bbb   c     c\
  2454. c    bb    4 bb      c    bb    4         c 444 c\
  2455. c 4        4      4 4c          bb    cbbbc 444 c\
  2456. c bbb             cbbc                c     444 c\
  2457. c                 c                   c         c\
  2458. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  2459.   [ "redcast/files/startgui" ] = "--RedCast GUI By Gonow32 and datcoder1208\
  2460. --Clock coded by The_Nightmare\
  2461. \
  2462. if not fs.exists(\"games\") then\
  2463.  fs.makeDir(\"games\")\
  2464. end\
  2465. \
  2466. os.loadAPI(\"CubeAPI\")\
  2467. local menu = 0\
  2468. local w,h = term.getSize()\
  2469. local config = dofile(\"devconfig\")\
  2470. local lang\
  2471. if fs.exists(\"lang/\"..config.lang) then\
  2472.  lang = dofile(\"lang/\"..config.lang)\
  2473. else\
  2474.  lang = dofile(\"lang/en\")\
  2475. end\
  2476. local gameList = fs.list(\"games\")\
  2477. local bef = os.clock()\
  2478. local stream = http.get(\"http://5.230.233.77/time.php\")\
  2479. local time = textutils.unserialize(stream.readAll())\
  2480. stream.close()\
  2481. local iHours = time[4] - 1 + config.gmt\
  2482. local iMinutes = time[5]\
  2483. local iSeconds = time[6]\
  2484. while iHours < 0 do\
  2485.  iHours = iHours + 24\
  2486. end\
  2487. while iHours > 24 do\
  2488.  iHours = iHours - 24\
  2489. end\
  2490. --if config.bDevMode == true then\
  2491.  --error()\
  2492. --end\
  2493. \
  2494. if term.isColor() == false then\
  2495.  print(lang.gui.advancedonly)\
  2496.  return\
  2497. end\
  2498. \
  2499. function drawTaskbar()\
  2500.  term.setCursorPos(1,h)\
  2501.  if config.bTaskbar == true then\
  2502.    paintutils.drawLine(1, h, w, h, config.nTaskbarBack)\
  2503.  end\
  2504.  term.setCursorPos(1,h)\
  2505.  term.setBackgroundColour(config.nStartBack)\
  2506.  term.setTextColour(config.nStartText)\
  2507.  term.write(\"RedCast\")\
  2508.  term.setBackgroundColour(config.nMenuColour)\
  2509.  term.setTextColour(config.nMenuText)\
  2510.  --term.setTextColour(colours.white)\
  2511.  term.setCursorPos(1,1)\
  2512. end\
  2513. \
  2514. --error(\"I reached here!\")\
  2515. \
  2516. function drawDesktop()\
  2517.  term.current().setVisible(false)\
  2518.  term.setBackgroundColour(config.nBackColour)\
  2519.  term.clear()\
  2520.  term.setCursorPos(1,1)\
  2521.  --error(\"I reached here\")\
  2522.  if fs.exists(config.sBackground) then\
  2523.    image = paintutils.loadImage(config.sBackground)\
  2524.    paintutils.drawImage(image, 1, 1)\
  2525.  end\
  2526.  if config.bBuildString == true then\
  2527.    term.setCursorPos(1,1)\
  2528.    term.setBackgroundColour(config.nBackColour)\
  2529.    term.setTextColour(config.nTextColour)\
  2530.    print(config.sBuildString)\
  2531.  end\
  2532.  if config.bFeedback == true then\
  2533.    term.setCursorPos((w-#config.sComments)+1, 1)\
  2534.    print(config.sComments)\
  2535.  end\
  2536.  drawTaskbar()\
  2537.  term.current().setVisible(true)\
  2538. end\
  2539. \
  2540. local maxle = -1\
  2541. for i,v in pairs(lang.gui.menu) do\
  2542.  if #v > maxle then maxle = #v end\
  2543. end\
  2544. maxle = maxle + 1\
  2545. function fill(str)\
  2546.  local le = #str\
  2547.  local left = maxle - le\
  2548.  if left <= 0 then\
  2549.    return\
  2550.  else\
  2551.    for i = 1,left do\
  2552.      write(\" \")\
  2553.    end\
  2554.  end\
  2555. end\
  2556. \
  2557. function drawStart()\
  2558.  term.setCursorPos(1,h-1)\
  2559.  write(\" \")\
  2560.  fill(\"\")\
  2561.  term.setCursorPos(1,h-2)\
  2562.  term.write(\" \"..lang.gui.menu.restart)\
  2563.  fill(lang.gui.menu.restart)\
  2564.  term.setCursorPos(1,h-3)\
  2565.  term.write(\" \"..lang.gui.menu.shutdown)\
  2566.  fill(lang.gui.menu.shutdown)\
  2567.  term.setCursorPos(1,h-4)\
  2568.  term.write(\" \"..lang.gui.menu.chatmanager)\
  2569.  fill(lang.gui.menu.chatmanager)\
  2570.  term.setCursorPos(1,h-5)\
  2571.  term.write(\" \"..lang.gui.menu.paint)\
  2572.  fill(lang.gui.menu.paint)\
  2573.  term.setCursorPos(1,h-6)\
  2574.  term.write(\" \"..lang.gui.menu.redspace)\
  2575.  fill(lang.gui.menu.redspace)\
  2576.  term.setCursorPos(1,h-7)\
  2577.  term.write(\" \"..lang.gui.menu.floppy)\
  2578.  fill(lang.gui.menu.floppy)\
  2579.  term.setCursorPos(1,h-8)\
  2580.  term.write(\" \"..lang.gui.menu.credits)\
  2581.  fill(lang.gui.menu.credits)\
  2582.  term.setCursorPos(1,h-9)\
  2583.  term.write(\" Games\")\
  2584.  fill(\"Games\")\
  2585.  term.setCursorPos(1,h-10)\
  2586.  write(\" \")\
  2587.  fill(\"\")\
  2588. end\
  2589. \
  2590. drawDesktop()\
  2591. \
  2592. --error(\"I reached here!\")\
  2593. \
  2594. function updateClock()\
  2595.  term.setBackgroundColor(config.nTaskbarBack)\
  2596.  term.setTextColour(config.nTaskbarText)\
  2597.  time = string.format(\"%2i:%2i:%2i\",iHours,iMinutes,iSeconds):gsub(\" \",\"0\")\
  2598.  term.setCursorPos(w - #time, h)\
  2599.  write(time)\
  2600.  iSeconds = iSeconds + 1\
  2601.  if iSeconds == 60 then\
  2602.    iSeconds = 0\
  2603.    iMinutes = iMinutes + 1\
  2604.  end\
  2605.  if iMinutes == 60 then\
  2606.    iMinutes = 0\
  2607.    iHours = iHours + 1\
  2608.  end\
  2609.  if iHours == 24 then\
  2610.    iHours = 0\
  2611.  end\
  2612. end\
  2613. local up = os.startTimer(0)\
  2614. while true do\
  2615.  xComments = (w-#config.sComments)+1\
  2616.  local event, button, x, y = os.pullEvent()\
  2617.  if event == \"mouse_click\" then\
  2618.    if x >= 1 and x <= 7 and y == h and menu == 0 then\
  2619.      drawDesktop()\
  2620.      drawStart()\
  2621.      menu = 1\
  2622.    elseif x >= xComments and x <= w and y == 1 and config.bFeedback == true then\
  2623.      term.clear()\
  2624.      term.setCursorPos(1,2)\
  2625.      local e,user,topic,feedback = textutils.urlEncode\
  2626.      term.write(\"Username: \")\
  2627.      user = e(read())\
  2628.      term.write(\"Topic: \")\
  2629.      topic = e(read())\
  2630.      term.write(\"Feedback: \")\
  2631.      feedback = e(read())\
  2632.      print()\
  2633.      write(\"Submitting...\")\
  2634.      local re = http.get(\"http://redcast.site11.com/feedback.php?username=\"..user..\"&topic=\"..topic..\"&content=\"..feedback)\
  2635.      print(re.readAll())\
  2636.      sleep(2)\
  2637.      drawDesktop()\
  2638.      menu = 0\
  2639.    elseif x >= 1 and x <= maxle and y == h - 9 and menu == 1 then\
  2640.      term.setBackgroundColour(colours.black)\
  2641.      term.setTextColour(colours.white)\
  2642.      shell.run(\"gamelib\")\
  2643.      --sleep(3)\
  2644.      drawDesktop()\
  2645.      menu = 1\
  2646.    elseif x >= 1 and x <= maxle and y == h - 3 and menu == 1 then\
  2647.      os.shutdown()\
  2648.    elseif x >= 1 and x <= maxle and y == h - 2 and menu == 1 then\
  2649.      os.reboot()\
  2650.    elseif x >= 1 and x <= maxle and y == h - 4 and menu == 1 then\
  2651.      shell.run(\"chatlib\")\
  2652.      drawDesktop()\
  2653.      menu = 0\
  2654.    elseif x >= 1 and x <= maxle and y == h - 5 and menu == 1 then\
  2655.      term.setBackgroundColour(colours.black)\
  2656.      term.setTextColour(colours.white)\
  2657.      term.clear()\
  2658.      term.setCursorPos(2,2)\
  2659.      term.write(lang.gui.paint.open)\
  2660.      filename1 = read()\
  2661.      shell.run(\"paint \"..filename1)\
  2662.      drawDesktop()\
  2663.      menu = 0\
  2664.    elseif x >= 1 and x <= maxle and y == h - 6 and menu == 1 then\
  2665.      shell.run(\"redspace2\", side)\
  2666.      drawDesktop()\
  2667.      menu = 0\
  2668.    elseif x >= 1 and x <= maxle and y == h-7 and menu == 1 then\
  2669.      --Init FloppyLoader\
  2670.      shell.run(\"FloppyLoader\")\
  2671.      drawDesktop()\
  2672.      menu = 0\
  2673.    elseif x >= 1 and x <= maxle and y == h-8 and menu == 1 then\
  2674.      shell.run(\"credplay\")\
  2675.      drawDesktop()\
  2676.      menu = 0\
  2677.    elseif menu == 1 then\
  2678.      drawDesktop()\
  2679.      menu = 0\
  2680.    end\
  2681.  elseif event == \"timer\" and button == up then\
  2682.    updateClock()\
  2683.    up = os.startTimer(1)\
  2684.  end\
  2685. end",
  2686.   [ "bankvault/levels/Boxxle2.txt" ] = "; Boxxle 2\
  2687. \
  2688. ; Copyright: Thinking Rabbit\
  2689. ; E-Mail: \
  2690. ; Web Site: \
  2691. ;\
  2692. ; Levels from the Game Boy.\
  2693. \
  2694. #####\
  2695. #   #####\
  2696. # $ #   #\
  2697. #   #$# #\
  2698. ###$    #\
  2699. #   ####\
  2700. # @...#\
  2701. #######\
  2702. ; #1\
  2703. \
  2704.  ####\
  2705.  #  #\
  2706. ### $####\
  2707. #@$.. $ #\
  2708. #  .*   #\
  2709. ###  ####\
  2710.  #  #\
  2711.  ####\
  2712. ; #2\
  2713. \
  2714. #######\
  2715. #  . ##\
  2716. # $ $ #\
  2717. #. * .#\
  2718. # $ $ #\
  2719. ## . @#\
  2720. #######\
  2721. ; #3\
  2722. \
  2723. #########\
  2724. #      @#\
  2725. # $.$.$ #\
  2726. # .$.$. #\
  2727. # $.*.$ #\
  2728. # .$.$. #\
  2729. # $.$.$ #\
  2730. #       #\
  2731. #########\
  2732. ; #4\
  2733. \
  2734. #########\
  2735. #   @   #\
  2736. #$$$$$$$#\
  2737. #...#...#\
  2738. #.......#\
  2739. #$$$ $$$#\
  2740. #       #\
  2741. #########\
  2742. ; #5\
  2743. \
  2744. ##########\
  2745. #    $  .#\
  2746. #  $##$# #\
  2747. #   $    #\
  2748. ### ## ###\
  2749. #  $#  ##\
  2750. #.*.  $@#\
  2751. #...##  #\
  2752. #########\
  2753. ; #6\
  2754. \
  2755. #######\
  2756. #  .  #\
  2757. # $*$.#\
  2758. #  .. #\
  2759. #$$*$$#\
  2760. # ..  #\
  2761. #.$*$ #\
  2762. #  . @#\
  2763. #######\
  2764. ; #7\
  2765. \
  2766. ###########\
  2767. #  $  *.* #\
  2768. #  $  *.* #\
  2769. #  $  *.*@#\
  2770. #  $  *.* #\
  2771. ## $  *.* #\
  2772. ##########\
  2773. ; #8\
  2774. \
  2775.   ###########\
  2776.  ##     #  .#\
  2777.  #  $#$ #...#\
  2778. ###  $  $#  .#\
  2779. #  $$$   $ @.#\
  2780. # #  $ ###  .#\
  2781. #  $ $ # #...#\
  2782. #    ### #  .#\
  2783. ######   #####\
  2784. ; #9\
  2785. \
  2786. #### #####\
  2787. #  ### @ ###\
  2788. #..     $  #\
  2789. #..# # $ $ #\
  2790. #..#  ## ######\
  2791. #..   ## $ $  #\
  2792. #..#  ## $ $# #\
  2793. #######   $   #\
  2794.      #  $ $# #\
  2795.      # # # # #\
  2796.      #       #\
  2797.      #########\
  2798. ; #10\
  2799. \
  2800. #########\
  2801. #  .#   #\
  2802. #  $ $*.#\
  2803. # $## # #\
  2804. #   #   #\
  2805. # * #  ##\
  2806. ##  .@##\
  2807. ######\
  2808. ; #11\
  2809. \
  2810.  ####\
  2811.  #. # ###\
  2812. ###$ ###.#\
  2813. #  .$.   #\
  2814. #   ##$$ #\
  2815. # $$.#@  #\
  2816. #  $.#####\
  2817. ###   .#\
  2818.  ######\
  2819. ; #12\
  2820. \
  2821. ########\
  2822. #......#\
  2823. #......#\
  2824. #......#\
  2825. #      #\
  2826. #      #\
  2827. #### ##########\
  2828. ##  $    $ $ $ #\
  2829. #    $ #$#   # #\
  2830. #@#$ $ $  ##   #\
  2831. ### $# #  #### #\
  2832.  #  $ $  #    #\
  2833.  # $# $ #  $  #\
  2834.  #    $   $ $ #\
  2835.  #  ###########\
  2836.  ####\
  2837. ; #13\
  2838. \
  2839.    #######\
  2840.    #     ##\
  2841.    #  $$  #####\
  2842.   ### #  $#...#\
  2843. ### $ #  $ ...#\
  2844. #     ## $#...#\
  2845. # $ #$    #...#\
  2846. # #  $ # $ ...#\
  2847. #  $ $##$  #  #\
  2848. ## ##$ #@ ######\
  2849. # $    ####\
  2850. #   #  #\
  2851. ########\
  2852. ; #14\
  2853. \
  2854.   ###########\
  2855.   #   #     #\
  2856. ####   # $ $ #\
  2857. #  $  $   #$ #\
  2858. #   $  # $$  #\
  2859. # #  $$##  # #\
  2860. # $$    ##   #\
  2861. #@$  $ $   ###\
  2862. ## ####$##$#\
  2863. #  #...... ##\
  2864. #   .....#  #\
  2865. ####......  #\
  2866.   ##########\
  2867. ; #15\
  2868. \
  2869. #####\
  2870. #...##########\
  2871. #....$ $     #\
  2872. #..*. $   #  #\
  2873. #.*..### ## ####\
  2874. #....# $  #    #\
  2875. ###### #$ #$#$ #\
  2876.  #@$  $  # $  #\
  2877.  ##      #    #\
  2878.   ########$ # #\
  2879.   #     $   $ #\
  2880.   # # # # $## #\
  2881.   #   $   $ $ #\
  2882.   ########    #\
  2883.          ######\
  2884. ; #16\
  2885. \
  2886.    ######\
  2887.  ###    ####\
  2888.  # $ $ $   ##\
  2889. ###    $ ##  #\
  2890. # $ # ##$  $ #\
  2891. #   #$   $   #\
  2892. #  $   $  $$ #\
  2893. # $@## ### ###\
  2894. #   #  #. ...#\
  2895. #####   .....#\
  2896.    ####.....#\
  2897.       #######\
  2898. ; #17\
  2899. \
  2900.       #####\
  2901. ########   #\
  2902. #.....# $# #\
  2903. #.....   # #\
  2904. #...  # $# ###\
  2905. ##### #  #   #\
  2906.    #   $#$# #\
  2907.    ###$ $ # ##\
  2908.      #   $@$ #\
  2909.      #   # $ #\
  2910.      #$ $$$  #\
  2911.      #       #\
  2912.      #########\
  2913. ; #18\
  2914. \
  2915. ##########\
  2916. ##  #     #\
  2917. #     $...#\
  2918. # # @ #...#\
  2919. #    #....#\
  2920. # $#$$...####\
  2921. #    ###$   #\
  2922. ##  #    $$$###\
  2923. #$ $ ##   $  #\
  2924. #  #$#  #    #\
  2925. ###  $  ######\
  2926.   #   # #\
  2927.   ###   #\
  2928.     #####\
  2929. ; #19\
  2930. \
  2931.      ######\
  2932.    ### ...##\
  2933.   ##   ....##\
  2934.   # $##$#...#\
  2935.   # $  @ ...#\
  2936. ###  # # # $#\
  2937. ## $ #  #$## #\
  2938. #    $ $   # ##\
  2939. # $ # ##   $  #\
  2940. #  #   ## # # #\
  2941. # # $$   $    #\
  2942. #     #  ##  ##\
  2943. #####   ######\
  2944.    #####\
  2945. ; #20\
  2946. \
  2947.    ############\
  2948.   #......#####\
  2949.  #@..$ **.###\
  2950.  #  $ $      #\
  2951.  ####### #$#  #\
  2952. # #  # $ $  $ #\
  2953. #  #  # #  # # #\
  2954.      #  #   $ #\
  2955.       #  $##  #\
  2956.        #     #\
  2957.         #####\
  2958. ; #21\
  2959. \
  2960.     ######\
  2961. ######    #####\
  2962. #   #  #  #   ##\
  2963. # $$  $#$#  $  #\
  2964. #  #.#...  $ $ #\
  2965. #   .....@# $  #\
  2966. # $#.##*#  $$$ #\
  2967. ##  ....#$ #   #\
  2968. ###.#...  #####\
  2969.  # $ $#$# #\
  2970.  # $#   $ #\
  2971.  #    #   #\
  2972.  ##########\
  2973. ; #22\
  2974. \
  2975. ########\
  2976. #  #.#.##\
  2977. # $.$. .#\
  2978. #   .#$##\
  2979. ####   #\
  2980.   #$$$#\
  2981.   # @ #\
  2982.   #####\
  2983. ; #23\
  2984. \
  2985.  ##########\
  2986.  #        #\
  2987. ## $ ##   #\
  2988. #@ $$$  # #\
  2989. ##  $ $$  #\
  2990. ######  $$ #\
  2991. #... #$ $  #\
  2992. #..  # $## #\
  2993. #..     #  #\
  2994. #..  # ##  #\
  2995. #... #     #\
  2996. ############\
  2997. ; #24\
  2998. \
  2999.   ######\
  3000.   # @  #\
  3001. ####  $ #\
  3002. # *..*$ #\
  3003. # $*..* #\
  3004. # $  ####\
  3005. #    #\
  3006. ######\
  3007. ; #25\
  3008. \
  3009.  #######\
  3010.  #. .  #\
  3011. ####$#$ #\
  3012. # $. .  #\
  3013. #@$# #$ #\
  3014. # $.$.  #\
  3015. ####.  ##\
  3016.   #####\
  3017. ; #26\
  3018. \
  3019. ##########\
  3020. # @###...#\
  3021. # $$  .$.#\
  3022. #   #$#$ #\
  3023. ##       #\
  3024. ##########\
  3025. ; #27\
  3026. \
  3027. ######\
  3028. #    ##\
  3029. # $ * #\
  3030. ##.$$.#\
  3031. #. @ .#\
  3032. #.$$.##\
  3033. # * $ #\
  3034. ##    #\
  3035. ######\
  3036. ; #28\
  3037. \
  3038. #########\
  3039. #   @...#\
  3040. # #$#.*.#\
  3041. # $  $$ #\
  3042. ## #$   #\
  3043. #   ####\
  3044. #####\
  3045. ; #29\
  3046. \
  3047.     ######\
  3048. ######    #\
  3049. # $ .*. $ #\
  3050. #@$.* *.$ #\
  3051. # $ .*. $ #\
  3052. #     #####\
  3053. #######\
  3054. ; #30\
  3055. \
  3056. ######\
  3057. # # .#\
  3058. # $ .#\
  3059. #@ $.#\
  3060. # $$.#\
  3061. #  ###\
  3062. ####\
  3063. ; #31\
  3064. \
  3065. ####\
  3066. #  ###  #####\
  3067. # $$ #  #...#\
  3068. #    ####...#\
  3069. # $ $ $  ...#\
  3070. # $  #### ..#\
  3071. ### ##  ##$###\
  3072. ### ######   #\
  3073. #  $  #    $ #\
  3074. #    $  # $  #\
  3075. ##@#  ###   ##\
  3076. ###### #####\
  3077. ; #32\
  3078. \
  3079.    ####\
  3080. #####  #\
  3081. #  $ $ # #######\
  3082. #   $  # #*.*.*#\
  3083. ## $ $ ###.*.*.#\
  3084. #$ $  #  *.*.*#\
  3085. #@$ $    .*.*##\
  3086. #$ $  #  *.*.*#\
  3087. ## $ $ ###.*.*.#\
  3088. #   $  # #*.*.*#\
  3089. #  $ $ # #######\
  3090. #####  #\
  3091.    ####\
  3092. ; #33\
  3093. \
  3094.     ####\
  3095.     #  #####\
  3096. #####      #\
  3097. #  ## ##   #\
  3098. ##   $   #$$ #\
  3099. #  ####  # $ #\
  3100. #  ..##$#    #\
  3101. ###... $ # # #\
  3102.  #.*.#$ #$  #\
  3103.  #...#  # $##\
  3104.  #####$    #\
  3105.     #@  ####\
  3106.     #####\
  3107. ; #34\
  3108. \
  3109. ####\
  3110. #  ######\
  3111. #@$  $  ####\
  3112. #  #   $#  #\
  3113. ## #$ $  ..####\
  3114. ### # ####.....#\
  3115. #    $ # $.....#\
  3116. # $    $  #  ###\
  3117. #### #$#  ####\
  3118.   # $ $ ##\
  3119.   #    ##\
  3120.   ######\
  3121. ; #35\
  3122. \
  3123. ##############\
  3124. #....#       #\
  3125. #*...# $ $ $ #\
  3126. #..####  $   #\
  3127. #..#  #   $$ #\
  3128. #..$  ## #   #\
  3129. # $#  $  #####\
  3130. #  #  #      #\
  3131. ## #### ## # #\
  3132. # $    $ #   #\
  3133. # #$#$#@ #####\
  3134. #       ##\
  3135. #########\
  3136. ; #36\
  3137. \
  3138.  ###########\
  3139.  #.........#\
  3140.  #.........##\
  3141. ##########$$ #\
  3142. #     $  $ $ #\
  3143. # @##$ $  $  #\
  3144. # $#  ## ### ##\
  3145. #    $$ $   $ #\
  3146. ####$  $  #$$ #\
  3147.   #  $#      #\
  3148.   #     ######\
  3149.   #######\
  3150. ; #37\
  3151. \
  3152. #########\
  3153. #....   #\
  3154. #....$# #\
  3155. #.#..  $##\
  3156. #..@ #$  #\
  3157. ###### #$#####\
  3158.  ##   $   $ #\
  3159.  # $$ #$    #\
  3160.  #   $   $$ #\
  3161.  #   #$   ###\
  3162.  ###    ###\
  3163.    ######\
  3164. ; #38\
  3165. \
  3166. ###############\
  3167. #             #\
  3168. # # $..... ## #\
  3169. # ##.$###$. # #\
  3170. #    . # .  $ #\
  3171. # $#@$...# #  #\
  3172. # $  . # .$ # #\
  3173. # # # ... #   #\
  3174. #   ##$#$##$$ #\
  3175. # #  $ #      #\
  3176. # $ #$ # $##$ #\
  3177. #      #      #\
  3178. ###############\
  3179. ; #39\
  3180. \
  3181. ####\
  3182. #  #####\
  3183. # $$ $ #######\
  3184. #        ##  ###\
  3185. ### ####$# $ $ #\
  3186. #....        $ #\
  3187. #....####$ #   #\
  3188. #....###  ## $ #\
  3189. ##.#### $ $@$# #\
  3190. #    $   #    #\
  3191. #  #    #######\
  3192. #########\
  3193. ; #40\
  3194. \
  3195.          ####\
  3196. ###########  #\
  3197. #      $   $ #\
  3198. #  ##### ### #\
  3199. ## # $...$ # ##\
  3200. # # $...     #\
  3201. # #@#...###$ #\
  3202. ## ## ...    ##\
  3203. #  $ $$$ #####\
  3204. # $$   ###\
  3205. #      #\
  3206. ########\
  3207. ; #41\
  3208. \
  3209.       ####\
  3210.      ##  #\
  3211. ###### $ #\
  3212. ##    # $ #\
  3213. # $ $   # ####\
  3214. #  ##$#....#@##\
  3215. # #   #....   #\
  3216. # # $$ ....## #\
  3217. #     #....#  #\
  3218. ### # ### # $ #\
  3219. # $  $ #$ $  #\
  3220. #   $  # $  ##\
  3221. # $# # ##  ##\
  3222. # $  # #  ##\
  3223. #  ###   ##\
  3224. #### #####\
  3225. ; #42\
  3226. \
  3227.          #####\
  3228.        ###   #\
  3229.    #####   $ #\
  3230. #####   # $#$##\
  3231. #....$ $#     #\
  3232. #....$#   $ $ #\
  3233. #....@#  ###$##\
  3234. #....#   $    #\
  3235. ## #$ $ $ #   #\
  3236. # $$ #$########\
  3237. #      #\
  3238. ###   ##\
  3239.  #####\
  3240. ; #43\
  3241. \
  3242.        ####\
  3243.     ####  ##\
  3244. ##### $    #\
  3245. #   #   #$ ##\
  3246. # $$ #$#....#\
  3247. ##  $    ....#\
  3248. #  ## $ #.##.#\
  3249. # #  ## #....#\
  3250. #  $ @ $  $ ##\
  3251. ## $ $ #$ #$#\
  3252. #   ###    #\
  3253. ##### ######\
  3254. ; #44\
  3255. \
  3256.  #####\
  3257. ##   #\
  3258. # $# ####\
  3259. ##  .....##\
  3260. # $ #.....#\
  3261. # #$ # ...##\
  3262. #   $# ##  ##\
  3263. #    $$###$ ##\
  3264. # ##$#  @  $ #\
  3265. #    #$$ #   #\
  3266. ### # $  $ ###\
  3267.  #   #  ###\
  3268.  ########\
  3269. ; #45\
  3270. \
  3271.     ####\
  3272. #####  ##\
  3273. ##    $  ####\
  3274. #  $  #$  $ ##\
  3275. # $ #   #    #\
  3276. #  ### $@ #$ #\
  3277. ######...##  #\
  3278.   ####..#####\
  3279. ###  ... #\
  3280. ## $$#... #\
  3281. #  # $ ## #\
  3282. # #    $  #\
  3283. #     #####\
  3284. ##   ##\
  3285. #####\
  3286. ; #46\
  3287. \
  3288.  #########\
  3289.  #      @#\
  3290.  #$ $ $  #\
  3291.  # ##$# ##\
  3292. ##.. .. #\
  3293. # .. ..##\
  3294. ## #$## #\
  3295. #  $ $ $#\
  3296. #       #\
  3297. #########\
  3298. ; #47\
  3299. \
  3300. ######\
  3301. #    ######\
  3302. # $$$#    #\
  3303. # @$ # ## #\
  3304. # $$....# #####\
  3305. #  #.#.*# #   #\
  3306. #  #.#*.$     #\
  3307. #  #.*.. ###$##\
  3308. #######$#  #  #\
  3309.      # $$    #\
  3310.      #    #  #\
  3311.      #  ######\
  3312.      ####\
  3313. ; #48\
  3314. \
  3315.        #######\
  3316.        #     #\
  3317.        #$$ $ #\
  3318.   ######  $  #\
  3319.   #   ## $ $ #\
  3320.   # ....*  $ #\
  3321.   # .###.#####\
  3322.   ##.# #.#\
  3323. #####.###.#\
  3324. # $  *....#\
  3325. # $ $ #####\
  3326. #@ $  #\
  3327. # $ $$#\
  3328. #     #\
  3329. #######\
  3330. ; #49\
  3331. \
  3332. ########\
  3333. #  @   #\
  3334. ##$ $ $ #\
  3335. # $ # $ #\
  3336. #  $ # ##\
  3337. #......#\
  3338. ########\
  3339. ; #50\
  3340. \
  3341.   ####\
  3342.   #  ###\
  3343. ####  $ ####\
  3344. #    $# #  #\
  3345. # $#  #   @##\
  3346. #    #  #  ####\
  3347. # #$ $ #..... #\
  3348. # $ # $ ..##. #\
  3349. ##$  # #...*.##\
  3350. #  $#  #..#. #\
  3351. # $  #$$  $$ #\
  3352. #  # $    #  #\
  3353. ####    ######\
  3354.    ######\
  3355. ; #51\
  3356. \
  3357.    ########\
  3358.    #  ....#\
  3359. #### #....#\
  3360. ##  # $...##\
  3361. #  $ #$.*. ###\
  3362. #    $ $# $$ #\
  3363. # $#  @ #    #\
  3364. ##  #  #  $ ##\
  3365. #  $ # $ ###\
  3366. #  #  $ $#\
  3367. #####    #\
  3368.     ######\
  3369. ; #52\
  3370. \
  3371. #######\
  3372. #. . .#\
  3373. # $$$ #\
  3374. #.$@$.#\
  3375. # $$$ #\
  3376. #. . .#\
  3377. #######\
  3378. ; #53\
  3379. \
  3380. ##############\
  3381. #   ###      #\
  3382. # $$$     $$ #\
  3383. # $ ### $ $  #\
  3384. # $ #  ### ###\
  3385. #   #.*...$@##\
  3386. #   #.....#$ #\
  3387. ## # ...#.#  #\
  3388. ## # .....#  #\
  3389. ##$#####  # ##\
  3390. #     $ ###  #\
  3391. # $$ $    $$ #\
  3392. #       ###  #\
  3393. ##############\
  3394. ; #54\
  3395. \
  3396.   #####\
  3397. ####   #\
  3398. #  $.# ##\
  3399. #   $   #\
  3400. #.##.##.#\
  3401. #  $$$  #\
  3402. ####.  @#\
  3403.   ######\
  3404. ; #55\
  3405. \
  3406. ##########\
  3407. #    .   #\
  3408. ## $##$## #\
  3409. # @$. . .$##\
  3410. #   ##$##  #\
  3411. ###   .    #\
  3412.  ##########\
  3413. ; #56\
  3414. \
  3415. ########\
  3416. #   @  #\
  3417. # #$## #\
  3418. # $  $ #\
  3419. ###  $##\
  3420. #. $.#\
  3421. #. ..#\
  3422. ######\
  3423. ; #57\
  3424. \
  3425. #######\
  3426. #  .  ####\
  3427. # $.$ $ @#\
  3428. #  .####.##\
  3429. #  $ $ $. #\
  3430. ####    . #\
  3431.   ########\
  3432. ; #58\
  3433. \
  3434. #####\
  3435. #   #######\
  3436. # $ * .$  #\
  3437. # #.#.#.# #\
  3438. # $ $@$ $ #\
  3439. # #.#.#.# #\
  3440. #  $. * $ #\
  3441. ###   #   #\
  3442.  #########\
  3443. ; #59\
  3444. \
  3445. #####\
  3446. #   ######\
  3447. # $.##   #\
  3448. ##$...$  #\
  3449. ### .$. ###\
  3450. #@$ $$###\
  3451. # $ ..###\
  3452. # $  .  #\
  3453. #####   #\
  3454.   ######\
  3455. ; #60\
  3456. \
  3457.  #########\
  3458. ##.......##\
  3459. ## .$$$$$. ##\
  3460. #   #   #   #\
  3461. #  #*#@#*#  #\
  3462. ##  #   #  ##\
  3463. #. $$$$$  #\
  3464.  #.$     #\
  3465.   ##   ##\
  3466.     ###\
  3467.      #\
  3468.      #\
  3469. ; #61\
  3470. \
  3471.  ####\
  3472. ###  ######\
  3473. #    ##   #\
  3474. # #     $ #\
  3475. # $$ #$#$##\
  3476. ### $    ###\
  3477.  ##  ##.*.##\
  3478.   ##$ $... ##\
  3479.  ##  ##...  #\
  3480.  #   $ #. @ #\
  3481.  # #   $.# ##\
  3482.  #    ##   #\
  3483.  #######  ##\
  3484.        ####\
  3485. ; #62\
  3486. \
  3487. #######\
  3488. ##  *  ##\
  3489. # . .@. #\
  3490. #   * $ #\
  3491. #*$$*$$*#\
  3492. # $ *   #\
  3493. # . . . #\
  3494. ##  *  ##\
  3495. #######\
  3496. ; #63\
  3497. \
  3498. #######\
  3499. #     #\
  3500. # $.$ #\
  3501. # .$. #\
  3502. #*$.$*#\
  3503. # .$. #\
  3504. #  .$ #\
  3505. # @   #\
  3506. #######\
  3507. ; #64\
  3508. \
  3509. ######\
  3510. # @  ##\
  3511. #$##  #\
  3512. ## ..  #\
  3513. # $**$ #\
  3514. #  .. ##\
  3515. #  ##$#\
  3516. ##    #\
  3517. ######\
  3518. ; #65\
  3519. \
  3520. ###############\
  3521. #             #\
  3522. # $.$.$.$.$.# #\
  3523. # .$.$.$.$.$  #\
  3524. # $.$.$.$.$.#@#\
  3525. # .$.$.$.$.$  #\
  3526. # $.$.$.$.$.# #\
  3527. #             #\
  3528. ###############\
  3529. ; #66\
  3530. \
  3531. #######\
  3532. # $.  #\
  3533. #. .$.#\
  3534. #$.*. #\
  3535. # $*$ #\
  3536. #  .  #\
  3537. # $*$ #\
  3538. #  * @#\
  3539. #######\
  3540. ; #67\
  3541. \
  3542.   #######\
  3543.   # ... #\
  3544. ####$##$ ##\
  3545. #    $    #\
  3546. # #$@.* # #\
  3547. #   $*. # #\
  3548. ## # .* # #\
  3549. #$ ####  #\
  3550. #       ##\
  3551. #########\
  3552. ; #68\
  3553. \
  3554. #######\
  3555. #  .  #\
  3556. # $.$ #\
  3557. # $*$ #\
  3558. #..*..#\
  3559. #$$*$ #\
  3560. #  .  #\
  3561. # $. @#\
  3562. #######\
  3563. ; #69\
  3564. \
  3565. ##########\
  3566. #.     $.#\
  3567. # #### #.#\
  3568. #. $ #$  #\
  3569. #  $ # $ #\
  3570. #   $@ $##\
  3571. ######...#\
  3572.     #####\
  3573. ; #70\
  3574. \
  3575.    ##########\
  3576.   ##   #    ##\
  3577. ####    #  #  #\
  3578. #  $.******.$ #\
  3579. #   #   @  #  #\
  3580. #####    ######\
  3581.    ######\
  3582. ; #71\
  3583. \
  3584.       #\
  3585.      ###\
  3586.     ##  #\
  3587.    #  $ ##\
  3588.   #  $.$  #\
  3589.  ## $.*.$  #\
  3590. #  $.*.*.$ ##\
  3591. ## $.*.*.*.$ ##\
  3592. ## $.*.*.$  #\
  3593.  #  $.*.$ ##\
  3594.   #  $.$  #\
  3595.    ## $  #\
  3596.     # @##\
  3597.      ###\
  3598.       #\
  3599. ; #72\
  3600. \
  3601. #######\
  3602. #  *  #\
  3603. #  *  #\
  3604. # $*$ #\
  3605. #*...*#\
  3606. # $.$ #\
  3607. # $.$ #\
  3608. #  . @#\
  3609. #######\
  3610. ; #73\
  3611. \
  3612. #########\
  3613. ##  @  ##\
  3614. # $ $.# #\
  3615. #  $.#. #\
  3616. # $.#.$ #\
  3617. # .*.$  #\
  3618. # #.$ $ #\
  3619. ##     ##\
  3620. #########\
  3621. ; #74\
  3622. \
  3623. #######\
  3624. #  .  #\
  3625. # $*$ #\
  3626. # $.$ #\
  3627. # ... #\
  3628. #.$.$.#\
  3629. #$$*$ #\
  3630. #  . @#\
  3631. #######\
  3632. ; #75\
  3633. \
  3634. ###############\
  3635. #  .........  #\
  3636. # $.$$$$$$$$$ #\
  3637. # $.$.......$ #\
  3638. # $.$.$$$$$.$ #\
  3639. # $.$.$...$.$ #\
  3640. # $.$.$*$.$.$@#\
  3641. # $.$...$.$.$ #\
  3642. # $.$$$$$.$.$ #\
  3643. # $.......$.$ #\
  3644. # $$$$$$$$$.$ #\
  3645. #  .........  #\
  3646. ###############\
  3647. ; #76\
  3648. \
  3649. ########\
  3650. ##  @#  #\
  3651. #  ###$ ##\
  3652. #  * *   #\
  3653. # * * *  #\
  3654. #  * * . #\
  3655. ###   ####\
  3656.  #####\
  3657. ; #77\
  3658. \
  3659. #######\
  3660. #  .  #\
  3661. # $.$ #\
  3662. # $.* #\
  3663. #.$*$.#\
  3664. # *.$ #\
  3665. # $.$ #\
  3666. #  . @#\
  3667. #######\
  3668. ; #78\
  3669. \
  3670. ##########\
  3671. #        #\
  3672. # $#$#$#$##\
  3673. #. .$...$.#\
  3674. #. .$...$.#\
  3675. # $#$#$#$@#\
  3676. #        ##\
  3677. ##########\
  3678. ; #79\
  3679. \
  3680. #########\
  3681. #   #   ###\
  3682. #   $ $   #\
  3683. ## ##.#   #\
  3684. #@$##.##$##\
  3685. # $.....  #\
  3686. ##$##.##$ #\
  3687. #  ##.#   #\
  3688. #  $ $#  ##\
  3689. #     #  #\
  3690. ##########\
  3691. ; #80\
  3692. \
  3693.            ####\
  3694. ############  #\
  3695. #      $      #\
  3696. #$$#  ## ###  #\
  3697. ##  ## #....# ##\
  3698. #  $   #....$  #\
  3699. #@#$$ ##....#  #\
  3700. # $    #....#  #\
  3701. ##  $$ ###$### #\
  3702. # $ $ #       #\
  3703. #$ $ $  #   # #\
  3704. #  ## #####   #\
  3705. #     #   #####\
  3706. #######\
  3707. ; #81\
  3708. \
  3709. ####   ####\
  3710. ##  #####  #\
  3711. # $ $   $$ #\
  3712. #    ## #  ###\
  3713. ##$#.....$   #\
  3714. # #.....#  $##\
  3715. # #.....# $$ #\
  3716. # ### ###    #\
  3717. #    @    #$ #\
  3718. #  #  $ ###  #\
  3719. #### $ $ $ $ #\
  3720.    #####     #\
  3721.        #######\
  3722. ; #82\
  3723. \
  3724. ############\
  3725. # @# ......#\
  3726. #$ #...* $ #\
  3727. #   $ ##  ##\
  3728. # $ $  ## #\
  3729. ## ### $#  #\
  3730. # $# $    $#\
  3731. #     ##   #\
  3732. ####  ######\
  3733.   ####\
  3734. ; #83\
  3735. \
  3736.   #########\
  3737.   #@      #\
  3738. ### ##  # ##\
  3739. # $$ # $#  ##\
  3740. #    # $ #$ #\
  3741. #  # # #    #\
  3742. ## # $  $ $ #\
  3743.  # #   ###  ##\
  3744.  # ##...##$  #\
  3745. ###$$ ..### # #\
  3746. #  $  ...##   #\
  3747. #   ##....#####\
  3748. ###########\
  3749. ; #84\
  3750. \
  3751. ####\
  3752. #  ########\
  3753. #   $     ###\
  3754. # ##$ ###   #\
  3755. #    #...$  ##\
  3756. #$ @ #...# $ ##\
  3757. ##  #  ...#$   #\
  3758. # $$  $#..  #  #\
  3759. # #  $ #..$ $  #\
  3760. #  $  ##..#  ###\
  3761. ### #$  $ ####\
  3762.  #    #  #\
  3763.  #########\
  3764. ; #85\
  3765. \
  3766. #########\
  3767. #   ## @#\
  3768. # $  $  #\
  3769. ## *.#$ ##\
  3770. # #.*   #\
  3771. # .. $# #\
  3772. #####   #\
  3773.     #####\
  3774. ; #86\
  3775. \
  3776.  ####\
  3777.  #  ########\
  3778. ##    $    #\
  3779. # $# #.# # #\
  3780. #  ...*. $ #\
  3781. ## #$##.##  #\
  3782. # $     $ @ #\
  3783. #   ###  #  #\
  3784. ##### #######\
  3785. ; #87\
  3786. \
  3787. #####\
  3788. #   ########\
  3789. #   # .    ##\
  3790. #  ## *$$#  #\
  3791. # @ # .   $ #\
  3792. #   # .#$#  #\
  3793. ##  ##.# $ ##\
  3794. #  ##.#   #\
  3795. #   #. # ###\
  3796. #   $* # $ #\
  3797. #    . #   #\
  3798. ############\
  3799. ; #88\
  3800. \
  3801.   ###### #####\
  3802.   #    ###   #\
  3803.   # #$     $ #\
  3804. ### $ ##### ##\
  3805. #   #.##     #\
  3806. # $##.##  #$ #\
  3807. #  ..... $#  #\
  3808. ##$ ##.##  ####\
  3809. #  $ #.#####\
  3810. #   $ @ #\
  3811. #####   #\
  3812.    #####\
  3813. ; #89\
  3814. \
  3815. #########\
  3816. #  #    ###\
  3817. #  #  #   ###\
  3818. # .   # $ $ ###\
  3819. #..#  # $ $   #\
  3820. #..   # @$ $  #\
  3821. #..#  ##$# $  #\
  3822. #..  ##   $ ###\
  3823. #..#    $$# #\
  3824. #    ##     #\
  3825. #  ##########\
  3826. #  #\
  3827. ####\
  3828. ; #90\
  3829. \
  3830. ############\
  3831. #    ... $ #\
  3832. # $$$*** $@#\
  3833. #    ... $ #\
  3834. ############\
  3835. ; #91\
  3836. \
  3837.     #####\
  3838. ######   ######\
  3839. #   #  $ ##   #\
  3840. # $ $ $ #   $ ##\
  3841. #  $# @ $ $$#  #\
  3842. ## $  #     $$ #\
  3843. #..#$#### #$#  #\
  3844. #....  #  #   ##\
  3845. #....   $$#####\
  3846. #...###   #\
  3847. #...# #####\
  3848. #####\
  3849. ; #92\
  3850. \
  3851.  #####\
  3852.  #   #\
  3853. ### . #\
  3854. #   . #####\
  3855. # ##$## @ #\
  3856. #   . $   #\
  3857. ###$.$#####\
  3858.  #   #\
  3859.  #####\
  3860. ; #93\
  3861. \
  3862.     #######\
  3863.     #@ #  #\
  3864. ###### $   #\
  3865. #...### #  ##\
  3866. #.  #  $ #  #\
  3867. #.    $ $ $ #\
  3868. #.  #  $ #  #\
  3869. #...### #  ##\
  3870. ###### $#  #\
  3871.     #  $$ #\
  3872.     #  #  #\
  3873.     #######\
  3874. ; #94\
  3875. \
  3876.     #####\
  3877.   ###   ####\
  3878. ### $ $ #  #\
  3879. ##   .#     #\
  3880. # $# ..# $  #\
  3881. #@$  ...#  ##\
  3882. # $# #...#$ #\
  3883. ##   $ $    #\
  3884. #### # #####\
  3885.    #   #\
  3886.    #####\
  3887. ; #95\
  3888. \
  3889.    ####\
  3890.  ### @####\
  3891. #  #   #  #\
  3892. #$ $ $$$ $#\
  3893. #  #.#.#  #\
  3894. # #.....# #\
  3895. # #.....# #\
  3896. #   #...#   #\
  3897. # $  # #  $ #\
  3898. #  $ $ $  #\
  3899.  #$ $ $ $#\
  3900.  #       #\
  3901.  #########\
  3902. ; #96\
  3903. \
  3904.             #\
  3905.            ##\
  3906.           ###\
  3907.          #   #\
  3908.   ######## # #\
  3909.  # $ $ $ $   #\
  3910. ## # # # #$##\
  3911. ###.......   ##\
  3912. ## #.#.#.#@$#\
  3913.  # $ $ $ $   #\
  3914.   ######## # #\
  3915.          #   #\
  3916.           ###\
  3917.            ##\
  3918.             #\
  3919. ; #97\
  3920. \
  3921.    ##   ##\
  3922.   ######  #\
  3923. ####  $ $  ####\
  3924. ### *.*.* ###\
  3925.  ## .$ $. ##\
  3926.   # *.*.* #\
  3927.   #  $ $  #\
  3928.   ### @ ###\
  3929.     #####\
  3930.       #\
  3931. ; #98\
  3932. \
  3933. #####       ####\
  3934. #   #########  #\
  3935. #              #\
  3936. ## ##########  #\
  3937. # # * . * ## ##\
  3938. # #  * *  ## #\
  3939. # # * * * ## #\
  3940. # #  * *  ## #\
  3941. # # * * * ## #\
  3942. # #  * *  ## ##\
  3943. # # * * *     #\
  3944. #$#  * *  #   #\
  3945. #@  * * * #  ##\
  3946. ##############\
  3947. ; #99\
  3948. \
  3949. ###########\
  3950. #  #   #  #\
  3951. #  $  $   #\
  3952. #  ##.##  #\
  3953. ## ...##$##\
  3954. ##$#...   #\
  3955. #  #.##$# #\
  3956. # $$  $   #\
  3957. # @#  #####\
  3958. #######\
  3959. ; #100\
  3960. \
  3961. ##### ####\
  3962. #   ###  ######\
  3963. # $  $ @$.... #\
  3964. ##$ $  #$.##. #\
  3965. #  # $# ....##\
  3966. #  $  #$.##. #\
  3967. # $  #  .... #\
  3968. #$$$ # $$  $##\
  3969. #    #  ##  #\
  3970. #############\
  3971. ; #101\
  3972. \
  3973.   #####\
  3974.   #...######\
  3975.   #...#    #\
  3976.   #...$ $$ #\
  3977. #####.. @# ##\
  3978. #    $ ### ###\
  3979. #   #$####   #\
  3980. ## $     ### #\
  3981. #   # $  $  #\
  3982. ######  # $ #\
  3983.     #  $#$# #\
  3984.     #       #\
  3985.     #########\
  3986. ; #102\
  3987. \
  3988.    #####\
  3989.    #   #\
  3990. ####$# ###\
  3991. # $  @$  ###\
  3992. #   #    $ #\
  3993. ###$## $$   #\
  3994. #....#$#  $ ##\
  3995. #..... ###$  #\
  3996. ##.#.  #   $ #\
  3997. #... $#$ #  #\
  3998. #  #   $ ####\
  3999. ####  ####\
  4000.    ####\
  4001. ; #103\
  4002. \
  4003. ###########\
  4004. #   ##..  #\
  4005. # $ ....# ##\
  4006. #  #.... @ ###\
  4007. #  #.#.. #   #\
  4008. ####.###  $# #\
  4009. ##  ##  $ # ##\
  4010. ##   #  #$    #\
  4011. #  $ #$$#   # #\
  4012. # # $  $ ##   #\
  4013. # ###$ $  $  ##\
  4014. # $    ##    #\
  4015. # $   ####   #\
  4016. #  ####  #####\
  4017. ####\
  4018. ; #104\
  4019. \
  4020. #######\
  4021. #...  #####\
  4022. #...#$#   ###\
  4023. #... $@ $   ###\
  4024. ##$$# ##$#$   #\
  4025. #   #     $$# #\
  4026. # $###$## # $ #\
  4027. # $.#.$       #\
  4028. ##  ...#$$ #####\
  4029. #  $#..  ###\
  4030. #   ##.   #\
  4031. #######   #\
  4032.      #####\
  4033. ; #105\
  4034. \
  4035. ####   #####\
  4036. #  #####   #\
  4037. ##*   * #$# #\
  4038. #   #   #   #\
  4039. # * . *  ** #\
  4040. ######   #@##\
  4041. # .   ###   #\
  4042. # $ *    *# #\
  4043. ##*   * **  #\
  4044. #  ####    #\
  4045. ####  ######\
  4046. ; #106\
  4047. \
  4048.      ####\
  4049.      #  #\
  4050.    ###  ####\
  4051. #####       ###\
  4052. #   $ #$###   #\
  4053. #  $@$....#$$ #\
  4054. ######..*.  $ #\
  4055.   #####..#####\
  4056.   # $ $ ##\
  4057.   #     #\
  4058.   #######\
  4059. ; #107\
  4060. \
  4061.         #####\
  4062.         #   #\
  4063. ########## * ###\
  4064. #          .   #\
  4065. # $$$$****$...@#\
  4066. #          .   #\
  4067. ########## * ###\
  4068.         #   #\
  4069.         #####\
  4070. ; #108\
  4071. \
  4072. ########\
  4073. #  .$  #\
  4074. # .$.$ ##\
  4075. #*$.$.@ #\
  4076. # .$.$  #\
  4077. #  .$ ###\
  4078. #######\
  4079. ; #109\
  4080. \
  4081. ###########\
  4082. #    .    #\
  4083. #  $.$.$  #\
  4084. ###.$.$.###\
  4085.  ##.$.##\
  4086.   #$.$#\
  4087.   # $ #\
  4088.   # @ #\
  4089.   #####\
  4090. ; #110\
  4091. \
  4092.       #####\
  4093. ########   #\
  4094. #......... #\
  4095. #  $ #$#   #\
  4096. # $#    # ###\
  4097. #  #  # $   #\
  4098. #$### $ # # #\
  4099. #@$    $  $ #\
  4100. ######  #####\
  4101.     ####\
  4102. ; #111\
  4103. \
  4104.          #####\
  4105.          #   #\
  4106. ########### # #\
  4107. #             #\
  4108. # # $#######$$#\
  4109. # #  *.....#  #\
  4110. # #$ #.***.*  #\
  4111. # #  #.....#  #\
  4112. # #  ####*###$##\
  4113. # #         $  #\
  4114. # $ $ $ $ $ $ @#\
  4115. ##  ############\
  4116. ####\
  4117. ; #112\
  4118. \
  4119. ###########\
  4120. #  .$ $.  #\
  4121. #  .$  #  #\
  4122. #.#*#..*..#\
  4123. #$ .$$$#$$#\
  4124. #  .$@$.  #\
  4125. #$$#$$$. $#\
  4126. #..*..#*#.#\
  4127. #  #  $.  #\
  4128. # $. $ .  #\
  4129. ###########\
  4130. ; #113\
  4131. \
  4132.   #####\
  4133.   # @ #\
  4134.   #$$$#\
  4135. #### . ####\
  4136. #   *.* $ #\
  4137. # $.....$ #\
  4138. # $ *.*   #\
  4139. #### . ####\
  4140.   # $$#\
  4141.   #   #\
  4142.   #####\
  4143. ; #114\
  4144. \
  4145. #######\
  4146. # $. @#\
  4147. #  .$ #\
  4148. # **$ #\
  4149. #* .$*#\
  4150. # $*. #\
  4151. #  .$ #\
  4152. #  .  #\
  4153. #######\
  4154. ; #115\
  4155. \
  4156. #######\
  4157. #  *  #\
  4158. # $.$ #\
  4159. #  .$ #\
  4160. #.*.*.#\
  4161. #$ *  #\
  4162. # $. $#\
  4163. #@ *  #\
  4164. #######\
  4165. ; #116\
  4166. \
  4167.   ######\
  4168. ####    ####\
  4169. #@ $.#*$   #\
  4170. # $ ...# $ #\
  4171. ###$#.     #\
  4172.  #   ######\
  4173.  #####\
  4174. ; #117\
  4175. \
  4176.   #####\
  4177.   #.  #\
  4178.   #...#\
  4179.   #.  #\
  4180.   #.  #\
  4181. ##### #####\
  4182. #         #\
  4183. # $@$$$$$ #\
  4184. #    #    #\
  4185. ###########\
  4186. ; #118\
  4187. \
  4188.  #####\
  4189.  # . #\
  4190.  # * #\
  4191.  # . #\
  4192. ###$*$###\
  4193. #   *   #\
  4194. # ***** #\
  4195. #   *   #\
  4196. ### . ###\
  4197.  # $ #\
  4198.  # @ #\
  4199.  #####\
  4200. ; #119\
  4201. \
  4202. #############\
  4203. #.          #\
  4204. #.#$#$#$#$#$#\
  4205. #.          #\
  4206. #.#########.#\
  4207. #.#.  $ ..$$#\
  4208. #.# $ $ *.$@#\
  4209. #.#.* $ ..$*##\
  4210. #.#########  #\
  4211. #.$ $ $ $ $  #\
  4212. #.           #\
  4213. ##############\
  4214. ; #120\
  4215. ",
  4216.   bsod = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4217. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4218. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4219. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4220. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4221. bbbbbbbbbbbb0000bb00000b00000b0000bbbbbbbbbbbbbbb\
  4222. bbbbbbbbbbbb0bbb0b0bbbbb0bbb0b0bbb0bbbbbbbbbbbbbb\
  4223. bbbbbbbbbbbb0000bb00000b0bbb0b0bbb0bbbbbbbbbbbbbb\
  4224. bbbbbbbbbbbb0bbb0bbbbb0b0bbb0b0bbb0bbbbbbbbbbbbbb\
  4225. bbbbbbbbbbbb0000bb00000b00000b0000bbbbbbbbbbbbbbb\
  4226. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4227. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4228. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4229. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4230. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4231. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4232. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4233. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  4234.   [ "CCQT/UTFPro" ] = "bbbbbbbbbbbbb9\
  4235. b7bb88888777b9\
  4236. b7bb7b8b7bbbb9\
  4237. b7bb7b8b77bbb9\
  4238. b7bb7b8b7bbbb9\
  4239. b7777b8b7bbbb9\
  4240. bbbbbbbbbbbbb9\
  4241. 99999999999999",
  4242.   [ "redcast/files/.bios" ] = "--error(\"I loaded!\")\
  4243. local config = \"devconfig\"\
  4244. local conf = dofile(config)\
  4245. term.setBackgroundColour(colours.white)\
  4246. term.setTextColour(colours.black)\
  4247. term.clear()\
  4248. term.setCursorPos(1,1)\
  4249. \
  4250. function changeLine(fileloc, line, text)\
  4251.  if not fs.exists(fileloc) or fs.isDir(fileloc) then\
  4252.    return\
  4253.  end\
  4254.  local tbl = {}\
  4255.  local currentLine = \"\"\
  4256.  local i = 0\
  4257.  local file = fs.open(fileloc, \"r\")\
  4258.  repeat\
  4259.    i = i + 1\
  4260.    currentLine = file.readLine()\
  4261.    tbl[i] = currentLine\
  4262.  until currentLine == nil\
  4263.  file.close()\
  4264.  tbl[line] = text\
  4265.  local file2 = fs.open(fileloc, \"w\")\
  4266.  for i,v in pairs(tbl) do\
  4267.    file2.write(v)\
  4268.  end\
  4269.  file2.close()\
  4270. end\
  4271. \
  4272. local file = fs.open(\"devconfig\",\"r\")\
  4273. local configVer = file.readLine()\
  4274. if not string.find(configVer,\"local version\") then\
  4275.  print(\"CRITICAL EXCEPTION!\")\
  4276.  print(\"Outdated config version detected!\")\
  4277.  print()\
  4278.  print(\"Press any key to reboot.\")\
  4279.  local event, key = os.pullEvent(\"key\")\
  4280.  os.reboot()\
  4281. end\
  4282. file.close()\
  4283. --error(\"I reached here!\")\
  4284. --changeLine(\"linetest\", 1, \"Hey!\")\
  4285. while true do\
  4286.  term.clear()\
  4287.  term.setCursorPos(1,1)\
  4288.  print(\"RedCast Setup\")\
  4289.  print()\
  4290.  print(\"1. Edit Config\")\
  4291.  print(\"2. Reset System\")\
  4292.  print(\"3. File Manager\")\
  4293.  print(\"4. Reboot\")\
  4294.  print(\"5. Shutdown\")\
  4295.  local event, key = os.pullEvent(\"key\")\
  4296.  if key == 2 then\
  4297.    shell.run(\"edit devconfig\")\
  4298.    term.setBackgroundColour(colours.white)\
  4299.    term.setTextColour(colours.black)\
  4300.  elseif key == 3 then\
  4301.    term.clear()\
  4302.    term.setCursorPos(1,1)\
  4303.    print(\"Are you sure? [Y/N]\")\
  4304.    repeat\
  4305.      event2, key2 = os.pullEvent(\"key\")\
  4306.    until key2 == keys.y or key2 == keys.n\
  4307.    if key2 == keys.y then\
  4308.      local root = fs.list(\"/\")\
  4309.      for i,v in pairs(root) do\
  4310.        if not v == \"rom\" or not v == \".restore\" then\
  4311.          print(\"Deleted \"..v..\"!\")\
  4312.          fs.delete(v)\
  4313.        end\
  4314.      end\
  4315.      local backup = fs.list(\".restore\")\
  4316.      for i,v in pairs(backup) do\
  4317.        fs.copy(\".restore/\"..v,v)\
  4318.      end\
  4319.    end\
  4320.  elseif key == 4 then\
  4321.    term.setBackgroundColour(colours.black)\
  4322.    term.setTextColour(colours.white)\
  4323.    shell.run(\"manager\")\
  4324.    term.setBackgroundColour(colours.white)\
  4325.    term.setTextColour(colours.black)\
  4326.  elseif key == 5 then\
  4327.    os.reboot()\
  4328.  elseif key == 6 then\
  4329.    os.shutdown()\
  4330.  end\
  4331. end",
  4332.   [ ".qcconfig" ] = "{\
  4333.  started = true,\
  4334. }",
  4335.   [ "goldrunner/levels/classic_004" ] = "bbbbbbbbbb5                           bbbbbbbbbb\
  4336. bbbbbbbbbb8ddddddddddd                bbbbbbbbbb\
  4337. bbbbbbbbbbc     c     b 4 b     c     bbbbbbbbbb\
  4338. bbbbbbbbbbc 4  ccc  4 bbbbb 4  ccc  4 bbbbbbbbbb\
  4339. bbbbbbbbbbc cc  c  cc       cc  c  cc bbbbbbbbbb\
  4340. bbbbbbbbbbc c ccccc c       c ccccc c bbbbbbbbbb\
  4341. bbbbbbbbbbc c  4e4  c   c   c  4e4  c bbbbbbbbbb\
  4342. bbbbbbbbbbc  cbbbbbc   ccc   cbbbbbc  bbbbbbbbbb\
  4343. bbbbbbbbbbc   ccccc cc  c  cc ccccc   bbbbbbbbbb\
  4344. bbbbbbbbbbc         c ccccc c         bbbbbbbbbb\
  4345. bbbbbbbbbbc    4    c  4e4  c     4   bbbbbbbbbb\
  4346. bbbbbbbbbbcbbbbbbc   cbbbbbc  cbbbbbbbbbbbbbbbbb\
  4347. bbbbbbbbbbc      c    ccccc   c       bbbbbbbbbb\
  4348. bbbbbbbbbbc      c            c       bbbbbbbbbb\
  4349. bbbbbbbbbbc      c       4  0 c       bbbbbbbbbb\
  4350. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  4351. 7777777777777777777777777777777777777777777777777",
  4352.   [ "redcast/files/CubeAPI" ] = "-- RedCube API by Gonow32\
  4353. -- Designed for the RedCube games console\
  4354. \
  4355. function clearScr(backColour, textColour)\
  4356.  term.setBackgroundColour(backColour)\
  4357.  term.setTextColour(textColour)\
  4358.  term.clear()\
  4359.  term.setCursorPos(1,1)\
  4360. end\
  4361. \
  4362. function checkForSaveFolder()\
  4363.  if fs.exists(\"saves\") and fs.isDir(\"saves\") then\
  4364.    return true\
  4365.  else\
  4366.    return false\
  4367.  end\
  4368. end\
  4369. \
  4370. \
  4371. ",
  4372.   diskinfo = "return {\
  4373.  sGameFile = \"tron\",\
  4374.  sName = \"TRON\",\
  4375. }",
  4376.   [ "tron/.copyprotect" ] = "",
  4377.   [ "ccsand/startgame" ] = "--[[\
  4378. CCSand by CosmoConsole\
  4379. Supports Redirect API created by GopherAtl\
  4380. \
  4381. License: Creative Commons Attribution-NonCommercial-ShareAlike (http://creativecommons.org/licenses/by-nc-sa/3.0/)\
  4382. \
  4383. A program coded with LUA for dan200's (Daniel Ratcliffe) ComputerCraft mod (http://www.computercraft.info/)\
  4384. created for Minecraft by Mojang AB (http://minecraft.net/)\
  4385. \
  4386. This program is a falling sand-type of simulator game.\
  4387. \
  4388. Do not change anything beyond this if you are not sure what to do.\
  4389. --]]\
  4390. \
  4391. -- Build no 111\
  4392. \
  4393. --assert(true, \"Program is in development phase. Remove the first line if you're a debugger.\")\
  4394. version = \" v0.5\"\
  4395. if term.isColor() == false then\
  4396. error(\"This program requires an Advanced Computer\")\
  4397. end\
  4398. \
  4399. paused = true\
  4400. on = true\
  4401. drawing = false\
  4402. dirty = true\
  4403. particleLimit = 1000\
  4404. page = 0\
  4405. sel = 1\
  4406. fps = 10\
  4407. menu = false\
  4408. debug = false\
  4409. shouldRender = false\
  4410. buffer=term\
  4411. API = false\
  4412. ipart = nil\
  4413. statusbar = \"\"\
  4414. textReset = os.startTimer(5)\
  4415. brushSize = 1\
  4416. \
  4417. logs = fs.open(\"ccsand.log\", \"a\")\
  4418. function log(s)\
  4419. logs.writeLine(os.day() .. \"-\" .. textutils.formatTime(os.time(),true) .. \"; \" .. s)\
  4420. end\
  4421. \
  4422. \
  4423. \
  4424. -- elements = [1] = {name, bg, fg, ch, type, spread%, grav%, weight, flam, init, inil, inic, ltp, ltr, htp, htr, inv, func, tc, expl, tool}\
  4425. -- (l/h)t(p/r) = low/high temperature point/reaction\
  4426. -- inv = can other materials go into it\
  4427. -- func = own function\
  4428. -- ini(t/l/c) = initial temperature/life/co-type\
  4429. -- type; solid = 0, powder = 1, liquid = 2\
  4430. elements = {\
  4431. [0] = {\" Air \", colors.black, colors.white, \" \", 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, [\"func\"] = nil, 0, 0, 0},\
  4432. [1] = {\" Sand\", colors.yellow, colors.white, \":\", 1, 20, 90, 52, 0, 295, 0, 0, -1, 0, -1, 0, 0, [\"func\"] = nil, 35, 0, 0},\
  4433. [2] = {\" Wall\", colors.lime, colors.lime, \".\", 0, 0, 0, 100, 0, 293, 0, 0, -1, 0, -1, 0, 0, [\"func\"] = nil, 80, 0, 0},\
  4434. [3] = {\"Water\", colors.blue, colors.lightBlue, \"~\", 2, 8, 95, 30, 0, 295, 0, 0, 272.9, 16, 373.1, 15, 0, [\"func\"] = nil, 25, 0, 0},\
  4435. [4] = {\" Void\", colors.purple, colors.black, \"+\", 0, 0, 0, 100, 0, 295, 0, 0, -1, 0, -1, 0, 1, [\"func\"] = nil, 80, 0, 0},\
  4436. [5] = {\"Crazy\", colors.white, colors.blue, \"X\", 0, 0, 0, 0, 0, 295, 0, 0, -1, 0, -1, 0, 1, [\"func\"] = nil, 70, 0, 0},\
  4437. [6] = {\"  N2 \", colors.lightBlue, colors.white, \":\", 0, 0, 0, 10, 0, 295, 0, 0, -1, 0, -1, 0, 1, [\"func\"] = gas_movement, 30, 0, 0},\
  4438. [7] = {\" Fire\", colors.orange, colors.yellow, \"^\", 2, 8, -100, 24, 0, 595, 20, 0, 373, 18, -1, 0, 1, [\"func\"] = fire, 40, 0, 0},\
  4439. [8] = {\" Oil \", colors.green, colors.yellow, \"~\", 2, 8, 95, 28, 80, 295, 0, 0, -1, 0, 600, 7, 0, [\"func\"] = nil, 40, 0, 0},\
  4440. [9] = {\"  O2 \", colors.lightBlue, colors.white, \"O\", 0, 0, 0, 10, 90, 295, 0, 0, -1, 0, -1, 0, 1, [\"func\"] = gas_movement, 30, 0, 0},\
  4441. [10] = {\" Wood\", colors.yellow, colors.brown, \":\", 0, 0, 0, 100, 60, 293, 0, 0, -1, 0, 600, 7, 0, [\"func\"] = nil, 55, 0, 0},\
  4442. [11] = {\" TNT \", colors.red, colors.pink, \"T\", 0, 0, 0, 100, 100, 293, 0, 0, -1, 0, -1, 0, 0, [\"func\"] = nil, 35, 1, 0},\
  4443. [12] = {\"Insul\", colors.lightGray, colors.magenta, \":\", 0, 0, 0, 100, 0, 293, 0, 0, -1, 0, -1, 0, 0, [\"func\"] = nil, 0, 0, 0},\
  4444. [13] = {\"*Heat\", colors.red, colors.black, \"H\", 0, 0, 0, 100, 100, 293, 0, 0, -1, 0, -1, 0, 0, [\"func\"] = nil, 35, 1, 1},\
  4445. [14] = {\"*Cool\", colors.blue, colors.black, \"C\", 0, 0, 0, 100, 0, 293, 0, 0, -1, 0, -1, 0, 0, [\"func\"] = nil, 0, 0, 2},\
  4446. [15] = {\"Steam\", colors.lightGray, colors.white, \";\", 2, 8, -95, 10, 0, 395, 0, 0, 373, 3, -1, 0, 0, [\"func\"] = nil, 25, 0, 0},\
  4447. [16] = {\" Ice \", colors.cyan, colors.lightBlue, \"o\", 0, 0, 0, 100, 0, 253, 0, 0, -1, 0, 273, 3, 0, [\"func\"] = nil, 50, 0, 0},\
  4448. [17] = {\"Plasm\", colors.magenta, colors.yellow, \"^\", 2, 8, -100, 24, 0, 7595, 20, 5373, 7, 0, -1, 0, 1, [\"func\"] = fire, 40, 0, 0},\
  4449. [18] = {\"Smoke\", colors.gray, colors.black, \"o\", 2, 8, -100, 24, 0, 325, 10, 0, -1, 0, 423, 7, 1, [\"func\"] = death, 40, 0, 0},\
  4450. [19] = {\"CFire\", colors.blue, colors.cyan, \"^\", 2, 8, -100, 24, 0, 10, 20, 0, -1, 0, 173, 0, 1, [\"func\"] = death, 40, 0, 0},\
  4451. [20] = {\"Neutr\", colors.lightBlue, colors.cyan, \".\", 0, 0, 0, 0, 0, 293, 15, -8, -1, 0, -1, 0, 1, [\"func\"] = neutrons, 25, 0, 0},\
  4452. [21] = {\" Lava\", colors.red, colors.orange, \"~\", 2, 8, 95, 30, 0, 2095, 0, 22, 1095, -1, -1, 0, 0, [\"func\"] = ignite, 50, 0, 0},\
  4453. [22] = {\"Stone\", colors.gray, colors.lightGray, \":\", 1, 20, 96, 65, 0, 295, 0, 0, -1, 0, 1100, 21, 0, [\"func\"] = nil, 70, 0, 0},\
  4454. [23] = {\"Metal\", colors.blue, colors.gray, \"X\", 0, 0, 0, 100, 0, 293, 0, 0, -1, 0, 1150, 21, 0, [\"func\"] = nil, 90, 0, 0},\
  4455. [24] = {\" CO2 \", colors.lightGray, colors.gray, \"O\", 1, 20, 15, 10, 0, 295, 0, 0, -1, 0, -1, 0, 1, [\"func\"] = co2, 30, 0, 0},\
  4456. [25] = {\"  H2 \", colors.lightBlue, colors.cyan, \"O\", 2, 0, -1, 5, 0, 295, 0, 0, -1, 0, -1, 0, 1, [\"func\"] = h2, 30, 0, 0},\
  4457. [26] = {\"Clone\", colors.cyan, colors.yellow, \"C\", 0, 0, 0, 100, 0, 293, 0, 0, -1, 0, -1, 0, 0, [\"func\"] = clone, 70, 0, 0},\
  4458. }\
  4459. \
  4460. if debug == true then\
  4461. log(\"CCSand opened in debug mode!\")\
  4462. end\
  4463. \
  4464. local splashes = {\
  4465. \"CC stands for CosmoConsole and ComputerCraft\",\
  4466. \"You need Advanced Computers for this\",\
  4467. \"Try to save & load!\",\
  4468. \"This game doesn't have moving solids\"\
  4469. }\
  4470. \
  4471. \
  4472. statusbar = splashes[math.random(1, #splashes)]\
  4473. \
  4474. \
  4475. if debug then log(\"Searching for Redirect API created by GopherAtl\") end\
  4476. if redirect then\
  4477. buffer=redirect.createRedirectBuffer()\
  4478. if debug then log(\"Redirect buffer enabled\") end\
  4479. else\
  4480. local ok=pcall(os.loadAPI,\"redirect\")\
  4481. if not ok then ok=pcall(os.loadAPI,shell.dir()..\"/redirect\") end\
  4482. if (ok) and (redirect) then\
  4483.  buffer=redirect.createRedirectBuffer()\
  4484.  if debug then log(\"Redirect buffer loaded and enabled\") end\
  4485.  API = true\
  4486. else\
  4487.  if debug then log(\"Redirect buffer not found\") end\
  4488. end\
  4489. term.restore()\
  4490. end\
  4491. term.clear()\
  4492. \
  4493. creationTemp = nil\
  4494. creationCotype = nil\
  4495. creationLife = nil\
  4496. \
  4497. MAX_TEMP = 9999\
  4498. MIN_TEMP = 0\
  4499. \
  4500. \
  4501. \
  4502. --print(\"Press Q to Quit!\")\
  4503. \
  4504. \
  4505. function trim(s)\
  4506.  return (s:gsub(\"^%s*(.-)%s*$\", \"%1\"))\
  4507. end\
  4508. function log2(input)\
  4509. return (math.log(input)/math.log(2))\
  4510. end\
  4511. function round(num, idp)\
  4512.  local mult = 10^(idp or 0)\
  4513.  return math.floor(num * mult + 0.5) / mult\
  4514. end\
  4515. function openMenu()\
  4516. term.setBackgroundColor(colors.brown)\
  4517. term.setTextColor(colors.yellow)\
  4518. term.setCursorPos(47, 19)\
  4519. write(version)\
  4520. term.setBackgroundColor(colors.gray)\
  4521. term.setTextColor(colors.white)\
  4522. menu = true\
  4523. dirty = true\
  4524. end\
  4525. function pause()\
  4526. --write(\"Pause toggled\")\
  4527. paused = not paused\
  4528. end\
  4529. \
  4530. \
  4531. function quit()\
  4532. --term.clear()\
  4533. --term.setCursorPos(5, 5)\
  4534. --print(\"Thank you for playing!\")\
  4535. --print(\"ccSand by CosmoConsole\")\
  4536. --os.sleep(3)\
  4537. term.clear()\
  4538. term.setCursorPos(1, 1)\
  4539. logs.close()\
  4540. on = false\
  4541. end\
  4542. \
  4543. --log(\"CCSand opened.\")\
  4544. grid = {1, 40, 1, 17}\
  4545. --40x17 grid\
  4546. \
  4547. lx = 0\
  4548. ly = 0\
  4549. \
  4550. \
  4551. \
  4552. -- [particle_id] = {id, x, y, type, life, cotype, temp}\
  4553. -- particle 0 to avoid 'nil'\
  4554. particles = {\
  4555. }  --[0] = {0, 0, 0, 0, 0, 0, 0}\
  4556. \
  4557. \
  4558. -- particle ID begins at 1. 0 is air.\
  4559. part_id = 1\
  4560. \
  4561. \
  4562. function getParticleCalled(i)\
  4563. for k, v in pairs(particles) do\
  4564.  if v[1] == i then\
  4565.   return k\
  4566.  end\
  4567. end\
  4568. return 0\
  4569. end\
  4570. function getParticleAt(x,y)\
  4571. for k, v in pairs(particles) do\
  4572.  if v[2] == x then\
  4573.   if v[3] == y then\
  4574.    return k\
  4575.   end\
  4576.  end\
  4577. end\
  4578. return 0\
  4579. end\
  4580. function render2(pt,rx,ry)\
  4581. if rx < grid[1] then return end\
  4582. if rx > grid[2] then return end\
  4583. if ry < grid[3] then return end\
  4584. if ry > grid[4] then return end\
  4585. term.setCursorPos(rx,ry)\
  4586. term.setBackgroundColor(elements[pt][2])\
  4587. term.setTextColor(elements[pt][3])\
  4588. print(elements[pt][4])\
  4589. --buffer[rx[ry]] = {elements[pt][4], elements[pt][2], elements[pt][3]}\
  4590. end\
  4591. function render(rx,ry,part)\
  4592. if part == nil then\
  4593.  p = getParticleAt(rx,ry)\
  4594. else\
  4595.  p = part\
  4596.  rx = part[2]\
  4597.  ry = part[3]\
  4598. end\
  4599. if rx < grid[1] then return end\
  4600. if rx > grid[2] then return end\
  4601. if ry < grid[3] then return end\
  4602. if ry > grid[4] then return end\
  4603. px = particles[p]\
  4604. term.setCursorPos(rx,ry)\
  4605. if px == nil then\
  4606.  px = {0,0,0,0,0,0,0}\
  4607. end\
  4608. term.setBackgroundColor(elements[px[4]][2])\
  4609. term.setTextColor(elements[px[4]][3])\
  4610. print(elements[px[4]][4])\
  4611. end\
  4612. function createParticle(x,y,type,life,cotype,temp)\
  4613. if getParticleAt(x,y) ~= 0 then\
  4614.  return 0\
  4615. end\
  4616. if x == nil then\
  4617.  return 0\
  4618. end\
  4619. if y == nil then\
  4620.  return 0\
  4621. end\
  4622. if type == nil then\
  4623.  return 0\
  4624. end\
  4625. if y > grid[4] then\
  4626.  return 0\
  4627. end\
  4628. if y < grid[3] then\
  4629.  return 0\
  4630. end\
  4631. if x > grid[2] then\
  4632.  return 0\
  4633. end\
  4634. if x < grid[1] then\
  4635.  return 0\
  4636. end\
  4637. if #particles > particleLimit then\
  4638.  return 0\
  4639. end\
  4640. l = elements[type][11]\
  4641. if life ~= nil then l = life end\
  4642. if l < 0 then l = math.random(0 - l) end\
  4643. c = elements[type][12]\
  4644. if cotype ~= nil then c = cotype end\
  4645. if c < 0 then c = math.random(0 - c) end\
  4646. t = elements[type][10]\
  4647. if temp ~= nil then t = temp end\
  4648. i = part_id\
  4649. part_id = part_id + 1\
  4650. if debug == true then\
  4651.  log(\"Creating particle of \" .. type .. \" at \" .. x .. \",\" .. y)\
  4652. end\
  4653. dirty = true\
  4654. render(x, y, table.insert(particles, {i, x, y, type, l, c, t}))\
  4655. return i\
  4656. end\
  4657. function killParticle(i)\
  4658. if particles[i] then\
  4659.  px = particles[i][2]\
  4660.  py = particles[i][3]\
  4661.  if debug == true then\
  4662.   log(\"Killing particle #\" .. particles[i][1] .. \" at \" .. px .. \",\" .. py)\
  4663.  end\
  4664.  if i == ipart then ipart = nil end\
  4665.  table.remove(particles, i)\
  4666.  dirty = true\
  4667.  --render(px,py)\
  4668. end\
  4669. return true\
  4670. end\
  4671. function drawElement(i,x,y)\
  4672. if elements[i] == nil then return end\
  4673. tx = elements[i][3]\
  4674. bx = elements[i][2]\
  4675. if bx == tx then\
  4676.  tx = colors.white\
  4677. end\
  4678. if bx == 256 then\
  4679.  tx = colors.black\
  4680. end\
  4681. if bx < 128 then\
  4682.  tx = colors.black\
  4683. end\
  4684. --log(\"drawElement: tx is \" .. tx .. \" and bx is \" .. bx)\
  4685. term.setBackgroundColor(bx)\
  4686. term.setTextColor(tx)\
  4687. x1, y1 = term.getCursorPos()\
  4688. term.setCursorPos(x,y)\
  4689. write(elements[i][1])\
  4690. term.setBackgroundColor(colors.gray)\
  4691. term.setTextColor(colors.white)\
  4692. term.setCursorPos(x1, y1)\
  4693. end\
  4694. function selectElement(i)\
  4695. if i > (#elements) then return end\
  4696. sel = i\
  4697. drawElement(i,46,17)\
  4698. end\
  4699. function kissa()\
  4700. for i = 1,1000 do\
  4701.  drawElement(math.random(0,#elements),math.random(1,50),math.random(1,17))\
  4702. end\
  4703. end\
  4704. \
  4705. function info(x,y)\
  4706. if y > grid[4] then return end\
  4707. if y < grid[3] then return end\
  4708. if x > grid[2] then return end\
  4709. if x < grid[1] then return end\
  4710. local pxy = getParticleAt(x,y)\
  4711. if pxy ~= 0 then\
  4712.  ipart = particles[pxy]\
  4713. else\
  4714.  ipart = nil\
  4715. end\
  4716. dirty = true\
  4717. end\
  4718. function closeMenu()\
  4719. dirty = true\
  4720. menu = false\
  4721. term.setBackgroundColor(colors.brown)\
  4722. term.setTextColor(colors.yellow)\
  4723. term.setCursorPos(1, 19)\
  4724. write(string.rep(\" \", 51))\
  4725. term.setCursorPos(1, 19)\
  4726. write(\"ccSand by CosmoConsole\")\
  4727. term.setCursorPos(47, 19)\
  4728. write(version)\
  4729. term.setBackgroundColor(colors.gray)\
  4730. term.setTextColor(colors.white)\
  4731. end\
  4732. function drawPage(i)\
  4733. ep = (i * 16) + 1\
  4734. term.setBackgroundColor(colors.gray)\
  4735. term.setTextColor(colors.white)\
  4736. for iterator_a=1,17 do\
  4737.  term.setCursorPos(41,iterator_a) \
  4738.  write(\"           \")\
  4739. end\
  4740. for iterator_a=1,8 do\
  4741.  drawElement(ep,41,iterator_a+3)\
  4742.  ep = ep + 1\
  4743.  drawElement(ep,46,iterator_a+3)\
  4744.  ep = ep + 1\
  4745. end\
  4746. term.setBackgroundColor(colors.lightGray)\
  4747. term.setTextColor(colors.white)\
  4748. term.setCursorPos(42, 2)\
  4749. write(\"<\")\
  4750. term.setCursorPos(49, 2)\
  4751. write(\">\")\
  4752. term.setBackgroundColor(colors.gray)\
  4753. term.setTextColor(colors.white)\
  4754. term.setCursorPos(45, 2)\
  4755. write(\"  \")\
  4756. term.setCursorPos(45, 2)\
  4757. write(page + 1)\
  4758. end\
  4759. function menuToggle()\
  4760. if menu == true then\
  4761.  closeMenu()\
  4762. else\
  4763.  openMenu()\
  4764. end\
  4765. end\
  4766. function particleMove(p1,p2,px,py)\
  4767. pm1 = particles[p1]\
  4768. pm2 = particles[p2]\
  4769. if p2 == 0 then\
  4770.  inGrid = false\
  4771.  if px >= grid[1] then\
  4772.   if px <= grid[2] then\
  4773.    if py >= grid[3] then\
  4774.     if py <= grid[4] then\
  4775.      inGrid = true\
  4776.     end\
  4777.    end\
  4778.   end\
  4779.  end\
  4780.  if inGrid == true then\
  4781.   if particles[p1] == nil then return false end\
  4782.   opx = particles[p1][2]\
  4783.   opy = particles[p1][3]\
  4784.   particles[p1][2] = px\
  4785.   particles[p1][3] = py\
  4786.   render(px,py)\
  4787.   render(opx,opy)\
  4788.   dirty = true\
  4789.   if debug == true then\
  4790.    log(\"Moving particle #\" .. particles[p1][1] .. \" from \" .. opx .. \",\" .. opy .. \" to \" .. px .. \",\" .. py)\
  4791.   end\
  4792.   return true\
  4793.  else\
  4794.   killParticle(p1)\
  4795.   return true\
  4796.  end\
  4797. end\
  4798. return false\
  4799. end\
  4800. function particleSwitch(p1,p2,px,py)\
  4801. pm1 = particles[p1]\
  4802. pm2 = particles[p2]\
  4803. if p2 == 0 then\
  4804.  inGrid = false\
  4805.  if px >= grid[1] then\
  4806.   if px <= grid[2] then\
  4807.    if py >= grid[3] then\
  4808.     if py <= grid[4] then\
  4809.      inGrid = true\
  4810.     end\
  4811.    end\
  4812.   end\
  4813.  end\
  4814.  if inGrid == true then\
  4815.   opx = particles[p1][2]\
  4816.   opy = particles[p1][3]\
  4817.   particles[p1][2] = px\
  4818.   particles[p1][3] = py\
  4819.   render(px,py)\
  4820.   render(opx,opy)\
  4821.   dirty = true\
  4822.   if debug == true then\
  4823.    log(\"Moving particle #\" .. particles[p1][1] .. \" from \" .. opx .. \",\" .. opy .. \" to \" .. px .. \",\" .. py)\
  4824.   end\
  4825.  else\
  4826.   killParticle(p1)\
  4827.  end\
  4828. else\
  4829.  if particles[p2][4] == 4 then\
  4830.   if debug == true then\
  4831.    log(\"VOID: *slurp*\")\
  4832.   end\
  4833.   killParticle(p1)\
  4834.   return\
  4835.  end\
  4836.  --particles[p1][2] = pm2[2]\
  4837.  --particles[p2][2] = pm1[2]\
  4838.  --particles[p1][3] = pm2[3]\
  4839.  --particles[p2][3] = pm1[3]\
  4840.   opx = particles[p2][2]\
  4841.   opy = particles[p2][3]\
  4842.   particles[p2][2] = particles[p1][2]\
  4843.   particles[p2][3] = particles[p1][3]\
  4844.   particles[p1][2] = opx\
  4845.   particles[p1][3] = opy\
  4846.   dirty = true\
  4847.  if debug == true then\
  4848.   log(\"Switching particles between \" .. pm1[2] .. \",\" .. pm1[3] .. \" and \" .. pm2[2] .. \",\" .. pm2[3])\
  4849.  end\
  4850. end\
  4851. end\
  4852. function notYetImplemented()\
  4853. term.setBackgroundColor(colors.brown)\
  4854. term.setTextColor(colors.yellow)\
  4855. term.setCursorPos(1, 19)\
  4856. write(string.rep(\" \", 51))\
  4857. term.setCursorPos(1, 19)\
  4858. write(\"Not yet implemented\")\
  4859. term.setCursorPos(47, 19)\
  4860. write(version)\
  4861. term.setBackgroundColor(colors.gray)\
  4862. term.setTextColor(colors.white)\
  4863. end\
  4864. function rect(xa,ya,xb,yb)\
  4865. if not (xa and xb and ya and yb) then\
  4866.  return\
  4867. end\
  4868. local dp = 0\
  4869. for xi=xa,xb do\
  4870.  for yi=ya,yb do\
  4871.   if elements[sel][20] == 0 then\
  4872.    createParticle(p2,p3,sel,creationLife,creationCotype,creationTemp)\
  4873.   elseif elements[sel][20] == 1 then\
  4874.    if getParticleAt(p2,p3) ~= 0 then particles[getParticleAt(p2,p3)][7] = math.min(particles[getParticleAt(p2,p3)][7] + 5, MAX_TEMP) end\
  4875.   elseif elements[sel][20] == 2 then\
  4876.    if getParticleAt(p2,p3) ~= 0 then particles[getParticleAt(p2,p3)][7] = math.max(particles[getParticleAt(p2,p3)][7] - 5, MIN_TEMP) end\
  4877.   end\
  4878.   dp = dp + 1\
  4879.  end\
  4880. end \
  4881. return xa .. \"-\" .. xb .. \",\" .. ya .. \"-\" .. yb .. \";\" .. dp .. \" vs \" .. (((xb - xa) + 1) * ((yb - ya) + 1))\
  4882. end\
  4883. function arect(xa,ya,xb,yb)\
  4884. if not (xa and xb and ya and yb) then\
  4885.  return\
  4886. end\
  4887. local dp = 0\
  4888. for xi=xa,xb do\
  4889.  for yi=ya,yb do\
  4890.   createParticle(xi, yi, 0)\
  4891.   dp = dp + 1\
  4892.  end\
  4893. end\
  4894. return xa .. \"-\" .. xb .. \",\" .. ya .. \"-\" .. yb .. \";\" .. dp .. \" vs \" .. (((xb - xa) + 1) * ((yb - ya) + 1))\
  4895. end\
  4896. function setStatus(sx)\
  4897. textReset = os.startTimer(5)\
  4898. statusbar = string.sub(sx, 1, 51)\
  4899. dirty = true\
  4900. end\
  4901. local fileEngine = nil\
  4902. local fileName = nil\
  4903. local serid = nil\
  4904. function saveAt()\
  4905. fileEngine = fs.open(fileName, \"w\")\
  4906. fileEngine.write(serid)\
  4907. fileEngine.close()\
  4908. fileEngine = nil\
  4909. end\
  4910. function loadAt()\
  4911. fileEngine = fs.open(fileName, \"r\")\
  4912. particles = textutils.unserialize(fileEngine.readAll())\
  4913. fileEngine.close()\
  4914. fileEngine = nil\
  4915. end\
  4916. function save()\
  4917. term.setCursorPos(1, 18)\
  4918. term.setBackgroundColor(colors.brown)\
  4919. term.setTextColor(colors.yellow)\
  4920. write(string.rep(\" \", 51))\
  4921. term.setCursorPos(1, 18)\
  4922. sleep(0.5)\
  4923. write(\">\")\
  4924. cons = read()\
  4925. closeMenu()\
  4926. if trim(cons) == \"\" then\
  4927.  redraw()\
  4928.  timeout = os.startTimer(0) \
  4929.  return\
  4930. end\
  4931. fileName = cons\
  4932. ok = true\
  4933. serid = textutils.serialize(particles)\
  4934. --ok, err = pcall(setFileEngineWrite)\
  4935. ok, err = pcall(saveAt)\
  4936. if ok then\
  4937.  setStatus(\"Successfully saved\")\
  4938. else\
  4939.  if err then setStatus(tostring(err)) end\
  4940. end\
  4941. timeout = os.startTimer(0) \
  4942. end\
  4943. function load()\
  4944. term.setCursorPos(1, 18)\
  4945. term.setBackgroundColor(colors.brown)\
  4946. term.setTextColor(colors.yellow)\
  4947. write(string.rep(\" \", 51))\
  4948. term.setCursorPos(1, 18)\
  4949. sleep(0.5)\
  4950. write(\">\")\
  4951. cons = read()\
  4952. closeMenu()\
  4953. dirty = true\
  4954. if trim(cons) == \"\" then\
  4955.  redraw()\
  4956.  timeout = os.startTimer(0) \
  4957.  return\
  4958. end\
  4959. fileName = cons\
  4960. ok = true\
  4961. --ok, err = pcall(setFileEngineRead)\
  4962. ok, err = pcall(loadAt)\
  4963. if ok then\
  4964.  setStatus(\"Successfully loaded\")\
  4965. else\
  4966.  if err then setStatus(tostring(err)) end\
  4967. end\
  4968. timeout = os.startTimer(0) \
  4969. end\
  4970. function clear()\
  4971. particles = {}\
  4972. term.setBackgroundColor(colors.black)\
  4973. term.setTextColor(colors.white)\
  4974. for i = 1,16 do\
  4975.  term.setCursorPos(1,i)\
  4976.  write(string.rep(\" \", 40))\
  4977. end\
  4978. term.setBackgroundColor(colors.gray)\
  4979. term.setTextColor(colors.white)\
  4980. closeMenu()\
  4981. end\
  4982. function mquit()\
  4983. if menu == true then\
  4984.  quit()\
  4985. end\
  4986. end\
  4987. function mload()\
  4988. if menu == true then\
  4989.  load()\
  4990. end\
  4991. end\
  4992. function msave()\
  4993. if menu == true then\
  4994.  save()\
  4995. end\
  4996. end\
  4997. function mclear()\
  4998. if menu == true then\
  4999.  clear()\
  5000. end\
  5001. end\
  5002. function redraw()\
  5003. if debug then log(\"Can I redraw now?\") end\
  5004. if buffer.isBuffer then term.redirect(buffer) end\
  5005. term.setBackgroundColor(colors.black)\
  5006. term.setTextColor(colors.white)\
  5007. if debug then log(\"Redraw: Clearing buffer\") end\
  5008. for i = 1,17 do\
  5009.  term.setCursorPos(1,i)\
  5010.  write(string.rep(\" \", 40))\
  5011. end\
  5012. if debug then log(\"Redraw: Buffer clear. Starting particle render.\") end\
  5013. for k, v in ipairs(particles) do\
  5014.  render2(v[4], v[2], v[3])\
  5015. end\
  5016. term.setBackgroundColor(colors.brown)\
  5017. term.setTextColor(colors.yellow)\
  5018. term.setCursorPos(1, 19)\
  5019. write(string.rep(\" \", 51))\
  5020. term.setCursorPos(1, 19)\
  5021. write(statusbar)\
  5022. term.setBackgroundColor(colors.gray)\
  5023. term.setTextColor(colors.white)\
  5024. term.setCursorPos(1, 18)\
  5025. write(string.rep(\" \", 51))\
  5026. term.setCursorPos(11, 18)\
  5027. write(\"[MENU]\")\
  5028. drawPage(page)\
  5029. drawElement(sel,46,17)\
  5030. if debug then log(\"Redraw: Rendered particles.\") end\
  5031. if menu == true then\
  5032.  term.setBackgroundColor(colors.brown)\
  5033.  term.setTextColor(colors.yellow)\
  5034.  term.setCursorPos(1, 19)\
  5035.  write(string.rep(\" \", 51))\
  5036.  term.setCursorPos(1, 19)\
  5037.  write(\"[EN]Quit  [L]oad  [S]ave  [C]lear\")\
  5038.  term.setBackgroundColor(colors.gray)\
  5039.  term.setTextColor(colors.white)\
  5040. end\
  5041. if ipart == nil then\
  5042.  drawElement(0,41,17)\
  5043.  term.setCursorPos(41,16)\
  5044.  print(\"                 \")\
  5045. else\
  5046.  drawElement(ipart[4],41,17)\
  5047.  term.setCursorPos(41,16)\
  5048.  print(\"                 \")\
  5049.  term.setCursorPos(41,16)\
  5050.  print(ipart[5])\
  5051.  term.setCursorPos(46,16) \
  5052.  print(ipart[6])\
  5053.  term.setCursorPos(41,18)\
  5054.  print(\"          \") \
  5055.  term.setCursorPos(41,18) \
  5056.  print((ipart[7] - 273.15) .. \" C\")\
  5057. end\
  5058. term.setBackgroundColor(colors.gray)\
  5059. term.setTextColor(colors.white)\
  5060. if buffer.isBuffer then\
  5061.  if debug then log(\"Buffering.\") end\
  5062.  term.restore()\
  5063.  buffer.blit()\
  5064. end\
  5065. dirty = false\
  5066. end\
  5067. function setPage(i)\
  5068. if i == -1 then\
  5069.  i = 15\
  5070. end\
  5071. page = i % 16f\
  5072. drawPage(i % 16)\
  5073. end\
  5074. function nextPage()\
  5075. setPage(page + 1)\
  5076. end\
  5077. function previousPage()\
  5078. setPage(page - 1)\
  5079. end\
  5080. \
  5081. timeout = os.startTimer(0.1)\
  5082. \
  5083. function explode(x, y)\
  5084. local part\
  5085. if getParticleAt(x-1,y) ~= 0 then\
  5086.  part = getParticleAt(x-1,y)\
  5087.  particles[part][7] = particles[part][7] + 40\
  5088.  particleMove(part,0,x-2,y)\
  5089.  particleMove(part,0,x-1,y-1)\
  5090.  particleMove(part,0,x-1,y+1)\
  5091. end\
  5092. if getParticleAt(x+1,y) ~= 0 then\
  5093.  part = getParticleAt(x+1,y)\
  5094.  particles[part][7] = particles[part][7] + 40\
  5095.  particleMove(part,0,x+2,y)\
  5096.  particleMove(part,0,x+1,y-1)\
  5097.  particleMove(part,0,x+1,y+1)\
  5098. end\
  5099. if getParticleAt(x,y-1) ~= 0 then\
  5100.  part = getParticleAt(x,y-1)\
  5101.  particles[part][7] = particles[part][7] + 40\
  5102.  particleMove(part,0,x,y-2)\
  5103.  particleMove(part,0,x+1,y-1)\
  5104.  particleMove(part,0,x-1,y-1)\
  5105. end\
  5106. if getParticleAt(x,y+1) ~= 0 then\
  5107.  part = getParticleAt(x,y+1)\
  5108.  particles[part][7] = particles[part][7] + 40\
  5109.  particleMove(part,0,x,y+2)\
  5110.  particleMove(part,0,x+1,y+1)\
  5111.  particleMove(part,0,x-1,y+1)\
  5112. end\
  5113. end\
  5114. \
  5115. function clone(p, k, x, y)\
  5116. if getParticleAt(x-1,y) ~= 0 then\
  5117.  if p[6] == 0 then\
  5118.   if particles[getParticleAt(x-1,y)][4] ~= 26 then\
  5119.    particles[k][6] = particles[getParticleAt(x-1,y)][4]\
  5120.   end\
  5121.  end\
  5122. end\
  5123. if p[6] ~= 0 then\
  5124.  if math.random(1,2) == 1 then createParticle(x-1, y, p[6]) end\
  5125.  if math.random(1,2) == 1 then createParticle(x+1, y, p[6]) end\
  5126.  if math.random(1,2) == 1 then createParticle(x-1, y+1, p[6]) end\
  5127.  if math.random(1,2) == 1 then createParticle(x+1, y+1, p[6]) end\
  5128.  if math.random(1,2) == 1 then createParticle(x-1, y-1, p[6]) end\
  5129.  if math.random(1,2) == 1 then createParticle(x+1, y-1, p[6]) end\
  5130.  if math.random(1,2) == 1 then createParticle(x, y-1, p[6]) end\
  5131.  if math.random(1,2) == 1 then createParticle(x, y+1, p[6]) end\
  5132. end\
  5133. end\
  5134. function co2(p, k, x, y)\
  5135. if getParticleAt(x-1,y) ~= 0 then\
  5136.  if particles[getParticleAt(x-1,y)][4] == 7 then\
  5137.   killParticle(getParticleAt(x-1,y))\
  5138.  end\
  5139. end\
  5140. if getParticleAt(x+1,y) ~= 0 then\
  5141.  if particles[getParticleAt(x+1,y)][4] == 7 then\
  5142.   killParticle(getParticleAt(x+1,y))\
  5143.  end\
  5144. end\
  5145. if getParticleAt(x,y-1) ~= 0 then\
  5146.  if particles[getParticleAt(x,y-1)][4] == 7 then\
  5147.   killParticle(getParticleAt(x,y-1))\
  5148.  end\
  5149. end\
  5150. if getParticleAt(x,y+1) ~= 0 then\
  5151.  if particles[getParticleAt(x,y+1)][4] == 7 then\
  5152.   killParticle(getParticleAt(x,y+1))\
  5153.  end\
  5154. end\
  5155. gas_movement(p, k, x, y)\
  5156. end\
  5157. \
  5158. function gas_movement(p, k, x, y)\
  5159. local m = math.random(1, 5)\
  5160. if m == 1 then particleMove(k, getParticleAt(x-1,y), x-1, y) end\
  5161. if m == 2 then particleMove(k, getParticleAt(x+1,y), x+1, y) end\
  5162. if m == 3 then particleMove(k, getParticleAt(x,y-1), x, y-1) end\
  5163. if m == 4 then particleMove(k, getParticleAt(x,y+1), x, y+1) end\
  5164. end\
  5165. function ignite(p, k, x, y)\
  5166. if getParticleAt(x-1,y) ~= 0 then\
  5167.  if elements[particles[getParticleAt(x-1,y)][4]][9] ~= 0 then\
  5168.   if elements[particles[getParticleAt(x-1,y)][4]][9] >= math.random(100) then\
  5169.    killParticle(getParticleAt(x-1,y))\
  5170.    createParticle(x-1,y,7)\
  5171.    if elements[particles[getParticleAt(x-1,y)][4]][19] ~= 0 then\
  5172.     explode(x-1,y)\
  5173.    end\
  5174.   end\
  5175.  end\
  5176. end\
  5177. if getParticleAt(x+1,y) ~= 0 then\
  5178.  if elements[particles[getParticleAt(x+1,y)][4]][9] ~= 0 then\
  5179.   if elements[particles[getParticleAt(x+1,y)][4]][9] >= math.random(100) then\
  5180.    killParticle(getParticleAt(x+1,y))\
  5181.    createParticle(x+1,y,7)\
  5182.    if elements[particles[getParticleAt(x+1,y)][4]][19] ~= 0 then\
  5183.     explode(x+1,y)\
  5184.    end\
  5185.   end\
  5186.  end\
  5187. end\
  5188. if getParticleAt(x,y-1) ~= 0 then\
  5189.  if elements[particles[getParticleAt(x,y-1)][4]][9] ~= 0 then\
  5190.   if elements[particles[getParticleAt(x,y-1)][4]][9] >= math.random(100) then\
  5191.    killParticle(getParticleAt(x,y-1))\
  5192.    createParticle(x,y-1,7)\
  5193.    if elements[particles[getParticleAt(x,y-1)][4]][19] ~= 0 then\
  5194.     explode(x,y-1)\
  5195.    end\
  5196.   end\
  5197.  end\
  5198. end\
  5199. if getParticleAt(x,y+1) ~= 0 then\
  5200.  if elements[particles[getParticleAt(x,y+1)][4]][9] ~= 0 then\
  5201.   if elements[particles[getParticleAt(x,y+1)][4]][9] >= math.random(100) then\
  5202.    killParticle(getParticleAt(x,y+1))\
  5203.    createParticle(x,y+1,7)\
  5204.    if elements[particles[getParticleAt(x,y+1)][4]][19] ~= 0 then\
  5205.     explode(x,y+1)\
  5206.    end\
  5207.   end\
  5208.  end\
  5209. end\
  5210. end\
  5211. function fire(p, k, x, y)\
  5212. if getParticleAt(x-1,y) ~= 0 then\
  5213.  if elements[particles[getParticleAt(x-1,y)][4]][9] ~= 0 then\
  5214.   if elements[particles[getParticleAt(x-1,y)][4]][9] >= math.random(100) then\
  5215.    killParticle(getParticleAt(x-1,y))\
  5216.    createParticle(x-1,y,7)\
  5217.    if elements[particles[getParticleAt(x-1,y)][4]][19] ~= 0 then\
  5218.     explode(x-1,y)\
  5219.    end\
  5220.   end\
  5221.  end\
  5222. end\
  5223. if getParticleAt(x+1,y) ~= 0 then\
  5224.  if elements[particles[getParticleAt(x+1,y)][4]][9] ~= 0 then\
  5225.   if elements[particles[getParticleAt(x+1,y)][4]][9] >= math.random(100) then\
  5226.    killParticle(getParticleAt(x+1,y))\
  5227.    createParticle(x+1,y,7)\
  5228.    if elements[particles[getParticleAt(x+1,y)][4]][19] ~= 0 then\
  5229.     explode(x+1,y)\
  5230.    end\
  5231.   end\
  5232.  end\
  5233. end\
  5234. if getParticleAt(x,y-1) ~= 0 then\
  5235.  if elements[particles[getParticleAt(x,y-1)][4]][9] ~= 0 then\
  5236.   if elements[particles[getParticleAt(x,y-1)][4]][9] >= math.random(100) then\
  5237.    killParticle(getParticleAt(x,y-1))\
  5238.    createParticle(x,y-1,7)\
  5239.    if elements[particles[getParticleAt(x,y-1)][4]][19] ~= 0 then\
  5240.     explode(x,y-1)\
  5241.    end\
  5242.   end\
  5243.  end\
  5244. end\
  5245. if getParticleAt(x,y+1) ~= 0 then\
  5246.  if elements[particles[getParticleAt(x,y+1)][4]][9] ~= 0 then\
  5247.   if elements[particles[getParticleAt(x,y+1)][4]][9] >= math.random(100) then\
  5248.    killParticle(getParticleAt(x,y+1))\
  5249.    createParticle(x,y+1,7)\
  5250.    if elements[particles[getParticleAt(x,y+1)][4]][19] ~= 0 then\
  5251.     explode(x,y+1)\
  5252.    end\
  5253.   end\
  5254.  end\
  5255. end\
  5256. death(p, k, x, y)\
  5257. end\
  5258. function seri()\
  5259. log(textutils.serialize(particles))\
  5260. end\
  5261. function h2(p, k, x, y)\
  5262. local igni = false\
  5263. if getParticleAt(x-1,y) ~= 0 then\
  5264.  if particles[getParticleAt(x-1,y)][4] == 7 then\
  5265.   igni = true\
  5266.  end\
  5267. end\
  5268. if getParticleAt(x+1,y) ~= 0 then\
  5269.  if particles[getParticleAt(x+1,y)][4] == 7 then\
  5270.   igni = true\
  5271.  end\
  5272. end\
  5273. if getParticleAt(x,y-1) ~= 0 then\
  5274.  if particles[getParticleAt(x,y-1)][4] == 7 then\
  5275.   igni = true\
  5276.  end\
  5277. end\
  5278. if getParticleAt(x,y+1) ~= 0 then\
  5279.  if particles[getParticleAt(x,y+1)][4] == 7 then\
  5280.   igni = true\
  5281.  end\
  5282. end\
  5283. if igni then\
  5284.  killParticle(k)\
  5285.  createParticle(x, y, 7, nil, 15, nil)\
  5286. end\
  5287. if particles[k] then gas_movement(p, k, x, y) end\
  5288. end\
  5289. function neutrons(p, k, x, y)\
  5290. if (particles[k]) then\
  5291.  if (p[6] == 1) then\
  5292.   if particleMove(k, getParticleAt(x,y-1), x, y - 1) == false then\
  5293.    particles[k][6] = math.random(1,8)\
  5294.   end\
  5295.  elseif (p[6] == 2) then\
  5296.   if particleMove(k, getParticleAt(x,y+1), x, y + 1) == false then\
  5297.    particles[k][6] = math.random(1,8)\
  5298.   end\
  5299.  elseif (p[6] == 3) then\
  5300.   if particleMove(k, getParticleAt(x-1,y+1), x - 1, y + 1) == false then\
  5301.    particles[k][6] = math.random(1,8)\
  5302.   end\
  5303.  elseif (p[6] == 4) then\
  5304.   if particleMove(k, getParticleAt(x-1,y), x - 1, y) == false then\
  5305.    particles[k][6] = math.random(1,8)\
  5306.   end\
  5307.  elseif (p[6] == 5) then\
  5308.   if particleMove(k, getParticleAt(x-1,y), x - 1, y - 1) == false then\
  5309.    particles[k][6] = math.random(1,8)\
  5310.   end\
  5311.  elseif (p[6] == 6) then\
  5312.   if particleMove(k, getParticleAt(x+1,y - 1), x + 1, y - 1) == false then\
  5313.    particles[k][6] = math.random(1,8)\
  5314.   end\
  5315.  elseif (p[6] == 7) then\
  5316.   if particleMove(k, getParticleAt(x+1,y), x + 1, y) == false then\
  5317.    particles[k][6] = math.random(1,8)\
  5318.   end\
  5319.  elseif (p[6] == 8) then\
  5320.   if particleMove(k, getParticleAt(x+1,y+1), x + 1, y + 1) == false then\
  5321.    particles[k][6] = math.random(1,8)\
  5322.   end\
  5323.  end\
  5324. end \
  5325. if (particles[k]) then death(p, k, x, y) end\
  5326. end\
  5327. function death(p, k, x, y)\
  5328. particles[k][5] = p[5] - 1\
  5329. if particles[k] then\
  5330.  if particles[k][5] == 0 then\
  5331.   if particles[k][4] == 7 then\
  5332.    if particles[k][6] == 15 then\
  5333.     if particles[k] then killParticle(k) end\
  5334.     createParticle(x, y, 15)\
  5335.    else\
  5336.     if particles[k] then killParticle(k) end\
  5337.     createParticle(x, y, 18)\
  5338.    end\
  5339.   else\
  5340.    killParticle(k)\
  5341.   end\
  5342.  end\
  5343. end\
  5344. end\
  5345. \
  5346. redraw()\
  5347. \
  5348. function temp_conduct(k)\
  5349. local sides = 0\
  5350. local top = false\
  5351. local bottom = false\
  5352. local left = false\
  5353. local right = false\
  5354. local ot = particles[k][7]\
  5355. local x = particles[k][2]\
  5356. local y = particles[k][3]\
  5357. local cond = {0, 0, 0, 0} --udlr\
  5358. if getParticleAt(x,y-1) ~= 0 then\
  5359.  up = true\
  5360.  sides = sides + 1\
  5361.  cond[1] = math.min(elements[particles[getParticleAt(x,y-1)][4]][18], elements[particles[getParticleAt(x,y)][4]][18])\
  5362. end\
  5363. if getParticleAt(x,y+1) ~= 0 then\
  5364.  down = true\
  5365.  sides = sides + 1\
  5366.  cond[2] = math.min(elements[particles[getParticleAt(x,y+1)][4]][18], elements[particles[getParticleAt(x,y)][4]][18])\
  5367. end\
  5368. if getParticleAt(x-1,y) ~= 0 then\
  5369.  left = true\
  5370.  sides = sides + 1\
  5371.  cond[3] = math.min(elements[particles[getParticleAt(x-1,y)][4]][18], elements[particles[getParticleAt(x,y)][4]][18])\
  5372. end\
  5373. if getParticleAt(x+1,y) ~= 0 then\
  5374.  right = true\
  5375.  sides = sides + 1\
  5376.  cond[4] = math.min(elements[particles[getParticleAt(x+1,y)][4]][18], elements[particles[getParticleAt(x,y)][4]][18])\
  5377. end\
  5378. if sides > 0 then\
  5379.  for iter = 1,4 do\
  5380.   cond[iter] = cond[iter] / (sides + 1)\
  5381.   cond[iter] = cond[iter] * 1.5\
  5382.  end\
  5383. end\
  5384. if cond[1] > 0 then\
  5385.  local rt = particles[getParticleAt(x,y-1)][7]\
  5386.  local tt = (ot + rt) / 2\
  5387.  local oto = tt - ot\
  5388.  local rto = tt - rt\
  5389.  oto = oto / cond[1]\
  5390.  rto = rto / cond[1]\
  5391.  particles[getParticleAt(x,y)][7] = round(ot + oto, 2)\
  5392.  particles[getParticleAt(x,y-1)][7] = round(rt + rto, 2)\
  5393. end\
  5394. if cond[2] > 0 then\
  5395.  local rt = particles[getParticleAt(x,y+1)][7]\
  5396.  local tt = (ot + rt) / 2\
  5397.  local oto = tt - ot\
  5398.  local rto = tt - rt\
  5399.  oto = oto / cond[2]\
  5400.  rto = rto / cond[2]\
  5401.  particles[getParticleAt(x,y)][7] = round(ot + oto, 2)\
  5402.  particles[getParticleAt(x,y+1)][7] = round(rt + rto, 2)\
  5403. end\
  5404. if cond[3] > 0 then\
  5405.  local rt = particles[getParticleAt(x-1,y)][7]\
  5406.  local tt = (ot + rt) / 2\
  5407.  local oto = tt - ot\
  5408.  local rto = tt - rt\
  5409.  oto = oto / cond[3]\
  5410.  rto = rto / cond[3]\
  5411.  particles[getParticleAt(x,y)][7] = round(ot + oto, 2)\
  5412.  particles[getParticleAt(x-1,y)][7] = round(rt + rto, 2)\
  5413. end\
  5414. if cond[4] > 0 then\
  5415.  local rt = particles[getParticleAt(x+1,y)][7]\
  5416.  local tt = (ot + rt) / 2\
  5417.  local oto = tt - ot\
  5418.  local rto = tt - rt\
  5419.  oto = oto / cond[4]\
  5420.  rto = rto / cond[4]\
  5421.  particles[getParticleAt(x,y)][7] = round(ot + oto, 2)\
  5422.  particles[getParticleAt(x+1,y)][7] = round(rt + rto, 2)\
  5423. end\
  5424. end\
  5425. \
  5426. buttons = {\
  5427. [1] = {11, 16, 18, 18, \" Menu \", menuToggle, true},\
  5428. [2] = {1, 6, 18, 18, \"  ||  \", pause, true},\
  5429. [3] = {41, 45, 4, 4, \"elem01\", function () return selectElement((page * 16) + 1) end, true},\
  5430. [4] = {46, 50, 4, 4, \"elem02\", function () return selectElement((page * 16) + 2) end, true},\
  5431. [5] = {41, 45, 5, 5, \"elem03\", function () return selectElement((page * 16) + 3) end, true},\
  5432. [6] = {46, 50, 5, 5, \"elem04\", function () return selectElement((page * 16) + 4) end, true},\
  5433. [7] = {41, 45, 6, 6, \"elem05\", function () return selectElement((page * 16) + 5) end, true},\
  5434. [8] = {46, 50, 6, 6, \"elem06\", function () return selectElement((page * 16) + 6) end, true},\
  5435. [9] = {41, 45, 7, 7, \"elem07\", function () return selectElement((page * 16) + 7) end, true},\
  5436. [10] = {46, 50, 7, 7, \"elem08\", function () return selectElement((page * 16) + 8) end, true},\
  5437. [11] = {41, 45, 8, 8, \"elem09\", function () return selectElement((page * 16) + 9) end, true},\
  5438. [12] = {46, 50, 8, 8, \"elem0a\", function () return selectElement((page * 16) + 10) end, true},\
  5439. [13] = {41, 45, 9, 9, \"elem0b\", function () return selectElement((page * 16) + 11) end, true},\
  5440. [14] = {46, 50, 9, 9, \"elem0c\", function () return selectElement((page * 16) + 12) end, true},\
  5441. [15] = {41, 45, 10, 10, \"elem0d\", function () return selectElement((page * 16) + 13) end, true},\
  5442. [16] = {46, 50, 10, 10, \"elem0e\", function () return selectElement((page * 16) + 14) end, true},\
  5443. [17] = {41, 45, 11, 11, \"elem0f\", function () return selectElement((page * 16) + 15) end, true},\
  5444. [18] = {46, 50, 11, 11, \"elem10\", function () return selectElement((page * 16) + 16) end, true},\
  5445. [19] = {1, 8, 19, 19, \"quit\", mquit, true},\
  5446. [20] = {11, 16, 19, 19, \"load\", mload, true},\
  5447. [21] = {19, 24, 19, 19, \"save\", msave, true},\
  5448. [22] = {26, 32, 19, 19, \"clear\", mclear, true},\
  5449. [23] = {42, 42, 2, 2, \"pprev\", previousPage, true},\
  5450. [24] = {49, 49, 2, 2, \"pnext\", nextPage, true}\
  5451. }\
  5452. \
  5453. function simulate()\
  5454. xParticles = particles\
  5455. for k, v in ipairs(xParticles) do\
  5456.  temp_conduct(k)\
  5457.  e = elements[v[4]]\
  5458.  continue = false\
  5459.  if e[13] ~= -1 then\
  5460.   if particles[k][7] <= e[13] then\
  5461.    killParticle(k)\
  5462.    if e[14] == -1 then\
  5463.     createParticle(v[2], v[3], v[6], v[5], 0, v[7])\
  5464.    else\
  5465.     createParticle(v[2], v[3], e[14], v[5], v[6], v[7])\
  5466.    end\
  5467.    continue = true\
  5468.   end\
  5469.  end\
  5470.  if e[15] ~= -1 then\
  5471.   if particles[k][7] >= e[15] then\
  5472.    killParticle(k)\
  5473.    if e[16] == 21 then\
  5474.     createParticle(v[2], v[3], e[16], v[5], v[4], v[7])\
  5475.    else\
  5476.     createParticle(v[2], v[3], e[16], v[5], v[6], v[7])\
  5477.    end\
  5478.    continue = true\
  5479.   end\
  5480.  end\
  5481.  if continue == false then\
  5482.  if e[5] ~= 0 then\
  5483.   --Should move\
  5484.   grav = e[7]\
  5485.   spr = e[6]\
  5486.   px = v[2]\
  5487.   py = v[3]\
  5488.   gf = math.floor(grav / 100)\
  5489.   gp = grav % 100\
  5490.   if gp >= math.random(100) then\
  5491.    gf = gf + 1\
  5492.   end\
  5493.   gstep = -1\
  5494.   sgf = 1\
  5495.   if grav < 0 then\
  5496.    gstep = 1\
  5497.    sgf = -1\
  5498.   end\
  5499.   spread = false\
  5500.   if spr >= math.random(100) then\
  5501.    spread = true\
  5502.   end\
  5503.   if grav ~= 0 then\
  5504.    --Can move down? If yes, then do it and ignore the rest.\
  5505.    canGoDown = gf\
  5506.    for i=gf,sgf,gstep do\
  5507.     if getParticleAt(px,py+i) ~= 0 then\
  5508.      if (elements[particles[getParticleAt(px,py+i)][4]][17] == 0) and (elements[particles[getParticleAt(px,py+i)][4]][8] >= e[8]) then\
  5509.       canGoDown = (i + gstep)\
  5510.      end\
  5511.     end\
  5512.    end\
  5513.    if canGoDown ~= 0 then\
  5514.     sp = 0\
  5515.     if spread then\
  5516.      sp = math.random(2)\
  5517.      if sp == 2 then\
  5518.       sp = -1\
  5519.      end\
  5520.     end\
  5521.     if getParticleAt(px+sp,py+canGoDown) ~= 0 then\
  5522.      if (elements[particles[getParticleAt(px+sp,py+canGoDown)][4]][17] == 0) then\
  5523.       sp = 0\
  5524.      end\
  5525.     end\
  5526.     --particleSwitch call: particle 1 table ID, particle 2 table ID, where particle 1 tries to move (X), where particle 1 tries to move (Y)\
  5527.     if (sp ~= 0) and (canGoDown ~= 0) then\
  5528.      particleSwitch(k, getParticleAt(px+sp,py+canGoDown), px+sp, py+canGoDown)\
  5529.     end\
  5530.    else\
  5531.     --Okay, it cannot go down, how about diagonals? (1px left/right and 1px down).\
  5532.     --First, can it go down-left diagonally?\
  5533.     canGoDL = true\
  5534.     if getParticleAt(px-1,py+sgf) ~= 0 then\
  5535.      if (elements[particles[getParticleAt(px-1,py+sgf)][4]][17] == 0) and (elements[particles[getParticleAt(px-1,py+sgf)][4]][8] >= e[8]) then\
  5536.       canGoDL = false\
  5537.      end\
  5538.     end\
  5539.     canGoDR = true\
  5540.     if getParticleAt(px+1,py+sgf) ~= 0 then\
  5541.      if (elements[particles[getParticleAt(px+1,py+sgf)][4]][17] == 0) and (elements[particles[getParticleAt(px+1,py+sgf)][4]][8] >= e[8]) then\
  5542.       canGoDR = false\
  5543.      end\
  5544.     end\
  5545.     if (canGoDR) and (canGoDL) then\
  5546.      dir = math.random(1,2)\
  5547.      if dir == 1 then\
  5548.       particleSwitch(k, getParticleAt(px+1,py+sgf), px+1, py+sgf)\
  5549.      elseif dir == 2 then\
  5550.       particleSwitch(k, getParticleAt(px-1,py+sgf), px-1, py+sgf)\
  5551.      end\
  5552.     elseif (canGoDR) or (canGoDL) then\
  5553.      if canGoDR == true then particleSwitch(k, getParticleAt(px+1,py+sgf), px+1, py+sgf) end\
  5554.      if canGoDL == true then particleSwitch(k, getParticleAt(px-1,py+sgf), px-1, py+sgf) end\
  5555.     elseif (canGoDR == false) and (canGoDL == false) then\
  5556.      --How about left/right (not down)? (Liquids only)\
  5557.      if e[5] == 2 then\
  5558.       canGoLeft = true\
  5559.       canGoRight = true\
  5560.       if getParticleAt(px-1,py) ~= 0 then\
  5561.        if elements[particles[getParticleAt(px-1,py)][4]][17] == 0 then\
  5562.         canGoLeft = false\
  5563.        end\
  5564.       end\
  5565.       if getParticleAt(px+1,py) ~= 0 then\
  5566.        if elements[particles[getParticleAt(px+1,py)][4]][17] == 0 then\
  5567.         canGoRight = false\
  5568.        end\
  5569.       end\
  5570.       if (canGoLeft) and (canGoRight) then\
  5571.        dir = math.random(1,2)\
  5572.        if dir == 1 then\
  5573.         particleMove(k, getParticleAt(px-1,py), px-1, py)\
  5574.        elseif dir == 2 then\
  5575.         particleMove(k, getParticleAt(px+1,py), px+1, py)\
  5576.        end\
  5577.       else\
  5578.        if canGoLeft then particleSwitch(k, getParticleAt(px-1,py), px-1, py) end\
  5579.        if canGoRight then particleSwitch(k, getParticleAt(px+1,py), px+1, py) end\
  5580.       end\
  5581.      end\
  5582.     end\
  5583.    end\
  5584.    end\
  5585.   end\
  5586.  end\
  5587.  if e[\"func\"] then\
  5588.   --they get particle data, it's key, then X and Y\
  5589.   if debug == true then\
  5590.    log(\"Reached element function\")\
  5591.   end\
  5592.   if particles[k] then\
  5593.    e[\"func\"](v, k, v[2], v[3])\
  5594.   end\
  5595.  end\
  5596.  if particles[k] then\
  5597.   if v[4] == 0 then \
  5598.    killParticle(k) \
  5599.   end\
  5600.  end \
  5601. end\
  5602. end\
  5603. function setLife(i)\
  5604. local pc = getParticleAt(lx,ly)\
  5605. if pc == 0 then\
  5606.  return\
  5607. end\
  5608. if lx == 0 then\
  5609.  return\
  5610. end\
  5611. if ly == 0 then\
  5612.  return\
  5613. end\
  5614. particles[pc][5] = i\
  5615. end\
  5616. function setCotype(i)\
  5617. local pc = getParticleAt(lx,ly)\
  5618. if pc == 0 then\
  5619.  return\
  5620. end\
  5621. if lx == 0 then\
  5622.  return\
  5623. end\
  5624. if ly == 0 then\
  5625.  return\
  5626. end\
  5627. particles[pc][6] = i\
  5628. end\
  5629. function heat(i)\
  5630. local pc = getParticleAt(lx,ly)\
  5631. if pc == 0 then\
  5632.  return\
  5633. end\
  5634. if lx == 0 then\
  5635.  return\
  5636. end\
  5637. if ly == 0 then\
  5638.  return\
  5639. end\
  5640. particles[pc][7] = math.min(particles[pc][7] + i, MAX_TEMP)\
  5641. end\
  5642. function cool(i)\
  5643. local pc = getParticleAt(lx,ly)\
  5644. if pc == 0 then\
  5645.  return\
  5646. end\
  5647. if lx == 0 then\
  5648.  return\
  5649. end\
  5650. if ly == 0 then\
  5651.  return\
  5652. end\
  5653. particles[pc][7] = math.max(particles[pc][7] - i, MIN_TEMP)\
  5654. end\
  5655. \
  5656. term.clear()\
  5657. term.setCursorPos(1,1)\
  5658. info(1,1)\
  5659. \
  5660. while on do\
  5661. evt, p1, p2, p3, p4, p5 = os.pullEvent()\
  5662. if evt == \"key\" then\
  5663.  --print(p1 .. \" pressed\")\
  5664.  if p1 == 57 then\
  5665.   pause()\
  5666.  elseif p1 == 33 then\
  5667.   if paused then simulate() end\
  5668.  elseif p1 == 14 then\
  5669.   term.setCursorPos(1, 18)\
  5670.   term.setBackgroundColor(colors.brown)\
  5671.   term.setTextColor(colors.yellow)\
  5672.   write(string.rep(\" \", 51))\
  5673.   term.setCursorPos(1, 18)\
  5674.   write(\">\")\
  5675.   cons = read()\
  5676.   term.setCursorPos(1, 18)\
  5677.   func, e = loadstring(cons, \"lua\")\
  5678.   func2, e2 = loadstring(\"return \" .. cons, \"lua\")\
  5679.   nfp = 0\
  5680.   if not func then\
  5681.    if func2 then\
  5682.     func = func2\
  5683.     e = nil\
  5684.     nfp = 1\
  5685.    end\
  5686.   else\
  5687.    if func2 then\
  5688.     func = func2\
  5689.    end\
  5690.   end\
  5691.   setfenv(func,getfenv())\
  5692.   result = {pcall(func)}\
  5693.   if result[1] then\
  5694.    nii = 1\
  5695.    resulter = \">\"\
  5696.    while (result[nii + 1] ~= nil) or (nii <= nfp) do\
  5697.     resulter = resulter .. tostring(result[nii + 1])\
  5698.     nii = nii + 1\
  5699.    end\
  5700.    statusBar = string.sub(resulter, 1, 51)\
  5701.    dirty = true\
  5702.   else\
  5703.    statusBar = string.sub(tostring(result[2]), 1, 51)\
  5704.    dirty = true\
  5705.   end\
  5706.   term.setBackgroundColor(colors.gray)\
  5707.   term.setTextColor(colors.white)\
  5708.   term.setCursorPos(1, 18)\
  5709.   write(string.rep(\" \", 51))\
  5710.   textReset = os.startTimer(5)\
  5711.   timeout = os.startTimer(0) \
  5712.  end\
  5713.  if (p1 == keys.leftCtrl) or (p1 == keys.rightCtrl) then\
  5714.   if menu == true then\
  5715.    closeMenu()\
  5716.   else\
  5717.    openMenu()\
  5718.   end\
  5719.  end\
  5720.  if menu == true then\
  5721.   if p1 == 46 then\
  5722.    clear()\
  5723.   end\
  5724.   if p1 == 28 then\
  5725.    quit()\
  5726.   end\
  5727.   if p1 == 31 then\
  5728.    save()\
  5729.   end\
  5730.   if p1 == 38 then\
  5731.    load()\
  5732.   end\
  5733.  end\
  5734. elseif evt == \"mouse_drag\" then\
  5735.  if p2 >= grid[1] then\
  5736.   if p2 <= grid[2] then\
  5737.    if p3 >= grid[3] then\
  5738.     if p3 <= grid[4] then\
  5739.      if drawing == true then\
  5740.       if p1 == 1 then\
  5741.        if brushSize <= 1 then\
  5742.         if elements[sel][20] == 0 then\
  5743.          createParticle(p2,p3,sel,creationLife,creationCotype,creationTemp)\
  5744.         elseif elements[sel][20] == 1 then \
  5745.          if getParticleAt(p2,p3) ~= 0 then particles[getParticleAt(p2,p3)][7] = math.min(particles[getParticleAt(p2,p3)][7] + 5, MAX_TEMP) end\
  5746.         elseif elements[sel][20] == 2 then\
  5747.          if getParticleAt(p2,p3) ~= 0 then particles[getParticleAt(p2,p3)][7] = math.max(particles[getParticleAt(p2,p3)][7] - 5, MIN_TEMP) end\
  5748.         end\
  5749.        else\
  5750.         local bs = (brushSize - 1)\
  5751.         local ds = (brushSize * 2) - 1\
  5752.         rect(p2-bs, p3-bs, (p2-bs)+ds, (p3-bs)+ds)\
  5753.        end\
  5754.       elseif p1 == 2 then\
  5755.        if brushSize <= 1 then\
  5756.         killParticle(getParticleAt(p2,p3))\
  5757.        else\
  5758.         local bs = (brushSize - 1)\
  5759.         local ds = (brushSize * 2) - 1\
  5760.         arect(p2-bs, p3-bs, (p2-bs)+ds, (p3-bs)+ds)\
  5761.        end\
  5762.       end        \
  5763.      end\
  5764.     end\
  5765.    end\
  5766.   end\
  5767.  end\
  5768. elseif evt == \"mouse_click\" then\
  5769.  --write(p1 .. \",\" .. p2 .. \",\" .. p3 .. \"  \")\
  5770.  if p2 >= grid[1] then\
  5771.   if p2 <= grid[2] then\
  5772.    if p3 >= grid[3] then\
  5773.     if p3 <= grid[4] then\
  5774.      drawing = true\
  5775.      if p1 == 3 then\
  5776.       info(p2, p3)\
  5777.      end\
  5778.      if p1 == 1 then\
  5779.       lx = p2\
  5780.       ly = p3\
  5781.       if brushSize <= 1 then\
  5782.        if elements[sel][20] == 0 then\
  5783.         createParticle(p2,p3,sel,creationLife,creationCotype,creationTemp)\
  5784.        elseif elements[sel][20] == 1 then \
  5785.         if getParticleAt(p2,p3) ~= 0 then particles[getParticleAt(p2,p3)][7] = math.min(particles[getParticleAt(p2,p3)][7] + 5, MAX_TEMP) end\
  5786.        elseif elements[sel][20] == 2 then\
  5787.         if getParticleAt(p2,p3) ~= 0 then particles[getParticleAt(p2,p3)][7] = math.max(particles[getParticleAt(p2,p3)][7] - 5, MIN_TEMP) end\
  5788.        end\
  5789.       else\
  5790.        local bs = (brushSize - 1)\
  5791.        local ds = (brushSize * 2) - 1\
  5792.        rect(p2-bs, p3-bs, (p2-bs)+ds, (p3-bs)+ds)\
  5793.       end\
  5794.      end\
  5795.      if p1 == 2 then\
  5796.       if brushSize <= 1 then\
  5797.        killParticle(getParticleAt(p2,p3))\
  5798.       else\
  5799.        local bs = (brushSize - 1)\
  5800.        local ds = (brushSize * 2) - 1\
  5801.        arect(p2-bs, p3-bs, (p2-bs)+ds, (p3-bs)+ds)\
  5802.       end\
  5803.      end\
  5804.     else\
  5805.      drawing = false\
  5806.     end\
  5807.    else\
  5808.     drawing = false\
  5809.    end\
  5810.   else\
  5811.    drawing = false\
  5812.   end\
  5813.  else\
  5814.   drawing = false\
  5815.  end\
  5816.  for k, v in pairs(buttons) do\
  5817.   term.setCursorPos(1, k)\
  5818.   --print(p2 .. \",\" .. p3 .. \" vs \" .. v[1] .. \"-\" .. v[2] .. \",\" .. v[3] .. \"-\" .. v[4])\
  5819.   if p2 >= v[1] then\
  5820.    if p2 <= v[2] then\
  5821.     if p3 >= v[3] then\
  5822.      if p3 <= v[4] then\
  5823.       --print(v[func])\
  5824.       if v[7] == true then\
  5825.        v[6]()\
  5826.        break\
  5827.       end\
  5828.      end\
  5829.     end\
  5830.    end\
  5831.   end\
  5832.  end\
  5833. elseif evt == \"timer\" and p1 == timeout then\
  5834.  timeout = os.startTimer(1 / fps) \
  5835.  --shouldRender = not shouldRender\
  5836.  pb = colors.gray\
  5837.  pf = colors.white\
  5838.  if paused == true then\
  5839.   pb = colors.white\
  5840.   pf = colors.black\
  5841.  else\
  5842.   if menu == false then\
  5843.    simulate()\
  5844.    --if shouldRender == true then redraw() end\
  5845.   end\
  5846.  end\
  5847.  --if dirty then redraw() end\
  5848.  redraw()\
  5849.  term.setBackgroundColor(pb)\
  5850.  term.setTextColor(pf)\
  5851.  term.setCursorPos(1, 18)\
  5852.  write(\"[ || ]\")\
  5853.  term.setBackgroundColor(colors.gray)\
  5854.  term.setTextColor(colors.white)\
  5855. elseif evt == \"timer\" and p1 == textReset then\
  5856.  statusbar = \"ccSand by CosmoConsole                        \" .. version\
  5857.  dirty = true\
  5858. end\
  5859. end\
  5860. \
  5861. if API then os.unloadAPI(\"redirect\") end\
  5862. \
  5863. term.setBackgroundColor(colors.black)\
  5864. term.setTextColor(colors.white)\
  5865. term.clear()\
  5866. term.setCursorPos(1,1)",
  5867.   [ "flappybird/startgame" ] = "------------FlappyBird v1.0----------\
  5868. ----------------Game-----------------\
  5869. --------------by Creator-------------\
  5870. \
  5871. --Variables--\
  5872. term.redirect(term.native())\
  5873. local w,h = term.getSize()\
  5874. local dead = false\
  5875. local defaultConfing = {\
  5876.     birdColor = colors.yellow,\
  5877.     bgColor = colors.lightBlue,\
  5878.     grassColor = colors.green,\
  5879.     scoreColor = colors.red,\
  5880.     obstacleColor = colors.blue\
  5881. }\
  5882. local obstacles = {}\
  5883. local currObstacle = 0\
  5884. local totalLenght = 0\
  5885. local howFar = 0\
  5886. \
  5887. --PhysicsVars--\
  5888. local position = math.floor(h/2)\
  5889. local G = 30\
  5890. local maxSpeed = 20\
  5891. local speed = maxSpeed\
  5892. local position = 1\
  5893. local totalTime = 0\
  5894. local diff = 0.05\
  5895. local xPos = math.floor(w/6)\
  5896. \
  5897. --Functions--\
  5898. local GUI = {}\
  5899. local Physics = {}\
  5900. local Events = {}\
  5901. \
  5902. --GUI related functions--\
  5903. \
  5904. function GUI.DrawBird()\
  5905.     term.setCursorPos(xPos,h-position)\
  5906.     term.setBackgroundColor(defaultConfing.birdColor)\
  5907.     term.write(\"@\")\
  5908. end\
  5909. \
  5910. function GUI.DrawBackground()\
  5911.     term.setBackgroundColor(defaultConfing.bgColor)\
  5912.     term.clear()\
  5913.     term.setCursorPos(1,1)\
  5914.     term.setTextColor(defaultConfing.scoreColor)\
  5915.     term.write(\"You have passed \"..tostring(currObstacle)..\" obstacles!\")\
  5916.     paintutils.drawLine(1,h,w,h,defaultConfing.grassColor)\
  5917. end\
  5918. \
  5919. function GUI.DrawObstacles()\
  5920.     for i,v in pairs(obstacles) do\
  5921.         local totalFar = v[1] + howFar\
  5922.         if 0 < totalFar and totalFar <= w then\
  5923.             paintutils.drawLine(totalFar,1,totalFar,v[3],defaultConfing.obstacleColor)\
  5924.             paintutils.drawLine(totalFar,v[2]+v[3]-1,totalFar,h-1,defaultConfing.obstacleColor)\
  5925.             if totalFar == xPos then\
  5926.                 currObstacle = currObstacle + 1\
  5927.                 if (1 <= h - position and h - position <= v[3]) or (v[2]+v[3]-1 <= h - position and h - position <= h-1) then\
  5928.                     dead = true\
  5929.                 end\
  5930.             end\
  5931.         end\
  5932.         \
  5933.     end\
  5934. end\
  5935. \
  5936. --Physics related functions--\
  5937. \
  5938. function Physics.BirdMove()\
  5939.     position = position + speed*diff - 0.5*G*math.pow( diff, 2 )\
  5940.     speed = speed - G*diff\
  5941. end\
  5942. \
  5943. function Physics.KeepInBoundaries()\
  5944.     if position <= 0 then\
  5945.         dead = true \
  5946.     elseif position > h-2 then\
  5947.         speed = 0\
  5948.         position = h-2\
  5949.     end\
  5950. end\
  5951. \
  5952. function Physics.GenerateObstacles(howMany)\
  5953.     for i=1,howMany do\
  5954.         totalLenght = totalLenght + math.random(35,70)\
  5955.         local opening = math.random(5,15)\
  5956.         local whereOpen = math.random(1,h-opening)\
  5957.         obstacles[#obstacles + 1] = {totalLenght,opening,whereOpen}\
  5958.     end\
  5959. end\
  5960. \
  5961. function Events.main()\
  5962.     local timer = os.startTimer(.2)\
  5963.     local event, p2 = os.pullEvent()\
  5964.     if event == \"key\" and p2 == keys.space then\
  5965.         os.cancelTimer(timer)\
  5966.         speed = maxSpeed\
  5967.     end\
  5968. end\
  5969. \
  5970. --Code--\
  5971. \
  5972. --[[f = fs.open(\"FlappyBirdConfig/configs\",\"r\")\
  5973. configurationBuffer = f.readAll()\
  5974. f.close()]]--\
  5975. \
  5976. Physics.GenerateObstacles(100)\
  5977. \
  5978. while true do\
  5979.     if dead == true then\
  5980.         error(\"you died\")\
  5981.     end\
  5982.     Events.main()\
  5983.     GUI.DrawBackground()\
  5984.     GUI.DrawBird()\
  5985.     GUI.DrawObstacles()\
  5986.     Physics.BirdMove()\
  5987.     Physics.KeepInBoundaries()\
  5988.     --Physics.DetectColision()\
  5989.     howFar = howFar - 1\
  5990. end",
  5991.   [ "goldrunner/levels/classic_015" ] = "bbbbbbbbbb5                          8bbbbbbbbbb\
  5992. bbbbbbbbbb8     4 e  4     4  e 4    8bbbbbbbbbb\
  5993. bbbbbbbbbb8888bbbbbbbbc   cbbbbbbbb888bbbbbbbbbb\
  5994. bbbbbbbbbb            c   c           bbbbbbbbbb\
  5995. bbbbbbbbbb       cbbbbbbbbbbbbbc      bbbbbbbbbb\
  5996. bbbbbbbbbb4  e  4c     4 4     c4 e  4bbbbbbbbbb\
  5997. bbbbbbbbbbbbbbbbbc 4 4bbbbb4 4 cbbbbbbbbbbbbbbbb\
  5998. bbbbbbbbbb       c bbbb   bbbb c      bbbbbbbbbb\
  5999. bbbbbbbbbb    4  c      4      c 4    bbbbbbbbbb\
  6000. bbbbbbbbbb  cbbbbbbbbbbbbbbbbbbbbbbc  bbbbbbbbbb\
  6001. bbbbbbbbbb  c           0          c  bbbbbbbbbb\
  6002. bbbbbbbbbb  c 4    4cbbbbbbbc4   4 c  bbbbbbbbbb\
  6003. bbbbbbbbbbbbbbbbbbbbc       cbbbbbbbbbbbbbbbbbbb\
  6004. bbbbbbbbbb          c       c         bbbbbbbbbb\
  6005. bbbbbbbbbb  4       c       c      4  bbbbbbbbbb\
  6006. bbbbbbbbbbb7b7b7b7b7b7b7b7b7b7b7b7b7b7bbbbbbbbbb\
  6007. 7777777777777777777777777777777777777777777777777",
  6008.   [ "goldrunner/levels/classic_014" ] = "bbbbbbbbbb  5   e    d   edc    cd   4bbbbbbbbbb\
  6009. bbbbbbbbbb dc   dcd   d  d cd   c d  cbbbbbbbbbb\
  6010. bbbbbbbbbbd c  d c d    d  c d  c  d cbbbbbbbbbb\
  6011. bbbbbbbbbb4 c d  c  d  d   c  d4c   dcbbbbbbbbbb\
  6012. bbbbbbbbbb  cd  dc   dd    c4  dc    cbbbbbbbbbb\
  6013. bbbbbbbbbbcd   d cd  dd  d cdddddd d  bbbbbbbbbb\
  6014. bbbbbbbbbbc d   dc  d4 d   c  d   c d bbbbbbbbbb\
  6015. bbbbbbbbbbcd d   c4ddc  d  c     dc  dbbbbbbbbbb\
  6016. bbbbbbbbbbc d d  cdd c   d c    d c  dbbbbbbbbbb\
  6017. bbbbbbbbbbcd 4 decd  c d  dcd  d  c  dbbbbbbbbbb\
  6018. bbbbbbbbbbc dc  d    c   d   d    c  dbbbbbbbbbb\
  6019. bbbbbbbbbbcd c   d   c  d d   d   c  dbbbbbbbbbb\
  6020. bbbbbbbbbbc dc d  d  c4d   d   d  c 4dbbbbbbbbbb\
  6021. bbbbbbbbbbcd c   d d cd d  4d   d c d bbbbbbbbbb\
  6022. bbbbbbbbbbc dc  d   dc     d d d dcd  bbbbbbbbbb\
  6023. bbbbbbbbbb   c     4     40       c   bbbbbbbbbb\
  6024. 7777777777777777777777777777777777777777777777777",
  6025.   [ "goldrunner/info" ] = "return {\
  6026.  sGameFile = \"startgame\",\
  6027.  sName = \"GoldRunner\",\
  6028.  bRequiresExtraFiles = true,\
  6029.  tExtraFiles = {\
  6030.    \"levels\",\
  6031.  },\
  6032. }",
  6033.   [ "goldrunner/levels/classic_008" ] = "bbbbbbbbbb           5    8           bbbbbbbbbb\
  6034. bbbbbbbbbb           8    8           bbbbbbbbbb\
  6035. bbbbbbbbbb   4 e   cb8    8bc   e 4   bbbbbbbbbb\
  6036. bbbbbbbbbbcbbbbbcddcb8    8bcddcbbbbbcbbbbbbbbbb\
  6037. bbbbbbbbbbcb   bc   b8    8b   cb   bcbbbbbbbbbb\
  6038. bbbbbbbbbbcb   bc   b8    8b   cb   bcbbbbbbbbbb\
  6039. bbbbbbbbbbcb 4 bc   b8    8b   cb 4 bcbbbbbbbbbb\
  6040. bbbbbbbbbbcbbbbbc   b8    8b   cbbbbbcbbbbbbbbbb\
  6041. bbbbbbbbbbcb   bc   b8    8b   cb   bcbbbbbbbbbb\
  6042. bbbbbbbbbbcb   bcdddbcbbbbcbdddcb   bcbbbbbbbbbb\
  6043. bbbbbbbbbbcb   b   cbc    cbc   b   bcbbbbbbbbbb\
  6044. bbbbbbbbbbcbe4 b   cbc  4ecbc   b 4ebcbbbbbbbbbb\
  6045. bbbbbbbbbbcbb1bb   cb777777bc   bb1bbcbbbbbbbbbb\
  6046. bbbbbbbbbbc     1  c        c  1     cbbbbbbbbbb\
  6047. bbbbbbbbbbc      1ec    0   c 1      cbbbbbbbbbb\
  6048. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  6049. 7777777777777777777777777777777777777777777777777",
  6050.   [ "minesweeper/info" ] = "return {\
  6051.  sGameFile = \"startgame\",\
  6052.  sName = \"Minesweeper\",\
  6053. }",
  6054.   [ "goldrunner/levels/classic_016" ] = "bbbbbbbbbb                         5  bbbbbbbbbb\
  6055. bbbbbbbbbb                    0     8 bbbbbbbbbb\
  6056. bbbbbbbbbb   1bbbbccbbbbbbccccc      8bbbbbbbbbb\
  6057. bbbbbbbbbb         c   b  c         8 bbbbbbbbbb\
  6058. bbbbbbbbbb    4     c cb  c        8  bbbbbbbbbb\
  6059. bbbbbbbbbb    b4     ccb  c       8   bbbbbbbbbb\
  6060. bbbbbbbbbb   bbb4     cb  c      8    bbbbbbbbbb\
  6061. bbbbbbbbbb  bbbbb4    cb  c     8     bbbbbbbbbb\
  6062. bbbbbbbbbbbbbbbbbb    cb  c      8    bbbbbbbbbb\
  6063. bbbbbbbbbb 4bbbbb     cb  c       8   bbbbbbbbbb\
  6064. bbbbbbbbbb   bbb      cb  c        8  bbbbbbbbbb\
  6065. bbbbbbbbbb    b       cb  c         8 bbbbbbbbbb\
  6066. bbbbbbbbbb       e    cb  c   e      8bbbbbbbbbb\
  6067. bbbbbbbbbb cbbbbbbbbbbbbbb1bbbbbbbbb 8bbbbbbbbbb\
  6068. bbbbbbbbbb bbbbbbbbbbbbbbb         cb8bbbbbbbbbb\
  6069. bbbbbbbbbbbbbbbbbbbbbbbbbb   444444cbbbbbbbbbbbb\
  6070. 7777777777777777777777777777777777777777777777777",
  6071.   [ "goldrunner/levels/10_gauntlet" ] = "                                                 \
  6072.    e 4  ddddddddddddddddddddddddddddddd  4 e    \
  6073.  c777777                               777777c  \
  6074.  c                   bbbbbbb                 c  \
  6075.  c 4 4       bbbbbb  b 4 4 b             4 4 c  \
  6076.  777777c     b4444b  b4 4 4b           c777777  \
  6077.        c     b4444b  b     b           c        \
  6078.    4 4 cd    b4444b  bcbbbcb          dc 4 4    \
  6079.  c777777     bbbcbb   c   c            777777c  \
  6080.  c              c     c   c                  c  \
  6081.  c 4 4     bbbbbcbb  0    bbbbbbbb       4 4 c  \
  6082.  777777c   b4444c4b bbbb   4 4 4 4     c777777  \
  6083.        c   b4444c4b b44b   4 454 4     c        \
  6084.    4 4 cd  bcbbbbbb b44b   4 484 4    dc 4 4    \
  6085.  c777777    c       b44b   4 484 4     777777c  \
  6086.  c          c                 8              c  \
  6087.  c  e       c                 8            e c  \
  6088. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  6089.   [ "ccsand/apis/redirect" ] = "local trueCursor={term.getCursorPos()}\
  6090. \
  6091. local redirectBufferBase = {\
  6092.    write=\
  6093.      function(buffer,...)\
  6094.        local cy=buffer.curY\
  6095.        if cy>0 and cy<=buffer.height then\
  6096.          local text=table.concat({...},\" \")\
  6097.          local cx=buffer.curX\
  6098.          local px, py\
  6099.          if buffer.isActive and not buffer.cursorBlink then\
  6100.            buffer.native.setCursorPos(cx+buffer.scrX, cy+buffer.scrY)\
  6101.          end\
  6102.          for i=1,#text do\
  6103.            if cx>0 and cx<=buffer.width then\
  6104.              local curCell=buffer[cy][cx]\
  6105.              local char,textColor,backgroundColor=string.char(text:byte(i)),buffer.textColor,buffer.backgroundColor\
  6106.              if buffer[cy].isDirty or curCell.char~=char or curCell.textColor~=textColor or curCell.backgroundColor~=backgroundColor then\
  6107.                buffer[cy][cx].char=char\
  6108.                buffer[cy][cx].textColor=textColor\
  6109.                buffer[cy][cx].backgroundColor=backgroundColor\
  6110.                buffer[cy].isDirty=true\
  6111.              end\
  6112.            end\
  6113.            cx=cx+1\
  6114.          end\
  6115.          buffer.curX=cx\
  6116.          if buffer.isActive then\
  6117.            buffer.drawDirty()\
  6118.            if not buffer.cursorBlink then\
  6119.              trueCursor={cx+buffer.scrX-1,cy+buffer.scrY-1}\
  6120.              buffer.native.setCursorPos(unpack(trueCursor))\
  6121.            end\
  6122.          end\
  6123.        end\
  6124.      end,\
  6125. \
  6126.    setCursorPos=\
  6127.      function(buffer,x,y)\
  6128.        buffer.curX=math.floor(x)\
  6129.        buffer.curY=math.floor(y)\
  6130.        if buffer.isActive and buffer.cursorBlink then\
  6131.          buffer.native.setCursorPos(x+buffer.scrX-1,y+buffer.scrY-1)\
  6132.          trueCursor={x+buffer.scrX-1,y+buffer.scrY-1}\
  6133.        end\
  6134.      end,\
  6135. \
  6136.    getCursorPos=\
  6137.      function(buffer)\
  6138.        return buffer.curX,buffer.curY\
  6139.      end,\
  6140. \
  6141.    scroll=\
  6142.      function(buffer,offset)\
  6143.        for j=1,offset do\
  6144.          local temp=table.remove(buffer,1)\
  6145.          table.insert(buffer,temp)\
  6146.          for i=1,#temp do\
  6147.            temp[i].char=\" \"\
  6148.            temp[i].textColor=buffer.textColor\
  6149.            temp[i].backgroundColor=buffer.backgroundColor\
  6150.          end\
  6151.        end\
  6152.        if buffer.isActive then\
  6153.          local prev=term.redirect(buffer.native)\
  6154.          buffer.blit()\
  6155.          if term.restore then\
  6156.            term.restore()\
  6157.          else\
  6158.            term.redirect(prev)\
  6159.          end\
  6160.        end\
  6161.      end,\
  6162. \
  6163.    isColor=\
  6164.      function(buffer)\
  6165.        return buffer._isColor\
  6166.      end,\
  6167. \
  6168.    isColour=\
  6169.      function(buffer)\
  6170.        return buffer._isColor\
  6171.      end,\
  6172. \
  6173.    clear=\
  6174.      function(buffer)\
  6175.        for y=1,buffer.height do\
  6176.          for x=1,buffer.width do\
  6177.            buffer[y][x]={char=\" \",textColor=buffer.textColor,backgroundColor=buffer.backgroundColor}\
  6178.          end\
  6179.        end\
  6180.        if buffer.isActive then\
  6181.          local prev=term.redirect(buffer.native)\
  6182.          buffer.blit()\
  6183.          if term.restore then\
  6184.            term.restore()\
  6185.          else\
  6186.            term.redirect(prev)\
  6187.          end\
  6188.        end\
  6189.      end,\
  6190. \
  6191.    clearLine=\
  6192.      function(buffer)\
  6193.        local line=buffer[buffer.curY]\
  6194.        local fg,bg = buffer.textColor, buffer.backgroundColor\
  6195.        for x=1,buffer.width do\
  6196.          line[x]={char=\" \",textColor=fg,backgroundColor=bg}\
  6197.        end\
  6198.        buffer[buffer.curY].isDirty=true\
  6199.        if buffer.isActive then\
  6200.          buffer.drawDirty()\
  6201.        end\
  6202.      end,\
  6203. \
  6204.    setCursorBlink=\
  6205.      function(buffer,onoff)\
  6206.        buffer.cursorBlink=onoff\
  6207.        if buffer.isActive then\
  6208.          buffer.native.setCursorBlink(onoff)\
  6209.          if onoff then\
  6210.            buffer.native.setCursorPos(buffer.curX,buffer.curY)\
  6211.            trueCursor={buffer.curX,buffer.curY}\
  6212.          end\
  6213.        end\
  6214.      end,\
  6215. \
  6216.    getSize=\
  6217.      function(buffer)\
  6218.        return buffer.width, buffer.height\
  6219.      end,\
  6220. \
  6221.    setTextColor=\
  6222.      function(buffer,color)\
  6223.        buffer.textColor=color\
  6224.        if buffer.isActive then\
  6225.          if buffer.native.isColor() or color==colors.black or color==colors.white then\
  6226.            buffer.native.setTextColor(color)\
  6227.          end\
  6228.        end\
  6229.      end,\
  6230. \
  6231.    setTextColour=\
  6232.      function(buffer,color)\
  6233.        buffer.textColor=color\
  6234.        if buffer.isActive then\
  6235.          if buffer.native.isColor() or color==colors.black or color==colors.white then\
  6236.            buffer.native.setTextColor(color)\
  6237.          end\
  6238.        end\
  6239.      end,\
  6240. \
  6241.    setBackgroundColor=\
  6242.      function(buffer,color)\
  6243.        buffer.backgroundColor=color\
  6244.        if buffer.isActive then\
  6245.          if buffer.native.isColor() or color==colors.black or color==colors.white then\
  6246.        buffer.native.setBackgroundColor(color)\
  6247.          end\
  6248.        end\
  6249.      end,\
  6250. \
  6251.    setBackgroundColour=\
  6252.      function(buffer,color)\
  6253.        buffer.backgroundColor=color\
  6254.        if buffer.isActive then\
  6255.          if buffer.native.isColor() or color==colors.black or color==colors.white then\
  6256.            buffer.native.setBackgroundColor(color)\
  6257.          end\
  6258.        end\
  6259.      end,\
  6260. \
  6261.    resize=\
  6262.      function(buffer,width,height)\
  6263.        if buffer.width~=width or buffer.height~=height then\
  6264.          local fg, bg=buffer.textColor, buffer.backgroundColor\
  6265.          if width>buffer.width then\
  6266.            for y=1,buffer.height do\
  6267.              for x=#buffer[y]+1,width do\
  6268.                buffer[y][x]={char=\" \",textColor=fg,backgroundColor=bg}\
  6269.              end\
  6270.            end\
  6271.          end\
  6272. \
  6273.          if height>buffer.height then\
  6274.            local w=width>buffer.width and width or buffer.width\
  6275.            for y=#buffer+1,height do\
  6276.              local row={}\
  6277.              for x=1,width do\
  6278.                row[x]={char=\" \",textColor=fg,backgroundColor=bg}\
  6279.              end\
  6280.              buffer[y]=row\
  6281.            end\
  6282.          end\
  6283.          buffer.width=width\
  6284.          buffer.height=height\
  6285.        end\
  6286.      end,\
  6287. \
  6288.    blit=\
  6289.      function(buffer,sx,sy,dx, dy, width,height)\
  6290.        sx=sx or 1\
  6291.        sy=sy or 1\
  6292.        dx=dx or buffer.scrX\
  6293.        dy=dy or buffer.scrY\
  6294.        width=width or buffer.width\
  6295.        height=height or buffer.height\
  6296. \
  6297.        local h=sy+height>buffer.height and buffer.height-sy or height-1\
  6298.        for y=0,h do\
  6299.          local row=buffer[sy+y]\
  6300.          local x=0\
  6301.          local cell=row[sx]\
  6302.          local fg,bg=cell.textColor,cell.backgroundColor\
  6303.          local str=\"\"\
  6304.          local tx=x\
  6305.          while true do\
  6306.            str=str..cell.char\
  6307.            x=x+1\
  6308.            if x==width or sx+x>buffer.width then\
  6309.              break\
  6310.            end\
  6311.            cell=row[sx+x]\
  6312.            if cell.textColor~=fg or cell.backgroundColor~=bg then\
  6313.              --write\
  6314.              term.setCursorPos(dx+tx,dy+y)\
  6315.              term.setTextColor(fg)\
  6316.              term.setBackgroundColor(bg)\
  6317.              term.write(str)\
  6318.              str=\"\"\
  6319.              tx=x\
  6320.              fg=cell.textColor\
  6321.              bg=cell.backgroundColor\
  6322.            end\
  6323.          end\
  6324.          term.setCursorPos(dx+tx,dy+y)\
  6325.          term.setTextColor(fg)\
  6326.          term.setBackgroundColor(bg)\
  6327.          term.write(str)\
  6328.        end\
  6329.      end,\
  6330. \
  6331.    drawDirty =\
  6332.      function(buffer)\
  6333.        local prev=term.redirect(buffer.native)\
  6334.        for y=1,buffer.height do\
  6335.          if buffer[y].isDirty then\
  6336.            buffer.blit(1,y,buffer.scrX,buffer.scrY+y-1,buffer.width,buffer.height)\
  6337.            buffer[y].isDirty=false\
  6338.          end\
  6339.        end\
  6340.        if term.restore then\
  6341.          term.restore()\
  6342.        else\
  6343.          term.redirect(prev)\
  6344.        end\
  6345.      end,\
  6346. \
  6347.    makeActive =\
  6348.      function(buffer,posX, posY)\
  6349.        posX=posX or 1\
  6350.        posY=posY or 1\
  6351.        buffer.scrX=posX\
  6352.        buffer.scrY=posY\
  6353.        local prev=term.redirect(buffer.native)\
  6354.        buffer.blit(1,1,posX,posY,buffer.width,buffer.height)\
  6355.        term.setCursorPos(buffer.curX,buffer.curY)\
  6356.        term.setCursorBlink(buffer.cursorBlink)\
  6357.        term.setTextColor(buffer.textColor)\
  6358.        term.setBackgroundColor(buffer.backgroundColor)\
  6359.        buffer.isActive=true\
  6360.        if term.restore then\
  6361.          term.restore()\
  6362.        else\
  6363.          term.redirect(prev)\
  6364.        end\
  6365.      end,\
  6366. \
  6367.    isBuffer = true,\
  6368. \
  6369.  }\
  6370. \
  6371. \
  6372. function createRedirectBuffer(width,height,fg,bg,isColor)\
  6373.   bg=bg or colors.black\
  6374.   fg=fg or colors.white\
  6375.   if isColor==nil then\
  6376.     isColor=term.isColor()\
  6377.   end\
  6378.   local buffer={}\
  6379. \
  6380.   do\
  6381.     local w,h=term.getSize()\
  6382.     width,height=width or w,height or h\
  6383.   end\
  6384. \
  6385.   for y=1,height do\
  6386.     local row={}\
  6387.     for x=1,width do\
  6388.       row[x]={char=\" \",textColor=fg,backgroundColor=bg}\
  6389.     end\
  6390.     buffer[y]=row\
  6391.   end\
  6392.   buffer.scrX=1\
  6393.   buffer.scrY=1\
  6394.   buffer.width=width\
  6395.   buffer.height=height\
  6396.   buffer.cursorBlink=false\
  6397.   buffer.textColor=fg\
  6398.   buffer.backgroundColor=bg\
  6399.   buffer._isColor=isColor\
  6400.   buffer.curX=1\
  6401.   buffer.curY=1\
  6402.   buffer.native=type(term.native)==\"function\" and term.native() or term.native\
  6403.   local meta={}\
  6404.   local function wrap(f,o)\
  6405.     return function(...)\
  6406.         return f(o,...)\
  6407.       end\
  6408.   end\
  6409.   for k,v in pairs(redirectBufferBase) do\
  6410.     if type(v)==\"function\" then\
  6411.       meta[k]=wrap(v,buffer)\
  6412.     else\
  6413.       meta[k]=v\
  6414.     end\
  6415.   end\
  6416.   setmetatable(buffer,{__index=meta})\
  6417.   return buffer\
  6418. end",
  6419.   [ "bankvault/info" ] = "return {\
  6420.  sGameFile = \"startgame\",\
  6421.  sName = \"BankVault\",\
  6422.  bRequiresExtraFiles = true,\
  6423.  tExtraFiles = {\
  6424.    \"levels\",\
  6425.  },\
  6426. }",
  6427.   [ "goldrunner/levels/04_fortress" ] = "\
  6428. 7  4 547                                      0  \
  6429. 7ccbbbb7                                   cbbbbb\
  6430. 7cc77777                                   cb 4 4\
  6431. 7cc                                        cb7777\
  6432. 7cc7                                             \
  6433. 7cc7                                             \
  6434. 7cc                         4    dddd dddd dddd  \
  6435. 7cc77                   c777b777c    c    c    c7\
  6436. 7cc7c77  dddddd 4    4  c      7c    c  e c    c7\
  6437. 7cc c          bbbbcbbbbc      777777777777777777\
  6438. 7777c7  7          c    c                        \
  6439. 7c77c 77           c    c4   4  dddddddd 4 4     \
  6440. 7c  c 77 4       bbbbc7b7b7b7b7c        bbbbbc   \
  6441. 7c  c  7bb           c         c             c   \
  6442. 77c777c777b   4      c         c             c   \
  6443. 7ece 7c  7bbbbbb     c         c     e       c   \
  6444. 7777777777777777777777777777777777777777777777777",
  6445.   [ "goldrunner/levels/05_caged" ] = "                                                 \
  6446.                   88888888888                   \
  6447.     e  4        cb8         8bc        4  e     \
  6448.  cbbbbbbcdddddddcb8         8bcdddddddcbbbbbbc  \
  6449.  cb    bc        b8         8b        cb    bc  \
  6450.  cb    bc        b8         8b        cb    bc  \
  6451.  cb    bc        b8         8b        cb    bc  \
  6452.  cbb4  bc        b8    5    8b        cbb 4 bc  \
  6453.  cbbbbbbc        b8dddd dddd8b        cbbbbbbc  \
  6454.  cb    bcddddddddb8   4 4   8bddddddddcb    bc  \
  6455.  cb    b        cbcbbbbbbbbbcbc        b    bc  \
  6456.  cb    b        cbc         cbc        b    bc  \
  6457.  cb 4ebb        cbc    e    cbc        bbe4 bc  \
  6458.  cbbbbbb        cb77777777777bc        bbbbbbc  \
  6459.  c      b       c             c       b      c  \
  6460.  c       b      c             c      b       c  \
  6461.  c       4b     c      0      c     b4       c  \
  6462. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  6463.   plains = "3111111333333333333333333333333333333333333333333\
  6464. 3111111333333333333333333333333333333333333333333\
  6465. 3111111333333333333333333333333333333333333333333\
  6466. 3111111333333333333333333333333333333333333333333\
  6467. 3333333333333333333333333333333333333333333333333\
  6468. 3333333333333333333333333333333333333333333333333\
  6469. 3333333333333333333333333333333333333333333333333\
  6470. 3333333333333333333333333333333333333333333333333\
  6471. 3333333333333333333333333333333333333333333333333\
  6472. 3333333333333333333333333333333333333333333333333\
  6473. 3333333333333333333333333333333333333333333333333\
  6474. 3333333333333333333333333333333333333333333333333\
  6475. 3333333333333333333333333333333333333333333333333\
  6476. 3333333333333333333333333333333333333333333333333\
  6477. 3333333333333333333333333333333333333333333333333\
  6478. 3355555555555555555555555555555555555555555555533\
  6479. 5555555555555555555555555555555555555555555555555\
  6480. 5555555555555555555555555555555555555555555555555",
  6481.   [ "konelift/startgame" ] = "term.setBackgroundColor(colors.black)\
  6482. term.setTextColor(colors.white)\
  6483. print(\"KONE ELEVATOR SIMULATOR!\")\
  6484. sleep(2)\
  6485. print(\"CONTROLS:\")\
  6486. print(\"[space] - get stuck\")\
  6487. sleep(2)\
  6488. local progress = 0\
  6489. local function redraw()\
  6490.  local w, h = term.getSize()\
  6491.  term.current().setVisible(false)\
  6492.  term.setTextColor(colors.black)\
  6493.  term.clear()\
  6494.  paintutils.drawLine(1, h - 14, 1, h, colors.white)\
  6495.  paintutils.drawLine(5, h - 14, 5, h, colors.white)\
  6496.  term.setCursorPos(2, h - 4 - math.floor(progress / 10))\
  6497.  term.write(\"---\")\
  6498.  term.setCursorPos(1, h - math.floor(progress / 10))\
  6499.  term.write(\"#---#\")\
  6500.  term.setBackgroundColor(colors.black)\
  6501.  term.setTextColor(colors.white)\
  6502.  term.write(\" < \"..progress..\"%\")\
  6503.  term.setCursorPos(12, 1)\
  6504.  term.current().setVisible(true)\
  6505. end\
  6506. \
  6507. while true do\
  6508.  redraw()\
  6509.  local timer = os.startTimer(0.25)\
  6510.  while true do\
  6511.    local ev = {os.pullEvent()}\
  6512.    if ev[1] == \"timer\" and ev[2] == timer then\
  6513.      break\
  6514.    elseif ev[1] == \"key\" and ev[2] == keys.space then\
  6515.      print(\"ELEVATOR DIED AT \"..progress..\"%!\")\
  6516.      sleep(2)\
  6517.      return\
  6518.    end\
  6519.  end\
  6520.  if progress == 99 then\
  6521.    print(\"ELEVATOR DIED AT 99%!\")\
  6522.    sleep(2)\
  6523.    return\
  6524.  end\
  6525.  progress = progress + 1\
  6526.  if progress > 100 then\
  6527.    printError(\"Elevator survived.\")\
  6528.    sleep(2)\
  6529.    return\
  6530.  end\
  6531. end",
  6532.   [ "goldrunner/levels/classic_013" ] = "bbbbbbbbbb            e          e    bbbbbbbbbb\
  6533. bbbbbbbbbb1c1c1c1c1c1c1c1c1c1c1c1c1c18bbbbbbbbbb\
  6534. bbbbbbbbbb1c1c1c1c1c1c1c1c1c1c1c1c1c18bbbbbbbbbb\
  6535. bbbbbbbbbb4cbc cbc4cbc cbc4cbc cbc4cb8bbbbbbbbbb\
  6536. bbbbbbbbbb1cbc1cbc1cbc1cbc1cbc1cbc1cb8bbbbbbbbbb\
  6537. bbbbbbbbbb1cbc1cbc1cbc1cbc1cbc1cbc1cb8bbbbbbbbbb\
  6538. bbbbbbbbbb1cbc1cbc1cbc1cbc1cbc1cbc1cb8bbbbbbbbbb\
  6539. bbbbbbbbbb cbc4cbc cbc4cbc cbc4cbc cb8bbbbbbbbbb\
  6540. bbbbbbbbbb1cbc1cbc1cbc1cbc1cbc1cbc1cb8bbbbbbbbbb\
  6541. bbbbbbbbbb1cbc1cbc1cbc1cbc1cbc1cbc1cb8bbbbbbbbbb\
  6542. bbbbbbbbbb4c c c c c c c c c c c c cb8bbbbbbbbbb\
  6543. bbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbbbb8bbbbbbbbbb\
  6544. bbbbbbbbbbc         4 e 4   4 e      8bbbbbbbbbb\
  6545. bbbbbbbbbbc777777777777777777777777778bbbbbbbbbb\
  6546. bbbbbbbbbbc4       0                48bbbbbbbbbb\
  6547. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  6548. 7777777777777777777777777777777777777777777777777",
  6549.   [ "goldrunner/levels/11_hunting" ] = "                                                 \
  6550.                                      bbbbbbbbbb \
  6551.                                      be e e e b \
  6552.                                      bbbbbbbb4b \
  6553.                                      b44444444b \
  6554.                    5                 b4bbbbbbbb \
  6555.                    c                 b44444444b \
  6556.                    c               bcbbbbbbbb4b \
  6557.        cbbbbbbbbbbbbbbbbbbbcbbbbbbbbc444444444b \
  6558.        c                   c       bbbbbbbbbbbb \
  6559.   7    c  0                c   7                \
  6560.   7bbbbbbbbbbbbbbbbbbbbbbbbbbbb7                \
  6561.   777777777777777777777777777777                \
  6562.                                                 \
  6563.                                                 \
  6564.                                                 \
  6565.                                                 \
  6566.                                                 ",
  6567.   [ "redcast/files/credplay" ] = "local f = fs.open(\"credits\",\"r\")\
  6568. local lines = {}\
  6569. local line = f.readLine()\
  6570. while line do\
  6571.  table.insert(lines,line)\
  6572.  line = f.readLine()\
  6573. end\
  6574. f.close()\
  6575. local x,y = term.getSize()\
  6576. i = y + 1\
  6577. while true do\
  6578.  \
  6579.  i = i - 1\
  6580.  term.clear()\
  6581.  y = i\
  6582.  for k,v in pairs(lines) do\
  6583.    term.setCursorPos(1,y)\
  6584.    term.write(v)\
  6585.    y = y + 1\
  6586.  end\
  6587.  if i < 0-#lines then break end\
  6588.  sleep(0.4)\
  6589. end\
  6590. \
  6591. term.setCursorPos(1,1)",
  6592.   [ "goldrunner/levels/classic_007" ] = "bbbbbbbbbb  5                         bbbbbbbbbb\
  6593. bbbbbbbbbb  8                 ddddddddbbbbbbbbbb\
  6594. bbbbbbbbbb  8          e      c      cbbbbbbbbbb\
  6595. bbbbbbbbbbbbbbbcb    bcbbb   ec    4 cbbbbbbbbbb\
  6596. bbbbbbbbbb     c      c    bbbcbbbbbbbbbbbbbbbbb\
  6597. bbbbbbbbbb  e  c   4  c       c       bbbbbbbbbb\
  6598. bbbbbbbbbbbbbbbcbbbb  c       c       bbbbbbbbbb\
  6599. bbbbbbbbbb     c      c       c       bbbbbbbbbb\
  6600. bbbbbbbbbb  4  c   4  c       c       bbbbbbbbbb\
  6601. bbbbbbbbbbbbcbbbbbbbbbbbbc    c bbbb cbbbbbbbbbb\
  6602. bbbbbbbbbb  c            c 4  c bbbb cbbbbbbbbbb\
  6603. bbbbbbbbbb  c  4         cddddc b 4b cbbbbbbbbbb\
  6604. bbbbbbbbbbbbbbbbbc            c bbbbbcbbbbbbbbbb\
  6605. bbbbbbbbbb       c            c      cbbbbbbbbbb\
  6606. bbbbbbbbbb       c 0        4 c  e   cbbbbbbbbbb\
  6607. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  6608. 7777777777777777777777777777777777777777777777777",
  6609.   [ "redcast/files/apis/redirect" ] = "local trueCursor={term.getCursorPos()}\
  6610. \
  6611. local redirectBufferBase = {\
  6612.    write=\
  6613.      function(buffer,...)\
  6614.        local cy=buffer.curY\
  6615.        if cy>0 and cy<=buffer.height then\
  6616.          local text=table.concat({...},\" \")\
  6617.          local cx=buffer.curX\
  6618.          local px, py\
  6619.          if buffer.isActive and not buffer.cursorBlink then\
  6620.            buffer.native.setCursorPos(cx+buffer.scrX, cy+buffer.scrY)\
  6621.          end\
  6622.          for i=1,#text do\
  6623.            if cx>0 and cx<=buffer.width then\
  6624.              local curCell=buffer[cy][cx]\
  6625.              local char,textColor,backgroundColor=string.char(text:byte(i)),buffer.textColor,buffer.backgroundColor\
  6626.              if buffer[cy].isDirty or curCell.char~=char or curCell.textColor~=textColor or curCell.backgroundColor~=backgroundColor then\
  6627.                buffer[cy][cx].char=char\
  6628.                buffer[cy][cx].textColor=textColor\
  6629.                buffer[cy][cx].backgroundColor=backgroundColor\
  6630.                buffer[cy].isDirty=true\
  6631.              end\
  6632.            end\
  6633.            cx=cx+1\
  6634.          end\
  6635.          buffer.curX=cx\
  6636.          if buffer.isActive then\
  6637.            buffer.drawDirty()\
  6638.            if not buffer.cursorBlink then\
  6639.              trueCursor={cx+buffer.scrX-1,cy+buffer.scrY-1}\
  6640.              buffer.native.setCursorPos(unpack(trueCursor))\
  6641.            end\
  6642.          end\
  6643.        end\
  6644.      end,\
  6645. \
  6646.    setCursorPos=\
  6647.      function(buffer,x,y)\
  6648.        buffer.curX=math.floor(x)\
  6649.        buffer.curY=math.floor(y)\
  6650.        if buffer.isActive and buffer.cursorBlink then\
  6651.          buffer.native.setCursorPos(x+buffer.scrX-1,y+buffer.scrY-1)\
  6652.          trueCursor={x+buffer.scrX-1,y+buffer.scrY-1}\
  6653.        end\
  6654.      end,\
  6655. \
  6656.    getCursorPos=\
  6657.      function(buffer)\
  6658.        return buffer.curX,buffer.curY\
  6659.      end,\
  6660. \
  6661.    scroll=\
  6662.      function(buffer,offset)\
  6663.        for j=1,offset do\
  6664.          local temp=table.remove(buffer,1)\
  6665.          table.insert(buffer,temp)\
  6666.          for i=1,#temp do\
  6667.            temp[i].char=\" \"\
  6668.            temp[i].textColor=buffer.textColor\
  6669.            temp[i].backgroundColor=buffer.backgroundColor\
  6670.          end\
  6671.        end\
  6672.        if buffer.isActive then\
  6673.          local prev=term.redirect(buffer.native)\
  6674.          buffer.blit()\
  6675.          if term.restore then\
  6676.            term.restore()\
  6677.          else\
  6678.            term.redirect(prev)\
  6679.          end\
  6680.        end\
  6681.      end,\
  6682. \
  6683.    isColor=\
  6684.      function(buffer)\
  6685.        return buffer._isColor\
  6686.      end,\
  6687. \
  6688.    isColour=\
  6689.      function(buffer)\
  6690.        return buffer._isColor\
  6691.      end,\
  6692. \
  6693.    clear=\
  6694.      function(buffer)\
  6695.        for y=1,buffer.height do\
  6696.          for x=1,buffer.width do\
  6697.            buffer[y][x]={char=\" \",textColor=buffer.textColor,backgroundColor=buffer.backgroundColor}\
  6698.          end\
  6699.        end\
  6700.        if buffer.isActive then\
  6701.          local prev=term.redirect(buffer.native)\
  6702.          buffer.blit()\
  6703.          if term.restore then\
  6704.            term.restore()\
  6705.          else\
  6706.            term.redirect(prev)\
  6707.          end\
  6708.        end\
  6709.      end,\
  6710. \
  6711.    clearLine=\
  6712.      function(buffer)\
  6713.        local line=buffer[buffer.curY]\
  6714.        local fg,bg = buffer.textColor, buffer.backgroundColor\
  6715.        for x=1,buffer.width do\
  6716.          line[x]={char=\" \",textColor=fg,backgroundColor=bg}\
  6717.        end\
  6718.        buffer[buffer.curY].isDirty=true\
  6719.        if buffer.isActive then\
  6720.          buffer.drawDirty()\
  6721.        end\
  6722.      end,\
  6723. \
  6724.    setCursorBlink=\
  6725.      function(buffer,onoff)\
  6726.        buffer.cursorBlink=onoff\
  6727.        if buffer.isActive then\
  6728.          buffer.native.setCursorBlink(onoff)\
  6729.          if onoff then\
  6730.            buffer.native.setCursorPos(buffer.curX,buffer.curY)\
  6731.            trueCursor={buffer.curX,buffer.curY}\
  6732.          end\
  6733.        end\
  6734.      end,\
  6735. \
  6736.    getSize=\
  6737.      function(buffer)\
  6738.        return buffer.width, buffer.height\
  6739.      end,\
  6740. \
  6741.    setTextColor=\
  6742.      function(buffer,color)\
  6743.        buffer.textColor=color\
  6744.        if buffer.isActive then\
  6745.          if buffer.native.isColor() or color==colors.black or color==colors.white then\
  6746.            buffer.native.setTextColor(color)\
  6747.          end\
  6748.        end\
  6749.      end,\
  6750. \
  6751.    setTextColour=\
  6752.      function(buffer,color)\
  6753.        buffer.textColor=color\
  6754.        if buffer.isActive then\
  6755.          if buffer.native.isColor() or color==colors.black or color==colors.white then\
  6756.            buffer.native.setTextColor(color)\
  6757.          end\
  6758.        end\
  6759.      end,\
  6760. \
  6761.    setBackgroundColor=\
  6762.      function(buffer,color)\
  6763.        buffer.backgroundColor=color\
  6764.        if buffer.isActive then\
  6765.          if buffer.native.isColor() or color==colors.black or color==colors.white then\
  6766.        buffer.native.setBackgroundColor(color)\
  6767.          end\
  6768.        end\
  6769.      end,\
  6770. \
  6771.    setBackgroundColour=\
  6772.      function(buffer,color)\
  6773.        buffer.backgroundColor=color\
  6774.        if buffer.isActive then\
  6775.          if buffer.native.isColor() or color==colors.black or color==colors.white then\
  6776.            buffer.native.setBackgroundColor(color)\
  6777.          end\
  6778.        end\
  6779.      end,\
  6780. \
  6781.    resize=\
  6782.      function(buffer,width,height)\
  6783.        if buffer.width~=width or buffer.height~=height then\
  6784.          local fg, bg=buffer.textColor, buffer.backgroundColor\
  6785.          if width>buffer.width then\
  6786.            for y=1,buffer.height do\
  6787.              for x=#buffer[y]+1,width do\
  6788.                buffer[y][x]={char=\" \",textColor=fg,backgroundColor=bg}\
  6789.              end\
  6790.            end\
  6791.          end\
  6792. \
  6793.          if height>buffer.height then\
  6794.            local w=width>buffer.width and width or buffer.width\
  6795.            for y=#buffer+1,height do\
  6796.              local row={}\
  6797.              for x=1,width do\
  6798.                row[x]={char=\" \",textColor=fg,backgroundColor=bg}\
  6799.              end\
  6800.              buffer[y]=row\
  6801.            end\
  6802.          end\
  6803.          buffer.width=width\
  6804.          buffer.height=height\
  6805.        end\
  6806.      end,\
  6807. \
  6808.    blit=\
  6809.      function(buffer,sx,sy,dx, dy, width,height)\
  6810.        sx=sx or 1\
  6811.        sy=sy or 1\
  6812.        dx=dx or buffer.scrX\
  6813.        dy=dy or buffer.scrY\
  6814.        width=width or buffer.width\
  6815.        height=height or buffer.height\
  6816. \
  6817.        local h=sy+height>buffer.height and buffer.height-sy or height-1\
  6818.        for y=0,h do\
  6819.          local row=buffer[sy+y]\
  6820.          local x=0\
  6821.          local cell=row[sx]\
  6822.          local fg,bg=cell.textColor,cell.backgroundColor\
  6823.          local str=\"\"\
  6824.          local tx=x\
  6825.          while true do\
  6826.            str=str..cell.char\
  6827.            x=x+1\
  6828.            if x==width or sx+x>buffer.width then\
  6829.              break\
  6830.            end\
  6831.            cell=row[sx+x]\
  6832.            if cell.textColor~=fg or cell.backgroundColor~=bg then\
  6833.              --write\
  6834.              term.setCursorPos(dx+tx,dy+y)\
  6835.              term.setTextColor(fg)\
  6836.              term.setBackgroundColor(bg)\
  6837.              term.write(str)\
  6838.              str=\"\"\
  6839.              tx=x\
  6840.              fg=cell.textColor\
  6841.              bg=cell.backgroundColor\
  6842.            end\
  6843.          end\
  6844.          term.setCursorPos(dx+tx,dy+y)\
  6845.          term.setTextColor(fg)\
  6846.          term.setBackgroundColor(bg)\
  6847.          term.write(str)\
  6848.        end\
  6849.      end,\
  6850. \
  6851.    drawDirty =\
  6852.      function(buffer)\
  6853.        local prev=term.redirect(buffer.native)\
  6854.        for y=1,buffer.height do\
  6855.          if buffer[y].isDirty then\
  6856.            buffer.blit(1,y,buffer.scrX,buffer.scrY+y-1,buffer.width,buffer.height)\
  6857.            buffer[y].isDirty=false\
  6858.          end\
  6859.        end\
  6860.        if term.restore then\
  6861.          term.restore()\
  6862.        else\
  6863.          term.redirect(prev)\
  6864.        end\
  6865.      end,\
  6866. \
  6867.    makeActive =\
  6868.      function(buffer,posX, posY)\
  6869.        posX=posX or 1\
  6870.        posY=posY or 1\
  6871.        buffer.scrX=posX\
  6872.        buffer.scrY=posY\
  6873.        local prev=term.redirect(buffer.native)\
  6874.        buffer.blit(1,1,posX,posY,buffer.width,buffer.height)\
  6875.        term.setCursorPos(buffer.curX,buffer.curY)\
  6876.        term.setCursorBlink(buffer.cursorBlink)\
  6877.        term.setTextColor(buffer.textColor)\
  6878.        term.setBackgroundColor(buffer.backgroundColor)\
  6879.        buffer.isActive=true\
  6880.        if term.restore then\
  6881.          term.restore()\
  6882.        else\
  6883.          term.redirect(prev)\
  6884.        end\
  6885.      end,\
  6886. \
  6887.    isBuffer = true,\
  6888. \
  6889.  }\
  6890. \
  6891. \
  6892. function createRedirectBuffer(width,height,fg,bg,isColor)\
  6893.   bg=bg or colors.black\
  6894.   fg=fg or colors.white\
  6895.   if isColor==nil then\
  6896.     isColor=term.isColor()\
  6897.   end\
  6898.   local buffer={}\
  6899. \
  6900.   do\
  6901.     local w,h=term.getSize()\
  6902.     width,height=width or w,height or h\
  6903.   end\
  6904. \
  6905.   for y=1,height do\
  6906.     local row={}\
  6907.     for x=1,width do\
  6908.       row[x]={char=\" \",textColor=fg,backgroundColor=bg}\
  6909.     end\
  6910.     buffer[y]=row\
  6911.   end\
  6912.   buffer.scrX=1\
  6913.   buffer.scrY=1\
  6914.   buffer.width=width\
  6915.   buffer.height=height\
  6916.   buffer.cursorBlink=false\
  6917.   buffer.textColor=fg\
  6918.   buffer.backgroundColor=bg\
  6919.   buffer._isColor=isColor\
  6920.   buffer.curX=1\
  6921.   buffer.curY=1\
  6922.   buffer.native=type(term.native)==\"function\" and term.native() or term.native\
  6923.   local meta={}\
  6924.   local function wrap(f,o)\
  6925.     return function(...)\
  6926.         return f(o,...)\
  6927.       end\
  6928.   end\
  6929.   for k,v in pairs(redirectBufferBase) do\
  6930.     if type(v)==\"function\" then\
  6931.       meta[k]=wrap(v,buffer)\
  6932.     else\
  6933.       meta[k]=v\
  6934.     end\
  6935.   end\
  6936.   setmetatable(buffer,{__index=meta})\
  6937.   return buffer\
  6938. end",
  6939.   [ "bankvault/levels/Original.txt" ] = "; Original & Extra\
  6940. \
  6941. ; Copyright: Thinking Rabbit\
  6942. ; E-Mail: \
  6943. ; Web Site: \
  6944. ;\
  6945. ; The 50 original levels from Sokoban plus the 40 from Extra.\
  6946. \
  6947.    #####\
  6948.    #   #\
  6949.    #$  #\
  6950.  ###  $##\
  6951.  #  $ $ #\
  6952. ### # ## #   ######\
  6953. #   # ## #####  ..#\
  6954. # $  $          ..#\
  6955. ##### ### #@##  ..#\
  6956.    #     #########\
  6957.    #######\
  6958. ; 1\
  6959. \
  6960. ############\
  6961. #..  #     ###\
  6962. #..  # $  $  #\
  6963. #..  #$####  #\
  6964. #..    @ ##  #\
  6965. #..  # #  $ ##\
  6966. ###### ##$ $ #\
  6967.  # $  $ $ $ #\
  6968.  #    #     #\
  6969.  ############\
  6970. ; 2\
  6971. \
  6972.        ########\
  6973.        #     @#\
  6974.        # $#$ ##\
  6975.        # $  $#\
  6976.        ##$ $ #\
  6977. ######### $ # ###\
  6978. #....  ## $  $  #\
  6979. ##...    $  $   #\
  6980. #....  ##########\
  6981. ########\
  6982. ; 3\
  6983. \
  6984.           ########\
  6985.           #  ....#\
  6986. ############  ....#\
  6987. #    #  $ $   ....#\
  6988. # $$$#$  $ #  ....#\
  6989. #  $     $ #  ....#\
  6990. # $$ #$ $ $########\
  6991. #  $ #     #\
  6992. ## #########\
  6993. #    #    ##\
  6994. #     $   ##\
  6995. #  $$#$$  @#\
  6996. #    #    ##\
  6997. ###########\
  6998. ; 4\
  6999. \
  7000.        #####\
  7001.        #   #####\
  7002.        # #$##  #\
  7003.        #     $ #\
  7004. ######### ###   #\
  7005. #....  ## $  $###\
  7006. #....    $ $$ ##\
  7007. #....  ##$  $ @#\
  7008. #########  $  ##\
  7009.        # $ $  #\
  7010.        ### ## #\
  7011.          #    #\
  7012.          ######\
  7013. ; 5\
  7014. \
  7015. ######  ###\
  7016. #..  # ##@##\
  7017. #..  ###   #\
  7018. #..     $$ #\
  7019. #..  # # $ #\
  7020. #..### # $ #\
  7021. #### $ #$  #\
  7022.   #  $# $ #\
  7023.   # $  $  #\
  7024.   #  ##   #\
  7025.   #########\
  7026. ; 6\
  7027. \
  7028.       #####\
  7029. #######   ##\
  7030. ## # @## $$ #\
  7031. #    $      #\
  7032. #  $  ###   #\
  7033. ### #####$###\
  7034. # $  ### ..#\
  7035. # $ $ $ ...#\
  7036. #    ###...#\
  7037. # $$ # #...#\
  7038. #  ### #####\
  7039. ####\
  7040. ; 7\
  7041. \
  7042.  ####\
  7043.  #  ###########\
  7044.  #    $   $ $ #\
  7045.  # $# $ #  $  #\
  7046.  #  $ $  #    #\
  7047. ### $# #  #### #\
  7048. #@#$ $ $  ##   #\
  7049. #    $ #$#   # #\
  7050. #   $    $ $ $ #\
  7051. #####  #########\
  7052.  #      #\
  7053.  #      #\
  7054.  #......#\
  7055.  #......#\
  7056.  #......#\
  7057.  ########\
  7058. ; 8\
  7059. \
  7060.          #######\
  7061.          #  ...#\
  7062.      #####  ...#\
  7063.      #      . .#\
  7064.      #  ##  ...#\
  7065.      ## ##  ...#\
  7066.     ### ########\
  7067.     # $$$ ##\
  7068. #####  $ $ #####\
  7069. ##   #$ $   #   #\
  7070. #@ $  $    $  $ #\
  7071. ###### $$ $ #####\
  7072.     #      #\
  7073.     ########\
  7074. ; 9\
  7075. \
  7076. ###  #############\
  7077. ##@####       #   #\
  7078. # $$   $$  $ $ ...#\
  7079. #  $$$#    $  #...#\
  7080. # $   # $$ $$ #...#\
  7081. ###   #  $    #...#\
  7082. #     # $ $ $ #...#\
  7083. #    ###### ###...#\
  7084. ## #  #  $ $  #...#\
  7085. #  ## # $$ $ $##..#\
  7086. # ..# #  $      #.#\
  7087. # ..# # $$$ $$$ #.#\
  7088. ##### #       # #.#\
  7089.    # ######### #.#\
  7090.    #           #.#\
  7091.    ###############\
  7092. ; 10\
  7093. \
  7094.          ####\
  7095.     #### #  #\
  7096.   ### @###$ #\
  7097.  ##      $  #\
  7098. ##  $ $$## ##\
  7099. #  #$##     #\
  7100. # # $ $$ # ###\
  7101. #   $ #  # $ #####\
  7102. ####    #  $$ #   #\
  7103. #### ## $         #\
  7104. #.    ###  ########\
  7105. #.. ..# ####\
  7106. #...#.#\
  7107. #.....#\
  7108. #######\
  7109. ; 11\
  7110. \
  7111. ################\
  7112. #              #\
  7113. # # ######     #\
  7114. # #  $ $ $ $#  #\
  7115. # #   $@$   ## ##\
  7116. # #  $ $ $###...#\
  7117. # #   $ $  ##...#\
  7118. # ###$$$ $ ##...#\
  7119. #     # ## ##...#\
  7120. #####   ## ##...#\
  7121.    #####     ###\
  7122.        #     #\
  7123.        #######\
  7124. ; 12\
  7125. \
  7126.   #########\
  7127.  ##   ##  ######\
  7128. ###     #  #    ###\
  7129. #  $ #$ #  #  ... #\
  7130. # # $#@$## # #.#. #\
  7131. #  # #$  #    . . #\
  7132. # $    $ # # #.#. #\
  7133. #   ##  ##$ $ . . #\
  7134. # $ #   #  #$#.#. #\
  7135. ## $  $   $  $... #\
  7136. #$ ######    ##  #\
  7137. #  #    ##########\
  7138. ####\
  7139. ; 13\
  7140. \
  7141.       #######\
  7142. #######     #\
  7143. #     # $@$ #\
  7144. #$$ #   #########\
  7145. # ###......##   #\
  7146. #   $......## # #\
  7147. # ###......     #\
  7148. ##   #### ### #$##\
  7149. #  #$   #  $  # #\
  7150. #  $ $$$  # $## #\
  7151. #   $ $ ###$$ # #\
  7152. #####     $   # #\
  7153.    ### ###   # #\
  7154.      #     #   #\
  7155.      ########  #\
  7156.             ####\
  7157. ; 14\
  7158. \
  7159.   ########\
  7160.   #   #  #\
  7161.   #  $   #\
  7162. ### #$   ####\
  7163. #  $  ##$   #\
  7164. #  # @ $ # $#\
  7165. #  #      $ ####\
  7166. ## ####$##     #\
  7167. # $#.....# #   #\
  7168. #  $..**. $# ###\
  7169. ##  #.....#   #\
  7170. #   ### #######\
  7171. # $$  #  #\
  7172. #  #     #\
  7173. ######   #\
  7174.     #####\
  7175. ; 15\
  7176. \
  7177. #####\
  7178. #   ##\
  7179. #    #  ####\
  7180. # $  ####  #\
  7181. #  $$ $   $#\
  7182. ###@ #$    ##\
  7183. #  ##  $ $ ##\
  7184. # $  ## ## .#\
  7185. #  #$##$  #.#\
  7186. ###   $..##.#\
  7187.  #    #.*...#\
  7188.  # $$ #.....#\
  7189.  #  #########\
  7190.  #  #\
  7191.  ####\
  7192. ; 16\
  7193. \
  7194.   ##########\
  7195.   #..  #   #\
  7196.   #..      #\
  7197.   #..  #  ####\
  7198.  #######  #  ##\
  7199.  #            #\
  7200.  #  #  ##  #  #\
  7201. #### ##  #### ##\
  7202. #  $  ##### #  #\
  7203. # # $  $  # $  #\
  7204. # @$  $   #   ##\
  7205. #### ## #######\
  7206.   #    #\
  7207.   ######\
  7208. ; 17\
  7209. \
  7210.     ###########\
  7211.     #  .  #   #\
  7212.     # #.    @ #\
  7213. ##### ##..# ####\
  7214. ##  # ..###     ###\
  7215. # $ #...   $ #  $ #\
  7216. #    .. ##  ## ## #\
  7217. ####$##$# $ #   # #\
  7218.  ## #    #$ $$ # #\
  7219.  #  $ # #  # $## #\
  7220.  #               #\
  7221.  #  ###########  #\
  7222.  ####         ####\
  7223. ; 18\
  7224. \
  7225.  ######\
  7226.  #   @####\
  7227. ##### $   #\
  7228. #   ##    ####\
  7229. # $ #  ##    #\
  7230. # $ #  ##### #\
  7231. ## $  $    # #\
  7232. ## $ $ ### # #\
  7233. ## #  $  # # #\
  7234. ## # #$#   # #\
  7235. ## ###   # # ######\
  7236. #  $  #### # #....#\
  7237. #    $    $   ..#.#\
  7238. ####$  $# $   ....#\
  7239. #       #  ## ....#\
  7240. ###################\
  7241. ; 19\
  7242. \
  7243.    ##########\
  7244. #####        ####\
  7245. #     #   $  #@ #\
  7246. # #######$####  ###\
  7247. # #    ## #  #$ ..#\
  7248. # # $     #  #  #.#\
  7249. # # $  #     #$ ..#\
  7250. # #  ### ##     #.#\
  7251. # ###  #  #  #$ ..#\
  7252. # #    #  ####  #.#\
  7253. # #$   $  $  #$ ..#\
  7254. #    $ # $ $ #  #.#\
  7255. #### $###    #$ ..#\
  7256.   #    $$ ###....#\
  7257.   #      ## ######\
  7258.   ########\
  7259. ; 20\
  7260. \
  7261. #########\
  7262. #       #\
  7263. #       ####\
  7264. ## #### #  #\
  7265. ## #@##    #\
  7266. # $$$ $  $$#\
  7267. #  # ## $  #\
  7268. #  # ##  $ ####\
  7269. ####  $$$ $#  #\
  7270. #   ##   ....#\
  7271. # #   # #.. .#\
  7272. #   # # ##...#\
  7273. ##### $  #...#\
  7274.     ##   #####\
  7275.      #####\
  7276. ; 21\
  7277. \
  7278. ######     ####\
  7279. #    #######  #####\
  7280. #   $#  #  $  #   #\
  7281. #  $  $  $ # $ $  #\
  7282. ##$ $   # @# $    #\
  7283. #  $ ########### ##\
  7284. # #   #.......# $#\
  7285. # ##  # ......#  #\
  7286. # #   $........$ #\
  7287. # # $ #.... ..#  #\
  7288. #  $ $####$#### $#\
  7289. # $   ### $   $  ##\
  7290. # $     $ $  $    #\
  7291. ## ###### $ ##### #\
  7292. #         #       #\
  7293. ###################\
  7294. ; 22\
  7295. \
  7296.    #######\
  7297.    #  #  ####\
  7298. ##### $#$ #  ##\
  7299. #.. #  #  #   #\
  7300. #.. # $#$ #  $####\
  7301. #.  #     #$  #  #\
  7302. #..   $#  # $    #\
  7303. #..@#  #$ #$  #  #\
  7304. #.. # $#     $#  #\
  7305. #.. #  #$$#$  #  ##\
  7306. #.. # $#  #  $#$  #\
  7307. #.. #  #  #   #   #\
  7308. ##. ####  #####   #\
  7309. ####  ####   #####\
  7310. ; 23\
  7311. \
  7312. ###############\
  7313. #..........  .####\
  7314. #..........$$.#  #\
  7315. ###########$ #   ##\
  7316. #      $  $     $ #\
  7317. ## ####   #  $ #  #\
  7318. #      #   ##  # ##\
  7319. #  $#  # ##  ### ##\
  7320. # $ #$###    ### ##\
  7321. ###  $ #  #  ### ##\
  7322. ###    $ ## #  # ##\
  7323. # $  #  $  $ $   #\
  7324. #  $  $#$$$  #   #\
  7325. #  #  $      #####\
  7326. # @##  #  #  #\
  7327. ##############\
  7328. ; 24\
  7329. \
  7330. ####\
  7331. #  ##############\
  7332. #  #   ..#......#\
  7333. #  # # ##### ...#\
  7334. ##$#    ........#\
  7335. #   ##$######  ####\
  7336. # $ #     ######@ #\
  7337. ##$ # $   ######  #\
  7338. #  $ #$$$##       #\
  7339. #      #    #$#$###\
  7340. # #### #$$$$$    #\
  7341. # #    $     #   #\
  7342. # #   ##        ###\
  7343. # ######$###### $ #\
  7344. #        #    #   #\
  7345. ##########    #####\
  7346. ; 25\
  7347. \
  7348. #######\
  7349. #  #  #####\
  7350. ##  #  #...###\
  7351. #  $#  #...  #\
  7352. # $ #$$ ...  #\
  7353. #  $#  #... .#\
  7354. #   # $########\
  7355. ##$       $ $ #\
  7356. ##  #  $$ #   #\
  7357. ######  ##$$@#\
  7358.      #      ##\
  7359.      ########\
  7360. ; 26\
  7361. \
  7362. #################\
  7363. #...   #    #   ##\
  7364. ##.....  $## # #$ #\
  7365. #......#  $  #    #\
  7366. #......#  #  # #  #\
  7367. ######### $  $ $  #\
  7368.  #     #$##$ ##$##\
  7369. ##   $    # $    #\
  7370. #  ## ### #  ##$ #\
  7371. # $ $$     $  $  #\
  7372. # $    $##$ ######\
  7373. #######  @ ##\
  7374.       ######\
  7375. ; 27\
  7376. \
  7377.         #####\
  7378.     #####   #\
  7379.    ## $  $  ####\
  7380. ##### $  $ $ ##.#\
  7381. #       $$  ##..#\
  7382. #  ###### ###.. #\
  7383. ## #  #    #... #\
  7384. # $   #    #... #\
  7385. #@ #$ ## ####...#\
  7386. ####  $ $$  ##..#\
  7387.   ##  $ $  $...#\
  7388.    # $$  $ #  .#\
  7389.    #   $ $  ####\
  7390.    ######   #\
  7391.         #####\
  7392. ; 28\
  7393. \
  7394. #####\
  7395. #   ##\
  7396. # $  #########\
  7397. ## # #       ######\
  7398. ## #   $#$#@  #   #\
  7399. #  #      $ #   $ #\
  7400. #  ### ######### ##\
  7401. #  ## ..*..... # ##\
  7402. ## ## *.*..*.* # ##\
  7403. # $########## ##$ #\
  7404. #  $   $  $    $  #\
  7405. #  #   #   #   #  #\
  7406. ###################\
  7407. ; 29\
  7408. \
  7409.       ###########\
  7410.       #   #     #\
  7411. #####  #     $ $ #\
  7412. #   ##### $## # ##\
  7413. # $ ##   # ## $  #\
  7414. # $  @$$ # ##$$$ #\
  7415. ## ###   # ##    #\
  7416. ## #   ### #####$#\
  7417. ## #     $  #....#\
  7418. #  ### ## $ #....##\
  7419. # $   $ #   #..$. #\
  7420. #  ## $ #  ##.... #\
  7421. #####   ######...##\
  7422.    #####    #####\
  7423. ; 30\
  7424. \
  7425.  ####\
  7426.  #  #########\
  7427. ##  ##  #   #\
  7428. #  $# $@$   ####\
  7429. #$  $  # $ $#  ##\
  7430. ##  $## #$ $     #\
  7431. #  #  # #   $$$  #\
  7432. # $    $  $## ####\
  7433. # $ $ #$#  #  #\
  7434. ##  ###  ###$ #\
  7435. #  #....     #\
  7436. ####......####\
  7437.   #....####\
  7438.   #...##\
  7439.   #...#\
  7440.   #####\
  7441. ; 31\
  7442. \
  7443.      ####\
  7444.  #####  #\
  7445. ##     $#\
  7446. ## $  ## ###\
  7447. #@$ $ # $  #\
  7448. #### ##   $#\
  7449. #....#$ $ #\
  7450. #....#   $#\
  7451. #....  $$ ##\
  7452. #... # $   #\
  7453. ######$ $  #\
  7454.      #   ###\
  7455.      #$ ###\
  7456.      #  #\
  7457.      ####\
  7458. ; 32\
  7459. \
  7460. ############\
  7461. ##     ##  #\
  7462. ##   $   $ #\
  7463. #### ## $$ #\
  7464. #   $ #    #\
  7465. # $$$ # ####\
  7466. #   # # $ ##\
  7467. #  #  #  $ #\
  7468. # $# $#    #\
  7469. #   ..# ####\
  7470. ####.. $ #@#\
  7471. #.....# $# #\
  7472. ##....#  $ #\
  7473. ###..##    #\
  7474. ############\
  7475. ; 33\
  7476. \
  7477. #########\
  7478. #....   ##\
  7479. #.#.#  $ ##\
  7480. ##....# # @##\
  7481. # ....#  #  ##\
  7482. #     #$ ##$ #\
  7483. ## ###  $    #\
  7484. #$  $ $ $#  #\
  7485. # #  $ $ ## #\
  7486. #  ###  ##  #\
  7487. #    ## ## ##\
  7488. #  $ #  $  #\
  7489. ###$ $   ###\
  7490.   #  #####\
  7491.   ####\
  7492. ; 34\
  7493. \
  7494. ############ ######\
  7495. #   #    # ###....#\
  7496. #   $$#   @  .....#\
  7497. #   # ###   # ....#\
  7498. ## ## ###  #  ....#\
  7499. # $ $     # # ####\
  7500. #  $ $##  #      #\
  7501. #### #  #### # ## #\
  7502. #  # #$   ## #    #\
  7503. # $  $  # ## #   ##\
  7504. # # $ $    # #   #\
  7505. #  $ ## ## # #####\
  7506. # $$     $$  #\
  7507. ## ## ### $  #\
  7508. #    # #    #\
  7509. ###### ######\
  7510. ; 35\
  7511. \
  7512.            #####\
  7513. #####  ######   #\
  7514. #   ####  $ $ $ #\
  7515. # $   ## ## ##  ##\
  7516. #   $ $     $  $ #\
  7517. ### $  ## ##     ##\
  7518.  # ##### #####$$ #\
  7519. ##$##### @##     #\
  7520. # $  ###$### $  ##\
  7521. # $  #   ###  ###\
  7522. # $$ $ #   $$ #\
  7523. #     #   ##  #\
  7524. #######.. .###\
  7525.    #.........#\
  7526.    #.........#\
  7527.    ###########\
  7528. ; 36\
  7529. \
  7530. ###########\
  7531. #......   #########\
  7532. #......   #  ##   #\
  7533. #..### $    $     #\
  7534. #... $ $ #   ##   #\
  7535. #...#$#####    #  #\
  7536. ###    #   #$  #$ #\
  7537.  #  $$ $ $  $##  #\
  7538.  #  $   #$#$ ##$ #\
  7539.  ### ## #    ##  #\
  7540.   #  $ $ ## ######\
  7541.   #    $  $  #\
  7542.   ##   # #   #\
  7543.    #####@#####\
  7544.        ###\
  7545. ; 37\
  7546. \
  7547.      ####\
  7548. ####### @#\
  7549. #     $  #\
  7550. #   $## $#\
  7551. ##$#...# #\
  7552. # $...  #\
  7553. # #. .# ##\
  7554. #   # #$ #\
  7555. #$  $    #\
  7556. #  #######\
  7557. ####\
  7558. ; 38\
  7559. \
  7560.             ######\
  7561. #############....#\
  7562. ##   ##     ##....#\
  7563. #  $$##  $ @##....#\
  7564. #      $$ $#  ....#\
  7565. #  $ ## $$ # # ...#\
  7566. #  $ ## $  #  ....#\
  7567. ## ##### ### ##.###\
  7568. ##   $  $ ##   .  #\
  7569. # $###  # ##### ###\
  7570. #   $   #       #\
  7571. #  $ #$ $ $###  #\
  7572. # $$$# $   # ####\
  7573. #    #  $$ #\
  7574. ######   ###\
  7575.     #####\
  7576. ; 39\
  7577. \
  7578.    ############\
  7579.    #          ##\
  7580.    #  # #$$ $  #\
  7581.    #$ #$#  ## @#\
  7582.   ## ## # $ # ##\
  7583.   #   $ #$  # #\
  7584.   #   # $   # #\
  7585.   ## $ $   ## #\
  7586.   #  #  ##  $ #\
  7587.   #    ## $$# #\
  7588. ######$$   #   #\
  7589. #....#  ########\
  7590. #.#... ##\
  7591. #....   #\
  7592. #....   #\
  7593. #########\
  7594. ; 40\
  7595. \
  7596.           #####\
  7597.          ##   ##\
  7598.         ##     #\
  7599.        ##  $$  #\
  7600.       ## $$  $ #\
  7601.       # $    $ #\
  7602. ####   #   $$ #####\
  7603. #  ######## ##    #\
  7604. #.            $$$@#\
  7605. #.# ####### ##   ##\
  7606. #.# #######. #$ $##\
  7607. #........... #    #\
  7608. ##############  $ #\
  7609.             ##  ##\
  7610.              ####\
  7611. ; 41\
  7612. \
  7613.     ########\
  7614.  ####      ######\
  7615.  #    ## $ $   @#\
  7616.  # ## ##$#$ $ $##\
  7617. ### ......#  $$ ##\
  7618. #   ......#  #   #\
  7619. # # ......#$  $  #\
  7620. # #$...... $$# $ #\
  7621. #   ### ###$  $ ##\
  7622. ###  $  $  $  $ #\
  7623.  #  $  $  $  $ #\
  7624.  ######   ######\
  7625.       #####\
  7626. ; 42\
  7627. \
  7628.        #######\
  7629.    #####  #  ####\
  7630.    #   #   $    #\
  7631. #### #$$ ## ##  #\
  7632. ##      # #  ## ###\
  7633. #  ### $#$  $  $  #\
  7634. #...    # ##  #   #\
  7635. #...#    @ # ### ##\
  7636. #...#  ###  $  $  #\
  7637. ######## ##   #   #\
  7638.          #########\
  7639. ; 43\
  7640. \
  7641. #####\
  7642. #   #\
  7643. # # #######\
  7644. #      $@######\
  7645. # $ ##$ ###   #\
  7646. # #### $    $ #\
  7647. # ##### #  #$ ####\
  7648. ##  #### ##$      #\
  7649. #  $#  $  # ## ## #\
  7650. #         # #...# #\
  7651. ######  ###  ...  #\
  7652.     #### # #...# #\
  7653.          # ### # #\
  7654.          #       #\
  7655.          #########\
  7656. ; 44\
  7657. \
  7658. ##### ####\
  7659. #...# #  ####\
  7660. #...###  $  #\
  7661. #....## $  $###\
  7662. ##....##   $  #\
  7663. ###... ## $ $ #\
  7664. # ##    #  $  #\
  7665. #  ## # ### ####\
  7666. # $ # #$  $    #\
  7667. #  $ @ $    $  #\
  7668. #   # $ $$ $ ###\
  7669. #  ######  ###\
  7670. # ##    ####\
  7671. ###\
  7672. ; 45\
  7673. \
  7674. ##########\
  7675. #        ####\
  7676. # ###### #  ##\
  7677. # # $ $ $  $ #\
  7678. #       #$   #\
  7679. ###$  $$#  ###\
  7680.  #  ## # $##\
  7681.  ##$#   $ @#\
  7682.   #  $ $ ###\
  7683.   # #   $  #\
  7684.   # ##   # #\
  7685.  ##  ##### #\
  7686.  #         #\
  7687.  #.......###\
  7688.  #.......#\
  7689.  #########\
  7690. ; 46\
  7691. \
  7692.         ####\
  7693. #########  ##\
  7694. ##  $      $ #####\
  7695. #   ## ##   ##...#\
  7696. # #$$ $ $$#$##...#\
  7697. # #   @   #   ...#\
  7698. #  $# ###$$   ...#\
  7699. # $  $$  $ ##....#\
  7700. ###$       #######\
  7701.  #  #######\
  7702.  ####\
  7703. ; 47\
  7704. \
  7705.  #########\
  7706.  #*.*#*.*#\
  7707.  #.*.*.*.#\
  7708.  #*.*.*.*#\
  7709.  #.*.*.*.#\
  7710.  #*.*.*.*#\
  7711.  ###   ###\
  7712.    #   #\
  7713. ###### ######\
  7714. #           #\
  7715. # $ $ $ $ $ #\
  7716. ## $ $ $ $ ##\
  7717. #$ $ $ $ $#\
  7718. #   $@$   #\
  7719. #  #####  #\
  7720. ####   ####\
  7721. ; 48\
  7722. \
  7723.       ####\
  7724.       #  ##\
  7725.       #   ##\
  7726.       # $$ ##\
  7727.     ###$  $ ##\
  7728.  ####    $   #\
  7729. ###  # #####  #\
  7730. #    # #....$ #\
  7731. # #   $ ....# #\
  7732. #  $ # #.*..# #\
  7733. ###  #### ### #\
  7734.  #### @$  ##$##\
  7735.     ### $     #\
  7736.       #  ##   #\
  7737.       #########\
  7738. ; 49\
  7739. \
  7740.      ############\
  7741.     ##..    #   #\
  7742.    ##..* $    $ #\
  7743.   ##..*.# # # $##\
  7744.   #..*.# # # $  #\
  7745. ####...#  #    # #\
  7746. #  ## #          #\
  7747. # @$ $ ###  #   ##\
  7748. # $   $   # #   #\
  7749. ###$$   # # # # #\
  7750.  #   $   # # #####\
  7751.  # $# #####      #\
  7752.  #$   #   #    # #\
  7753.  #  ###   ##     #\
  7754.  #  #      #    ##\
  7755.  ####      ######\
  7756. ; 50\
  7757. \
  7758. #########\
  7759. #       #\
  7760. # $ $$ $#\
  7761. ### #  $ #\
  7762. #.#   $$ ##\
  7763. #.###   $ #\
  7764. #.#. $ ## ####\
  7765. #...  $## $  #\
  7766. #...$   $    #\
  7767. #..###$### #@#\
  7768. #..# #     ###\
  7769. #### #######\
  7770. ; 51\
  7771. \
  7772.           ########\
  7773.           #......#\
  7774.   ####    #......#\
  7775.   #  #########...#\
  7776.   # $   $    #...#\
  7777.   #  # # # # #   #\
  7778. ##### # # #@# #   #\
  7779. #   # ### ### ## ##\
  7780. #    $ # $ $ $ # #\
  7781. # $$$  $   #     #\
  7782. #   # ###$###$## #\
  7783. ### #  $   #     #\
  7784. ## $  # $ $ $ ###\
  7785. #  # ### ### ##\
  7786. # $          #\
  7787. #  ###########\
  7788. ####\
  7789. ; 52\
  7790. \
  7791. ####################\
  7792. #                ###\
  7793. # $#   $ ##  $    ##\
  7794. #    $###    # $$ ##\
  7795. #.###     $ $ ##  ##\
  7796. #...#  #  #    #$  #\
  7797. #..##$$#### $  #   #\
  7798. #...#      $ ##  ###\
  7799. #...$  ###  #    # #\
  7800. ##..  $#  ##   ##@ #\
  7801. ###.#              #\
  7802. ####################\
  7803. ; 53\
  7804. \
  7805. ####################\
  7806. #   #    #   #   #@#\
  7807. # $      $   $   # #\
  7808. ## ###..## ###     #\
  7809. #   #....#$#  $### #\
  7810. # $ #....#  $  $ $ #\
  7811. #   #....# # # $ $ #\
  7812. #   ##..##   #$#   #\
  7813. ##$##    ##  #  #$##\
  7814. #   $  $     #  #  #\
  7815. #   #    #   #     #\
  7816. ####################\
  7817. ; 54\
  7818. \
  7819. ####################\
  7820. #    @##      #   ##\
  7821. #    ##    $    $ ##\
  7822. #  ###....# # #  ###\
  7823. #   #....# # # $   #\
  7824. ### #...#  #       #\
  7825. ##  ##.#     $   $ #\
  7826. ##  $ $ ###  # # ###\
  7827. ## $       # # $   #\
  7828. #### $  $# # # # $ #\
  7829. ####         # #  ##\
  7830. ####################\
  7831. ; 55\
  7832. \
  7833. ####################\
  7834. #  #  ##    #   @###\
  7835. ##    $    # $###  #\
  7836. ##$# $ ##$# $ $    #\
  7837. #   $#    $      ###\
  7838. # ##   $ ###  #....#\
  7839. # # $# # # # #....##\
  7840. #    $ $ #  #....###\
  7841. ##$ ###  $ #....####\
  7842. #  # $        ######\
  7843. #      # #    ######\
  7844. ####################\
  7845. ; 56\
  7846. \
  7847. ####################\
  7848. #@     ###   #  #  #\
  7849. # # #  #  $  $     #\
  7850. #####     # $ $#$# #\
  7851. #.#..#    ##$ $    #\
  7852. #.....    $   #   ##\
  7853. #.....    ###$##$###\
  7854. #.#..#    $    #   #\
  7855. #####     #  #$  $ #\
  7856. #####  #  $    $ $ #\
  7857. #####  #  #  #  #  #\
  7858. ####################\
  7859. ; 57\
  7860. \
  7861. ####################\
  7862. ##...   ## #    #  #\
  7863. #....         $ ## #\
  7864. #....# # #$###$    #\
  7865. #...#    #       # #\
  7866. ##.#  #$ #     $## #\
  7867. #  #  # $ $ ###  $ #\
  7868. #     $  $ #  # ## #\
  7869. ## # ## #$$# $#  # #\
  7870. #  #   $ $ #      ##\
  7871. #    #     #  #   @#\
  7872. ####################\
  7873. ; 58\
  7874. \
  7875. ####################\
  7876. #   #  #@# ##  #####\
  7877. # # #  $    $  #####\
  7878. # #    ###### $  ###\
  7879. #   #  #....#  $$  #\
  7880. ##$##$##....#      #\
  7881. #      #....##$##$##\
  7882. #  $$  #....#      #\
  7883. # $  $  #  #  ###  #\
  7884. #####  $   $    $  #\
  7885. ##### #    #  #   ##\
  7886. ####################\
  7887. ; 59\
  7888. \
  7889. ####################\
  7890. # #     #          #\
  7891. #       $  ## ### ##\
  7892. #####  ##   $  $   #\
  7893. ##..##  # # $ # #  #\
  7894. #....  $     ##$# ##\
  7895. #....  $#####   #$##\
  7896. ##..# #  #   #  $  #\
  7897. ###.# #  $   $  # @#\
  7898. ##  $  $ #   #  ####\
  7899. ##       ###########\
  7900. ####################\
  7901. ; 60\
  7902. \
  7903. ####################\
  7904. #     ###..###     #\
  7905. # $$  ###..###  $@ #\
  7906. #  # ##......#  $  #\
  7907. #     #......#  $  #\
  7908. ####  ###..######$ #\
  7909. #   $$$ #..#    #  #\
  7910. # $#   $  $  $$ #$ #\
  7911. #  #  ## $  ##  #  #\
  7912. # $    $ ## $    $ #\
  7913. #  #  ##    ##  #  #\
  7914. ####################\
  7915. ; 61\
  7916. \
  7917. ####################\
  7918. #    #  # #  #  #  #\
  7919. # @# # ## $   $   ##\
  7920. #### #    #  # $   #\
  7921. #    # ## #$ ## ## #\
  7922. #      $   $   $   #\
  7923. #..###$$## $##$ ## #\
  7924. #..#.#  # $   $ #  #\
  7925. #....# $$   ##$ ####\
  7926. #....#  #####      #\
  7927. #...###        ##  #\
  7928. ####################\
  7929. ; 62\
  7930. \
  7931. ####################\
  7932. #....#       #  #  #\
  7933. #....# # $  $      #\
  7934. #.... ##  $# # $#$ #\
  7935. #...#   $   $#  $  #\
  7936. #..####  # $   $$  #\
  7937. #      #### #### ###\
  7938. #        #   #     #\
  7939. # ##   #   $ # $ $ #\
  7940. # ##    $ ## $  $  #\
  7941. #     @#     #   # #\
  7942. ####################\
  7943. ; 63\
  7944. \
  7945. ####################\
  7946. #....###           #\
  7947. #....##### #  #$# ##\
  7948. #....###   #$  $   #\
  7949. #....###    $  #$$##\
  7950. ##  #### $#  #$ $  #\
  7951. ##  ####  $  $  #  #\
  7952. #@  ####$###$## $  #\
  7953. ##        #  #  $  #\
  7954. ##   ###  #  $  ####\
  7955. ########  #  #     #\
  7956. ####################\
  7957. ; 64\
  7958. \
  7959. ####################\
  7960. #     #     @#...###\
  7961. #     #      ##...##\
  7962. # # # ##$## ## ....#\
  7963. #   $ #   $$$  ....#\
  7964. ###$### $$  ### ##.#\
  7965. #     $  #    # ####\
  7966. #  $  #  ###  # #  #\
  7967. ## #$##    $  $$   #\
  7968. #   $ ##   #  # #  #\
  7969. #     #    #  #    #\
  7970. ####################\
  7971. ; 65\
  7972. \
  7973. ####################\
  7974. #     #  #...#@    #\
  7975. # #       ....#    #\
  7976. #  $  #   #....#   #\
  7977. # ##$#### ##....#  #\
  7978. # $   $  #  #...#  #\
  7979. # $$ #   #   # $$  #\
  7980. ###  $$$#   $$  $  #\
  7981. # $  #  #    # $#  #\
  7982. #   $#  #       $  #\
  7983. #  #    #    #  #  #\
  7984. ####################\
  7985. ; 66\
  7986. \
  7987. ####################\
  7988. #####@###.##...##  #\
  7989. #####$  ..#...#    #\
  7990. ####    ......#  $ #\
  7991. ###  $ #.....## # ##\
  7992. ##  $$# #####  $ $ #\
  7993. ## $# $    ##  $$  #\
  7994. ##  #  #    # $  $ #\
  7995. ##   $$ ### #$##   #\
  7996. ## $#      $ $  $ ##\
  7997. ###    #    #    ###\
  7998. ####################\
  7999. ; 67\
  8000. \
  8001. ####################\
  8002. #@     #   #       #\
  8003. ## ### ##  #### # ##\
  8004. #    # #  $$       #\
  8005. #  # # # $ # $ ## ##\
  8006. #     $ #  #$$ #   #\
  8007. #  ###  #      ## ##\
  8008. #..#.# $ #  $ #    #\
  8009. #..#.#  $ # ## $$  #\
  8010. #....##   $$  $  # #\
  8011. #.....##        #  #\
  8012. ####################\
  8013. ; 68\
  8014. \
  8015. ####################\
  8016. #  #      #   #   ##\
  8017. # $# $ $ ##...$  $ #\
  8018. #  $  # ##....# $  #\
  8019. # ## $ ##....#   $ #\
  8020. # $    #....## $   #\
  8021. # $##  #...#       #\
  8022. #   $$$##$##  ### ##\
  8023. # # #  #   #  #    #\
  8024. # $ #  $  ##       #\
  8025. #    #    #@       #\
  8026. ####################\
  8027. ; 69\
  8028. \
  8029. ####################\
  8030. #  #  # #    #  #  #\
  8031. #   $      $ $     #\
  8032. ## #  #$###$##  ## #\
  8033. #   $     $  #  $  #\
  8034. # ###$##$#   # $   #\
  8035. # #   $ $  ###### $#\
  8036. # $  $$ $  #@#.#...#\
  8037. # #     #  # #.#...#\
  8038. # ########## #.....#\
  8039. #            #.....#\
  8040. ####################\
  8041. ; 70\
  8042. \
  8043. ####################\
  8044. #  #     #  ##    ##\
  8045. # $#   $ #     ##  #\
  8046. # $  $  #..#     $ #\
  8047. # $ $  #....#   # ##\
  8048. # $#  #......### $ #\
  8049. #   #  #....#  #$  #\
  8050. # $  ####..#   #   #\
  8051. ## $   ## # # $  $##\
  8052. ### $    $#@$ $#   #\
  8053. ####   #       #   #\
  8054. ####################\
  8055. ; 71\
  8056. \
  8057. ####################\
  8058. #      ....#    ####\
  8059. #      ....        #\
  8060. # # ##########     #\
  8061. # #$   #      ###..#\
  8062. #  $   #$$###   #..#\
  8063. # $ ### $   $   #..#\
  8064. # $ #   $ $ #  ##..#\
  8065. #  #  $$ # $ ##   ##\
  8066. #@## $#  $  $     ##\
  8067. ##       ##   #  ###\
  8068. ####################\
  8069. ; 72\
  8070. \
  8071. ####################\
  8072. #        #   #@ #  #\
  8073. # $$  #$$# # #  ## #\
  8074. #  # $ $ #$$ #     #\
  8075. ## #  #  # # #  #  #\
  8076. #   ##       #     #\
  8077. #   # $ #   #   #  #\
  8078. # $ #$ #   #  $ #..#\
  8079. ##$ #  ####    #...#\
  8080. #  $          #....#\
  8081. #   #  #     #.....#\
  8082. ####################\
  8083. ; 73\
  8084. \
  8085. ####################\
  8086. #     #   #####    #\
  8087. ## $  #   ####  $  #\
  8088. #### $$   #..#  #  #\
  8089. #  $  $  ##..#### ##\
  8090. # $   ###....   $$ #\
  8091. #  #$#   ....# # $ #\
  8092. # #  # $ ..###$#   #\
  8093. # #   $ #..#   ##  #\
  8094. #   $#  ####   # $##\
  8095. # #  #    @#      ##\
  8096. ####################\
  8097. ; 74\
  8098. \
  8099. ####################\
  8100. #   #   #    #   #@#\
  8101. #   $  $     # $ # #\
  8102. ##$# $### #    $$# #\
  8103. #  #  #.###  #$ $  #\
  8104. #  #$#....#  # ### #\
  8105. # $  #.....##    # #\
  8106. ##$  #.#....#$$ $  #\
  8107. #  ######..## #  # #\
  8108. #  $         $ ### #\
  8109. #   #   #        # #\
  8110. ####################\
  8111. ; 75\
  8112. \
  8113. ####################\
  8114. # # # #   #@##   # #\
  8115. #             $    #\
  8116. #  ##$# ##### $ # ##\
  8117. ##    ##.....#  #  #\
  8118. ##$##$#.....###$#$ #\
  8119. #   # ##.....#  # ##\
  8120. #  $    ##..##  #  #\
  8121. # $ #   $   $  $$$ #\
  8122. ## $  $# #  #  $   #\
  8123. #   ##   #  #      #\
  8124. ####################\
  8125. ; 76\
  8126. \
  8127. ######  #####\
  8128. #    #  #   #\
  8129. # $  #### $ #\
  8130. # $      $  #\
  8131. #  ###@###$ #\
  8132. ########## ###\
  8133. #..   ##     #\
  8134. #..   ##$    #\
  8135. #..   ## $   #\
  8136. #..   ## $   #\
  8137. #..     $ $  #\
  8138. ###  #########\
  8139.  ####\
  8140. ; 77\
  8141. \
  8142.       ###########\
  8143.       #         #\
  8144.       #    $ $  #\
  8145. ###### # $ ##### #\
  8146. #    ##### $  ##$#\
  8147. #       $ $      #\
  8148. #          ## ## #\
  8149. #    ##@##### ## #\
  8150. #    ####   # ## ##\
  8151. #....#      # $   #\
  8152. #....#      #     #\
  8153. ######      #######\
  8154. ; 78\
  8155. \
  8156. #############\
  8157. #           #\
  8158. # ### $$    #\
  8159. #   # $  $  #\
  8160. #  $####$######\
  8161. # $ ##        #####\
  8162. #  $$ $        ...#\
  8163. ### ## $$#     ...#\
  8164.  # ##   #     ...#\
  8165.  #      #     ...#\
  8166.  ###@#############\
  8167.    ###\
  8168. ; 79\
  8169. \
  8170.  #################\
  8171. ###@##         ...#\
  8172. #    #         ...#\
  8173. # $  #         ...#\
  8174. # $$ #         ...#\
  8175. ## $ ###$##########\
  8176. # ###  $ #\
  8177. ##   $  $ #\
  8178. #  $ #  $ #\
  8179. # $  #    #\
  8180. #  $ #    #\
  8181. #    #    #\
  8182. ###########\
  8183. ; 80\
  8184. \
  8185.              #####\
  8186.     ##########   #\
  8187.     #        #   #\
  8188.     #  $ $    $$ #\
  8189.     # ##### ## $ #\
  8190.     #$$   #$## $ #\
  8191.     # ### # ##$  #\
  8192. ###### ### $ $    #\
  8193. #....        ##   #\
  8194. #....        ######\
  8195. #....        #\
  8196. ###########@##\
  8197.          ###\
  8198. ; 81\
  8199. \
  8200.    ######\
  8201. ####    #\
  8202. #    ## #\
  8203. # $     #\
  8204. ### #### ########\
  8205. #  $   $ ##  ...#\
  8206. #   $$ $$    ...#\
  8207. #    $  $##  ...#\
  8208. ##@## ## ##  ...#\
  8209. ###  $  ########\
  8210. #   $$  #\
  8211. #    #  #\
  8212. #########\
  8213. ; 82\
  8214. \
  8215. ####### #########\
  8216. #     # #   ##  #\
  8217. # ### # #   $   #\
  8218. # # $ ###   $   #\
  8219. #   $$      ##$ #\
  8220. #    ####   ##  #\
  8221. #@############ ##\
  8222. ###..    #####$ #\
  8223.  #..    ####   #\
  8224.  #..       $$  #\
  8225.  #..    #### $ #\
  8226.  #..    #  #   #\
  8227.  ########  #####\
  8228. ; 83\
  8229. \
  8230. #######\
  8231. #     ##########\
  8232. #     #    #  ##\
  8233. # $   #   $ $  #\
  8234. #  $  #  $ ##  #\
  8235. # $$  ##$ $    #\
  8236. ## #  ## #######\
  8237. ## #  ##    ...#\
  8238. #  #$       ...#\
  8239. #   $$      ...#\
  8240. #     ##@#  ...#\
  8241. ################\
  8242. ; 84\
  8243. \
  8244. ############\
  8245. #      #   ##\
  8246. # $  $   #  ######\
  8247. ####  #####      #\
  8248. #..  #     #### #\
  8249. #.####  ####    #\
  8250. #....    #  $ ####\
  8251. # ...#   # $$$#  ##\
  8252. ###.#### ##  $@$   #\
  8253. #     ##### $ #    #\
  8254. # #.# $      $###$ #\
  8255. # #.########  #  $ #\
  8256. # #..        ##  $ #\
  8257. # # ####### $ # #  #\
  8258. #   #     #       ##\
  8259. #####     ##########\
  8260. ; 85\
  8261. \
  8262. ################\
  8263. #       #@ #   #\
  8264. # # # # # $  $$#\
  8265. # #...# #$$$   #\
  8266. #  ...# # $  $$##\
  8267. # ##.## # ##    #\
  8268. # #...     $    #\
  8269. # ## ###  #######\
  8270. #    # ####\
  8271. ######\
  8272. ; 86\
  8273. \
  8274.    #####\
  8275. ####   ## #####\
  8276. #  $    ###   #\
  8277. # $@$ $    $  #\
  8278. # #$######## ##\
  8279. # #  $  #     #\
  8280. # # $ $ # #   #\
  8281. ## #  $# # #####\
  8282. #  ##    #     #\
  8283. #    $ # ###   #\
  8284. ##### ##  #....#\
  8285. #    $     ....#\
  8286. #         #....#\
  8287. ################\
  8288. ; 87\
  8289. \
  8290. #############\
  8291. #........####\
  8292. #...#### #  #####\
  8293. #...#  ###    $ #\
  8294. #...$$     $ $  #\
  8295. #  .#  $ $# $  ##\
  8296. #...# #$#   $  #\
  8297. #.# # $   $    #\
  8298. #.  #$###$####$#\
  8299. ##  #   $ $    #\
  8300. #  #  $@$  #  #\
  8301. #  # #### $  $#\
  8302. #  #    ###   #\
  8303. #  # $$ # #####\
  8304. #  #    #\
  8305. #########\
  8306. ; 88\
  8307. \
  8308. ##################\
  8309. #   $       ...#.##\
  8310. #       ####..... #\
  8311. # #######  #..... #\
  8312. # #    $ $ ##....##\
  8313. # #  $ # # ###...#\
  8314. # # $@$ $  ##### #\
  8315. ## #  $  $ $$   $ #\
  8316. #  #$# $#   # $## #\
  8317. # ##    ## ## $ # #\
  8318. # # $# $ $  #     #\
  8319. # #         #######\
  8320. # ########$##   #\
  8321. #        #  $   #\
  8322. ########    #####\
  8323.       ###  #\
  8324.         ####\
  8325. ; 89\
  8326. \
  8327. ####################\
  8328. #..#    #          #\
  8329. #.$  $  #$$  $## $##\
  8330. #.$#  ###  ## ##   #\
  8331. #  # $ #  $$   $   #\
  8332. # ###  # #  #$  ####\
  8333. #  ## # $   #@ #   #\
  8334. # $    $  ##.##  $ #\
  8335. #  # $# $# $     ###\
  8336. #  #  #  #   ###   #\
  8337. #  ######## #      #\
  8338. #           #  #.#.#\
  8339. ##$########$#   ...#\
  8340. #    .*  #    ##.#.#\
  8341. # .*...*   $  .....#\
  8342. ####################\
  8343. ; 90\
  8344. ",
  8345.   diskmaker = "local args = {...}\
  8346. side = args[1]\
  8347. label = args[2]\
  8348. folder = args[3]\
  8349. \
  8350. shell.run(\"clear\")\
  8351. textutils.slowPrint(\"Disk Writer\")\
  8352. while true do\
  8353.  local event = os.pullEvent(\"disk\")\
  8354.  if disk.hasData(side) then\
  8355.    if fs.isDir(folder) then\
  8356.      local tFiles = fs.list(folder)\
  8357.      for i,v in pairs(tFiles) do\
  8358.        --print(v)\
  8359.        fs.copy(folder..\"/\"..v,\"disk/\"..v)\
  8360.      end\
  8361.      disk.setLabel(side, label)\
  8362.      disk.eject(side)\
  8363.    end\
  8364.  else\
  8365.    print(\"Incorrect disk type!\")\
  8366.    disk.eject(\"top\")\
  8367.    disk.eject(\"bottom\")\
  8368.    disk.eject(\"left\")\
  8369.    disk.eject(\"right\")\
  8370.    disk.eject(\"back\")\
  8371.    disk.eject(\"front\")\
  8372.  end\
  8373. end",
  8374.   [ "redcast/files/lang/it" ] = "-- Italian - Italiano\
  8375. -- Language File by Ale2610 - File lingua da Ale2610\
  8376. \
  8377. return {\
  8378.  start = {\
  8379.    welcome = \"Benvenuto in RedCast.\",\
  8380.    revolution = \"La console rivoluzionaria.\",\
  8381.    setup = \"Premi DEL per entrare nella configurazione.\",\
  8382.    free = \"Hai %free% bytes rimasti.\"\
  8383.  },\
  8384.  disk = {\
  8385.    detect = \"Disco individuato.\",\
  8386.    media = \"Disco media individuato.\",\
  8387.    playquestion = \"Vorresti ascoltare una canzone?\",\
  8388.    play = \"In ascolto: %title%\"\
  8389.  },\
  8390.  gui = {\
  8391.    advancedonly = \"Questa interfaccia utente non supporta i computer preistorici.\",\
  8392.    menu = {\
  8393.      restart = \"Riavvia\",\
  8394.      shutdown = \"Spegni\",\
  8395.      chatmanager = \"Chat\",\
  8396.      paint = \"Paint\",\
  8397.      redspace = \"RedSpace\",\
  8398.      floppy = \"Floppy\",\
  8399.      credits = \"Crediti\"\
  8400.    },\
  8401.    paint = {\
  8402.      open = \"Inserisci il nome del nuovo/esistente file: \"\
  8403.    },\
  8404.    redspace = {\
  8405.      id = \"Inserisci ID Server: \"\
  8406.    }\
  8407.  }\
  8408. }",
  8409.   [ "bankvault/startgame" ] = "--[[\
  8410.     Bank Vault\
  8411.     \
  8412.     Based on Sokoban, by Hiroyuki Imabayashi\
  8413.     Get the money into the storage spots in as few moves as possible!\
  8414.     \
  8415.     Written by: Nitrogen Fingers\
  8416. ]]--\
  8417. \
  8418. local version = 1.0\
  8419. local reponame = \"Bank Vault\"\
  8420. local requiresColour = true\
  8421. if requiresColour then\
  8422.     print(\"This game can only be played on an Advanced Computer.\")\
  8423. end\
  8424. \
  8425. local function displayNitrosoftTitle()\
  8426.     shell.run(\"clear\")\
  8427.     local _w,_h = term.getSize()\
  8428.     local _t1,_t2 = \"nitrosoft\", \"games\"\
  8429.     term.setCursorPos(math.floor(_w/2-#_t1), math.floor(_h/2))\
  8430.     if term.isColour() then term.setTextColour(colours.blue) end\
  8431.     term.write(_t1)\
  8432.     term.setCursorPos(math.floor(_w/2-#_t2/2),math.floor(_h/2)+1)\
  8433.     term.setTextColour(colours.white)\
  8434.     term.write(_t2)\
  8435.     term.setCursorPos(math.floor(_w/2-#_t1), math.floor(_h/2)+2)\
  8436.     if term.isColour() then term.setTextColour(colours.red) end\
  8437.     term.write(string.rep(\"-\",#_t1*2))\
  8438.     if term.isColour() then\
  8439.         term.setTextColour(colours.orange)\
  8440.         term.setBackgroundColour(colours.yellow)\
  8441.         term.setCursorPos(_w/2+#_t1-4, math.floor(_h/2)-2)\
  8442.         term.write(\"LL\")\
  8443.         term.setCursorPos(_w/2+#_t1-4, math.floor(_h/2)-1)\
  8444.         term.write(\"LL\")\
  8445.         term.setBackgroundColour(colours.brown)\
  8446.         term.setCursorPos(_w/2+#_t1-3, math.floor(_h/2)-1)\
  8447.         term.write(\"  \")\
  8448.         term.setCursorPos(_w/2+#_t1-3, math.floor(_h/2))\
  8449.         term.write(\"  \")\
  8450.     end\
  8451.     term.setBackgroundColour(colours.black)\
  8452.     term.setTextColour(colours.white)\
  8453.     term.setCursorPos(1,_h)\
  8454.     term.write(\"v\"..version)\
  8455.     os.pullEvent(\"key\")\
  8456. end\
  8457. displayNitrosoftTitle()\
  8458. \
  8459. local w,h = term.getSize()\
  8460. \
  8461. local levels = {}\
  8462. \
  8463. local mapcopy = nil\
  8464. local px,py = 0,0\
  8465. local movestack = {}\
  8466. \
  8467. local inLevel = false\
  8468. local playing = true\
  8469. local beginnerMode = false\
  8470. \
  8471. local inMainMenu = false\
  8472. \
  8473. local pack = \"Boxxle1.txt\"\
  8474. \
  8475. local style = {\
  8476.     [\"#\"] = {\
  8477.         bg = colours.brown;\
  8478.         char = \" \";\
  8479.     };\
  8480.     [\"@\"] = {\
  8481.         fg = colours.red;\
  8482.         char = \"&\";\
  8483.     };\
  8484.     [\"!\"] = {\
  8485.         bg = colours.yellow;\
  8486.         fg = colours.red;\
  8487.         char = \"&\";\
  8488.     };\
  8489.     [\"$\"] = {\
  8490.         fg = colours.black;\
  8491.         char = \"$\";\
  8492.     };\
  8493.     [\"*\"] = {\
  8494.         bg = colours.yellow;\
  8495.         fg = colours.black;\
  8496.         char = \"$\";\
  8497.     };\
  8498.     [\".\"] = {\
  8499.         bg = colours.yellow;\
  8500.         fg = colours.orange;\
  8501.         char = \"L\";\
  8502.     };\
  8503.     bg = colours.lightGrey;\
  8504.     outside = colours.grey;\
  8505. }\
  8506. mainLevel = {\
  8507.     \"#########################\";\
  8508.     \"#              ##       #\";\
  8509.     \"#              #.       ##\";\
  8510.     \"#              ##    #   #\";\
  8511.     \"#              #.  $  @  #\";\
  8512.     \"##             ##    #   #\";\
  8513.     \" #             #.        #\";\
  8514.     \" #           ####        #\";\
  8515.     \" ######      #.      #####\";\
  8516.     \"      ################\";\
  8517.     width = 26;\
  8518.     height = 10;\
  8519.     title = \"Main Menu\";\
  8520. }\
  8521. for y=1,#mainLevel do\
  8522.     local str = mainLevel[y]\
  8523.     mainLevel[y] = {}\
  8524.     for i=1,#str do\
  8525.         mainLevel[y][i] = string.sub(str,i,i)\
  8526.     end\
  8527. end\
  8528. \
  8529. local menuOptions = { \"Load Pack\", \"Choose Level\", \"Help\", \"Quit\" }\
  8530. \
  8531. local function drawTile(x, y, tile)\
  8532.     if not tile then \
  8533.         tile = mapcopy[y][x] \
  8534.         if px == x and py == y then\
  8535.             if tile == \" \" then tile = \"@\"\
  8536.             else tile = \"!\" end\
  8537.         end\
  8538.         x = x + mapcopy.doffx - 1\
  8539.         y = y + mapcopy.doffy - 1\
  8540.     end\
  8541.     if style[tile].bg then\
  8542.         term.setBackgroundColour(style[tile].bg)\
  8543.     else term.setBackgroundColour(style.bg) end\
  8544.     if style[tile].fg then\
  8545.         term.setTextColour(style[tile].fg)\
  8546.     end\
  8547.     term.setCursorPos(x,y)\
  8548.     term.write(style[tile].char)\
  8549. end\
  8550. \
  8551. local function drawSpace(x, y, map, knowninside)\
  8552.     if map[y][x] == \".\" then\
  8553.         drawTile(x,y)\
  8554.         return\
  8555.     end\
  8556. \
  8557.     local outside = true\
  8558.     \
  8559.     if not knowninside then\
  8560.         for a = x-1,1,-1 do\
  8561.             if map[y][a] ~= \" \" then\
  8562.                 outside = false\
  8563.                 break\
  8564.             end\
  8565.         end\
  8566.         if not outside then\
  8567.             outside = true\
  8568.             for a = x+1,#map[y],1 do\
  8569.                 if map[y][a] ~= \" \" then\
  8570.                     outside = false\
  8571.                     break\
  8572.                 end\
  8573.             end \
  8574.         end\
  8575.         if not outside then \
  8576.             outside = true\
  8577.             for a = y-1,1,-1 do\
  8578.                 if map[a][x] and map[a][x] ~= \" \" then\
  8579.                     outside = false\
  8580.                     break\
  8581.                 end\
  8582.             end \
  8583.         end\
  8584.         if not outside then \
  8585.             outside = true\
  8586.             for a = y+1,#map,1 do\
  8587.                 if map[a][x] and map[a][x] ~= \" \" then\
  8588.                     outside = false\
  8589.                     break\
  8590.                 end\
  8591.             end \
  8592.         end\
  8593.     else\
  8594.         outside = false\
  8595.     end\
  8596.     \
  8597.     if outside then\
  8598.         term.setBackgroundColour(style.outside)\
  8599.     else\
  8600.         term.setBackgroundColour(style.bg)\
  8601.     end\
  8602.     term.setCursorPos(map.doffx + x - 1, map.doffy + y - 1)\
  8603.     term.write(\" \")\
  8604. end\
  8605. \
  8606. local function createMapCopy(map)\
  8607. \
  8608.     mapcopy = { \
  8609.         title = map.title,\
  8610.         width = map.width, \
  8611.         height = map.height,\
  8612.         doffx = math.ceil(w/2 - map.width/2),\
  8613.         doffy = math.ceil(h/2 - map.height/2) + 1;\
  8614.     }\
  8615.     for y=1,#map do\
  8616.         mapcopy[y] = {}\
  8617.         for x=1,#map[y] do\
  8618.             if map[y][x] == \"@\" then\
  8619.                 mapcopy[y][x] = \" \"\
  8620.                 px = x\
  8621.                 py = y\
  8622.             else\
  8623.                 mapcopy[y][x] = map[y][x]\
  8624.             end\
  8625.         end\
  8626.     end\
  8627. end\
  8628. \
  8629. local function drawBanner(complete)\
  8630.     local title = nil\
  8631.     term.setBackgroundColour(style[\"#\"].bg)\
  8632.     term.setTextColour(style[\".\"].bg)\
  8633.     if inMainMenu then\
  8634.         title = \"  Bank Vault  \"\
  8635.         term.setCursorPos(w/2-#title/2,3)\
  8636.         term.write(title)\
  8637.         title = \"  By Nitrogen Fingers  \"\
  8638.         term.setCursorPos(w/2-#title/2,h-2)\
  8639.         term.write(title)\
  8640.     else\
  8641.         if complete then\
  8642.             title = \"  Level complete! Press a key to continue  \"  \
  8643.         else\
  8644.             title = \"  \"..pack..\": \\\"\"..mapcopy.title..\"\\\"  \"\
  8645.         end\
  8646.         term.setCursorPos(w/2-#title/2,1)\
  8647.         term.write(title)\
  8648.     end\
  8649. end\
  8650. \
  8651. local function updateTurnCounter()\
  8652.     term.setCursorPos(1,h)\
  8653.     term.setBackgroundColour(style[\"#\"].bg)\
  8654.     term.setTextColour(style[\".\"].bg)\
  8655.     local turns = tostring(#movestack)\
  8656.     term.write(\" Moves: \"..turns..string.rep(\" \",4-#turns))\
  8657. end\
  8658. \
  8659. local function drawMap(map)\
  8660.     term.setBackgroundColour(style.outside)\
  8661.     term.clear()\
  8662.     for y,l in ipairs(map) do\
  8663.         for x,t in ipairs(l) do\
  8664.             if px == x and py == y then \
  8665.                 drawTile(x,y)\
  8666.             elseif t == \" \" then \
  8667.                 drawSpace(x,y,map,false)\
  8668.             else drawTile(map.doffx + x - 1, map.doffy + y - 1, t) end\
  8669.         end\
  8670.     end\
  8671. end\
  8672. \
  8673. local function parseMap(filename)\
  8674.     local path = \"/levels/\"..filename\
  8675.     if not fs.exists(path) then return false end\
  8676.     local f = fs.open(path, \"r\")\
  8677.     \
  8678.     levels = {}\
  8679.     local lastmap = { width = 0}\
  8680.     local line = f:readLine()\
  8681.     while line do\
  8682.         if string.sub(line, 1, 1) == \";\" then\
  8683.             if #lastmap > 0 then\
  8684.                 lastmap.height = #lastmap\
  8685.                 lastmap.title = string.sub(line, 3, #line)\
  8686.                 lastmap.doffx = math.ceil(w/2 - lastmap.width/2)\
  8687.                 lastmap.doffy = math.ceil(h/2 - lastmap.height/2) + 1\
  8688.                 table.insert(levels, lastmap)\
  8689.                 lastmap = { width = 0 }\
  8690.             end\
  8691.         elseif #line > 0 then\
  8692.             lastmap[#lastmap+1] = {}\
  8693.             for i=1,#line do\
  8694.                 local char = string.sub(line,i,i)\
  8695.                 lastmap[#lastmap][i] = char\
  8696.                 lastmap.width = math.max(lastmap.width, #lastmap[#lastmap])\
  8697.             end\
  8698.         end\
  8699.         line = f:readLine()\
  8700.     end\
  8701.     f:close()\
  8702. end\
  8703. \
  8704. --Prepares an undo\
  8705. local function pushMoveStack(xd,yd,push)\
  8706.     table.insert(movestack, { xd = xd, yd = yd, push = push })\
  8707. end\
  8708. \
  8709. --Performs an undo\
  8710. local function popMoveStack()\
  8711.     if #movestack == 0 then return end\
  8712.     local ox,oy = px,py\
  8713.     local last = movestack[#movestack]\
  8714.     table.remove(movestack, #movestack)\
  8715.     if last.push then\
  8716.         local tt = mapcopy[py][px]\
  8717.         local nt = mapcopy[py+last.yd][px+last.xd]\
  8718.         if nt == \"$\" then\
  8719.             mapcopy[py+last.yd][px+last.xd] = \" \"\
  8720.         elseif nt == \"*\" then\
  8721.             mapcopy[py+last.yd][px+last.xd] = \".\"\
  8722.         end\
  8723.         drawSpace(px+last.xd,py+last.yd,mapcopy,true)\
  8724.         if tt == \" \" then mapcopy[py][px] = \"$\"\
  8725.         else mapcopy[py][px] = \"*\" end\
  8726.     end\
  8727.     px = px - last.xd\
  8728.     py = py - last.yd\
  8729.     drawTile(px,py)\
  8730.     if not last.push then\
  8731.         drawSpace(ox,oy,mapcopy,true)\
  8732.     else\
  8733.         drawTile(ox,oy)\
  8734.     end\
  8735. end\
  8736. \
  8737. local function space(tile)\
  8738.     return tile == \" \" or tile == \".\"\
  8739. end\
  8740. \
  8741. --For beginners. It stops them from rolling $ into _ corners.\
  8742. local function tileSafe(x,y)\
  8743.     local xwall = not space(mapcopy[y][x-1]) or not space(mapcopy[y][x+1])\
  8744.     local ywall = not space(mapcopy[y-1][x]) or not space(mapcopy[y+1][x])\
  8745.     return not (xwall and ywall)\
  8746. end\
  8747. \
  8748. local function checkComplete(map)\
  8749.     for y=1,#map do\
  8750.         for x=1,#map[y] do\
  8751.             if map[y][x] == \"$\" then return true end\
  8752.         end\
  8753.     end\
  8754.     return false\
  8755. end\
  8756. \
  8757. local function makeMove(xd,yd)\
  8758.     local ox,oy= px,py\
  8759.     local nt = mapcopy[py+yd][px+xd]\
  8760.     if nt == \" \" or nt == \".\" then\
  8761.         py = py + yd\
  8762.         px = px + xd\
  8763.         drawSpace(ox,oy,mapcopy,true)\
  8764.         drawTile(px,py)\
  8765.         pushMoveStack(xd,yd,false)\
  8766.     elseif nt == \"$\" or nt == \"*\" then\
  8767.         local nnt = mapcopy[py+yd+yd][px+xd+xd]\
  8768.         if nnt == \" \" and (not beginnerMode or tileSafe(py+yd+yd,px+xd+xd)) then\
  8769.             py = py + yd\
  8770.             px = px + xd\
  8771.             mapcopy[py+yd][px+xd] = \"$\"\
  8772.             if nt == \"$\" then mapcopy[py][px] = \" \"\
  8773.             else mapcopy[py][px] = \".\" end\
  8774.             drawSpace(ox,oy,mapcopy,true)\
  8775.             drawTile(px,py)\
  8776.             drawTile(px+xd,py+yd)\
  8777.             pushMoveStack(xd,yd,true)\
  8778.         elseif nnt == \".\" then\
  8779.             py = py + yd\
  8780.             px = px + xd\
  8781.             mapcopy[py+yd][px+xd] = \"*\"\
  8782.             if nt == \"$\" then mapcopy[py][px] = \" \"\
  8783.             else mapcopy[py][px] = \".\" end\
  8784.             drawSpace(ox,oy,mapcopy,true)\
  8785.             drawTile(px,py)\
  8786.             drawTile(px+xd,py+yd)\
  8787.             pushMoveStack(xd,yd,true)\
  8788.             return checkComplete(mapcopy)\
  8789.         end\
  8790.     end\
  8791.     return true\
  8792. end\
  8793. \
  8794. local function runInput(key)\
  8795.     local gover = true\
  8796.     if key == keys.up then gover = makeMove(0,-1)\
  8797.     elseif key == keys.down then gover = makeMove(0,1)\
  8798.     elseif key == keys.left then gover = makeMove(-1,0)\
  8799.     elseif key == keys.right then gover = makeMove(1,0)\
  8800.     end\
  8801.     return gover\
  8802. end\
  8803. \
  8804. local function playLevel(i)\
  8805.     createMapCopy(levels[i])\
  8806.     movestack = {}\
  8807.     drawMap(mapcopy)\
  8808.     drawBanner(false)\
  8809.     updateTurnCounter()\
  8810.     inLevel = true\
  8811.     playing = true\
  8812.     while inLevel and playing do\
  8813.         local _,key = os.pullEvent(\"key\")\
  8814.         inLevel = runInput(key)\
  8815.         updateTurnCounter()\
  8816.         if key == keys.enter then playing = false\
  8817.         elseif key == keys.u then popMoveStack()\
  8818.             updateTurnCounter()\
  8819.         elseif key == keys.r then\
  8820.             createMapCopy(levels[i])\
  8821.             drawMap(mapcopy)\
  8822.             movestack = {}\
  8823.             drawBanner(false)\
  8824.             updateTurnCounter()\
  8825.         end\
  8826.     end\
  8827.     if not inLevel then\
  8828.         drawBanner(not inLevel)\
  8829.         os.pullEvent(\"key\")\
  8830.     end\
  8831.     return playing\
  8832. end\
  8833. \
  8834. local function wprintLeft(msg, height, width, offset)\
  8835.     local inc = 0\
  8836.     local ops = 1\
  8837.     while #msg - ops > width do\
  8838.         local nextspace = 0\
  8839.         while string.find(msg, \" \", ops + nextspace) and\
  8840.                 string.find(msg, \" \", ops + nextspace) - ops < width do\
  8841.             nextspace = string.find(msg, \" \", nextspace + ops) + 1 - ops\
  8842.         end\
  8843.         if nextspace == 0 then nextspace = width end\
  8844.         local ox,oy = term.getCursorPos()\
  8845.         term.setCursorPos(offset, height + inc)\
  8846.         inc = inc + 1\
  8847.         term.write(string.sub(msg, ops, nextspace + ops - 1))\
  8848.         ops = ops + nextspace\
  8849.     end\
  8850.     term.setCursorPos(offset, height + inc)\
  8851.     term.write(string.sub(msg, ops))\
  8852.     return inc + 1\
  8853. end\
  8854. \
  8855. local function runHelpScreen()\
  8856.     term.setBackgroundColour(style.outside)\
  8857.     term.clear()\
  8858.     \
  8859.     for i = 1,14 do\
  8860.         term.setCursorPos(3, 3+i)\
  8861.         term.setBackgroundColour(style[\"#\"].bg)\
  8862.         if i==1 or i==14 then\
  8863.             term.write(string.rep(\" \", 45))\
  8864.         else\
  8865.             term.write(\" \")\
  8866.             term.setBackgroundColour(style.bg)\
  8867.             term.write(string.rep(\" \", 43))\
  8868.             term.setBackgroundColour(style[\"#\"].bg)\
  8869.             term.write(\" \")\
  8870.         end\
  8871.     end\
  8872.     \
  8873.     local _m1 = [[The goal of each level is to guide the warehouse keeper to push each bag of money into the empty spaces. Only when each space has bag in it is the level complete.]]\
  8874.     term.setBackgroundColour(style.bg)\
  8875.     local inc = wprintLeft(_m1,5,38,5)\
  8876.     \
  8877.     term.setCursorPos(5, 6 + inc)\
  8878.     term.write(\"Arrows: Move\")\
  8879.     term.setCursorPos(25, 6 + inc)\
  8880.     term.write(\"Enter: Quit Level\")\
  8881.     term.setCursorPos(5, 7 + inc)\
  8882.     term.write(\"U: Undo Move\")\
  8883.     term.setCursorPos(25, 7 + inc)\
  8884.     term.write(\"R: Restart Level\")\
  8885.     term.setCursorPos(8, 10 + inc)\
  8886.     term.write(\"Press enter to continue\")\
  8887.     \
  8888.     os.pullEvent(\"key\")\
  8889. end\
  8890. \
  8891. local function drawPackList(levelLot,sel)\
  8892.     term.setBackgroundColour(style.outside)\
  8893.     term.clear()\
  8894.     local minLev = ((levelLot-1) * 10 + 1)\
  8895.     local maxLev = minLev + math.min(10, #levelList - (levelLot-1) * 10) - 1\
  8896.     \
  8897.     term.setBackgroundColour(style[\"#\"].bg)\
  8898.     term.setTextColour(style[\".\"].bg)\
  8899.     term.setCursorPos(7, 2)\
  8900.     local msg = \"Levels \"..minLev..\" to \"..maxLev..\" of \"..#levelList\
  8901.     term.write(msg)\
  8902.     \
  8903.     term.setTextColour(colours.yellow)\
  8904.     term.setCursorPos(4, 2)\
  8905.     if levelLot > 1 then term.write(\"<- \")\
  8906.     else term.write(\"   \") end \
  8907.     \
  8908.     term.setCursorPos(7 + #msg, 2)\
  8909.     if maxLev < #levelList then term.write(\" ->\")\
  8910.     else term.write(\"  \") end\
  8911.     \
  8912.     for i = 1,12 do\
  8913.         term.setCursorPos(12, 3+i)\
  8914.         term.setBackgroundColour(style[\"#\"].bg)\
  8915.         if i==1 or i==12 then\
  8916.             term.write(string.rep(\" \", 25))\
  8917.         else\
  8918.             term.write(\" \")\
  8919.             term.setBackgroundColour(style.bg)\
  8920.             term.write(string.rep(\" \", 23))\
  8921.             term.setBackgroundColour(style[\"#\"].bg)\
  8922.             term.write(\" \")\
  8923.         end\
  8924.     end\
  8925.     \
  8926.     for i = 1,10 do\
  8927.         term.setBackgroundColour(style.bg)\
  8928.         term.setCursorPos(14, 5+i)\
  8929.         if i + (levelLot-1)*10 - 1 < maxLev then\
  8930.             if i == sel then \
  8931.                 term.setTextColour(style[\".\"].bg)\
  8932.                 term.write(\"$ \")\
  8933.             else \
  8934.                 term.setTextColour(colours.black)\
  8935.                 term.write(\"  \") \
  8936.             end\
  8937.             term.write(levelList[10 * (levelLot-1) + i])\
  8938.         end\
  8939.         \
  8940.     end\
  8941. end\
  8942. \
  8943. local function runPackList()\
  8944.     local levelLot, sel = 1,1\
  8945.     drawPackList(levelLot,sel)\
  8946.     while true do\
  8947.         local _,key = os.pullEvent(\"key\")\
  8948.         if key == keys.up and sel > 1 then\
  8949.             sel = sel - 1\
  8950.         elseif key == keys.down and sel < math.min(10,#levelList-(levelLot-1)*10) then\
  8951.             sel = sel + 1\
  8952.         elseif key == keys.left and levelLot > 1 then\
  8953.             levelLot = levelLot - 1\
  8954.             sel = 1\
  8955.         elseif key == keys.right and levelLot < math.floor(#levelList/10) then\
  8956.             levelLot = levelLot + 1\
  8957.             sel = 1\
  8958.         elseif key == keys.enter then\
  8959.             pack = levelList[(levelLot-1)*10 + sel]\
  8960.             parseMap(pack)\
  8961.             break\
  8962.         end\
  8963.         drawPackList(levelLot,sel)\
  8964.     end\
  8965. end\
  8966. \
  8967. local function runMenu()\
  8968.     inMainMenu = true\
  8969.     createMapCopy(mainLevel)\
  8970.     movestack = {}\
  8971.     drawMap(mapcopy)\
  8972.     drawBanner()\
  8973.     term.setBackgroundColour(style.bg)\
  8974.     term.setTextColour(style[\"$\"].fg)\
  8975.     for y=1,#menuOptions do\
  8976.         local msg = menuOptions[y]\
  8977.         if y==#menuOptions then\
  8978.             term.setCursorPos(26-#msg, y*2 + 6)\
  8979.         else\
  8980.             term.setCursorPos(28-#msg, y*2 + 6)\
  8981.         end\
  8982.         term.write(msg)\
  8983.     end\
  8984.     \
  8985.     \
  8986.     while inMainMenu do \
  8987.         local _,key = os.pullEvent(\"key\")\
  8988.         inMainMenu = runInput(key)\
  8989.         if key == keys.u then popMoveStack()\
  8990.         elseif key == keys.r then\
  8991.             createMapCopy(mainLevel)\
  8992.             drawMap(mapcopy)\
  8993.             movestack = {}\
  8994.             drawBanner()\
  8995.             term.setBackgroundColour(style.bg)\
  8996.             term.setTextColour(style[\"$\"].fg)\
  8997.             for y=1,#menuOptions do\
  8998.                 local msg = menuOptions[y]\
  8999.                 term.setCursorPos(28-#msg, y*2 + 6)\
  9000.                 term.write(msg)\
  9001.             end\
  9002.         end\
  9003.     end\
  9004.     if mapcopy[3][17] == \"*\" then\
  9005.         return 1\
  9006.     elseif mapcopy[5][17] == \"*\" then\
  9007.         return 2\
  9008.     elseif mapcopy[7][17] == \"*\" then\
  9009.         return 3\
  9010.     else\
  9011.         return 4\
  9012.     end\
  9013. end\
  9014. \
  9015. local function runLevelSelect()\
  9016.     local currLevel = 1\
  9017.     local selection = false\
  9018.     repeat\
  9019.         drawMap(levels[currLevel])\
  9020.         local msg = pack..\" level \"..currLevel..\"/\"..#levels..\": \"..levels[currLevel].title\
  9021.         term.setCursorPos(w/2-#msg/2,2)\
  9022.         term.setBackgroundColour(colours.brown)\
  9023.         term.setTextColour(colours.yellow)\
  9024.         term.write(msg)\
  9025.         msg = \"Arrows to change, enter to select, Q to go back\"\
  9026.         term.setCursorPos(w/2-#msg/2,h-1)\
  9027.         \
  9028.         local _,key = os.pullEvent(\"key\")\
  9029.         \
  9030.         if (key == keys.right or key == keys.down) and currLevel < #levels then\
  9031.             currLevel = currLevel + 1\
  9032.         elseif (key == keys.left or key == keys.up) and currLevel > 1 then\
  9033.             currLevel = currLevel - 1\
  9034.         elseif key == keys.enter then\
  9035.             return currLevel\
  9036.         elseif key == keys.q then\
  9037.             return #levels+1\
  9038.         end\
  9039.     until selection == true\
  9040. end\
  9041. \
  9042. if not fs.exists(shell.resolve(\".\")..\"/levels\") then\
  9043.     error(\"Level directory not present!\")\
  9044. end\
  9045. levelList = fs.list(shell.resolve(\".\")..\"/levels\")\
  9046. if #levelList == 0 then\
  9047.     error(\"Level directory is empty!\")\
  9048. end\
  9049. if fs.exists(shell.resolve(\".\")..\"/levels/Original.txt\") then\
  9050.     pack = \"Original.txt\"\
  9051. else\
  9052.     pack = levelList[1]\
  9053. end\
  9054. parseMap(pack)\
  9055. \
  9056. local val = 0\
  9057. repeat\
  9058.     val = runMenu()\
  9059.     if val == 1 then\
  9060.         runPackList()\
  9061.     elseif val == 2 then \
  9062.         lev = runLevelSelect()\
  9063.         for i=lev,#levels do\
  9064.             if not playLevel(i) then break end\
  9065.         end\
  9066.     elseif val == 3 then\
  9067.         runHelpScreen()\
  9068.     end\
  9069. until val == 4\
  9070. term.setBackgroundColour(colours.black)\
  9071. term.setTextColour(colours.white)\
  9072. shell.run(\"clear\")\
  9073. \
  9074. print(\"Want more levels? Visit http://www.sourcecode.se/sokoban/levels\")",
  9075.   [ "goldrunner/levels/classic_011" ] = "bbbbbbbbbb       5                    bbbbbbbbbb\
  9076. bbbbbbbbbb e4    c                 4e bbbbbbbbbb\
  9077. bbbbbbbbbbcbbe4  c               4ebbcbbbbbbbbbb\
  9078. bbbbbbbbbbc  bb  cbbbb8cbbbbbc   bb  cbbbbbbbbbb\
  9079. bbbbbbbbbbc           cc4    c       cbbbbbbbbbb\
  9080. bbbbbbbbbbc           4cc    c       cbbbbbbbbbb\
  9081. bbbbbbbbbbc           cc4            cbbbbbbbbbb\
  9082. bbbbbbbbbbc           4cc            cbbbbbbbbbb\
  9083. bbbbbbbbbbc           cc4            cbbbbbbbbbb\
  9084. bbbbbbbbbbc           4cc            cbbbbbbbbbb\
  9085. bbbbbbbbbbc           cc4            cbbbbbbbbbb\
  9086. bbbbbbbbbbc           4cc            cbbbbbbbbbb\
  9087. bbbbbbbbbbc           cc4            cbbbbbbbbbb\
  9088. bbbbbbbbbbc           4cc            cbbbbbbbbbb\
  9089. bbbbbbbbbbc       0   cc4            cbbbbbbbbbb\
  9090. bbbbbbbbbbc    cbbbbbbbbbbbbbbbbc    cbbbbbbbbbb\
  9091. 7777777777777777777777777777777777777777777777777",
  9092.   [ "laserblast/startgame" ] = "--  LaserBlast\
  9093. --       By NitrogenFingers\
  9094. \
  9095. local w,h = term.getSize()\
  9096. local plpos = math.floor(w/2)\
  9097. \
  9098. --music stuff\
  9099. local minterval = 1\
  9100. local mtimer = 1\
  9101. local left = false\
  9102. \
  9103. local level = 1\
  9104. local score = 0\
  9105. local gameover=false\
  9106. local killc = 0\
  9107. \
  9108. --x,y,dir\
  9109. local projlist = {}\
  9110. --x,y,intvspeed,dtimer\
  9111. local baddylist = {}\
  9112. local btimer = 0\
  9113. local bintv = 1\
  9114. local utime = 0.05\
  9115. local bsmp = 6\
  9116. local powerup = 0\
  9117. \
  9118. --Landscape and stars\
  9119. local stars = {}\
  9120. for i=1,math.random()*10+10 do\
  9121.  stars[i] = { x = math.ceil(math.random()*w),\
  9122.    y = math.ceil(math.random() * h-8) }\
  9123. end\
  9124. local landscape = {\
  9125.  [6]=\"                       _____________              \";\
  9126.  [5]=\"          _______     /             \\\\_____        \";\
  9127.  [4]=\"         /       \\\\___/____                \\\\_________\";\
  9128.  [3]=\"        /                 \\\\                      \";\
  9129.  [2]=\"       /                   \\\\_________               \";\
  9130.  [1]=\"______/                              \\\\______________\";\
  9131. }\
  9132. \
  9133. function drawHeader()\
  9134.  if term.isColour() then term.setTextColour(colours.white) end\
  9135.  term.setCursorPos(5, 1)\
  9136.  term.write(\"Score: \"..score)\
  9137.  if score~=0 then term.write(\"00\") end\
  9138.  local lstr = \"Level: \"..level\
  9139.  term.setCursorPos(w-#lstr-5,1)\
  9140.  term.write(lstr)\
  9141.  \
  9142.  if powerup > 0 then\
  9143.    local pstr = \"POWERUP\"\
  9144.     term.setCursorPos(w/2 - #pstr/2,1)\
  9145.     if term.isColour() then term.setTextColour(colours.cyan) end\
  9146.     term.write(pstr)\
  9147.  end\
  9148. end\
  9149. \
  9150. function drawPlayer()\
  9151.  if term.isColour() then term.setTextColour(colours.white) end\
  9152.  term.setCursorPos(plpos-1, h-1)\
  9153.  term.write(\"@@@\")\
  9154. end\
  9155. \
  9156. function drawProjectile(proj)\
  9157.  if term.isColour() then term.setTextColour(colours.red) end\
  9158.  term.setCursorPos(proj.x, proj.y)\
  9159.  term.write(\"|\")\
  9160. end\
  9161. \
  9162. function drawVacance(x,y)\
  9163.  term.setCursorPos(x, y)\
  9164.  for _,baddy in pairs(baddylist) do\
  9165.    if baddy.x == x and baddy.y == y and baddy.dtimer > 0 then\
  9166.      drawBaddie(baddy)\
  9167.       return\
  9168.     end\
  9169.  end\
  9170.  \
  9171.  if y >= h-8 and y <= h-3 then\
  9172.    if term.isColour() then term.setTextColour(colours.lime) end\
  9173.    term.write(string.sub(landscape[h - y - 2], x, x))\
  9174.  elseif y < h-8 then\
  9175.     for i=1,#stars do\
  9176.       if x == stars[i].x and y == stars[i].y then \
  9177.         if term.isColour() then term.setTextColour(colours.yellow) end\
  9178.         term.write(\".\")\
  9179.         return\
  9180.      end\
  9181.     end\
  9182.     term.write(\" \")\
  9183.  else\
  9184.     term.write(\" \")\
  9185.  end\
  9186. end\
  9187. \
  9188. function drawBaddie(baddy)\
  9189.  term.setCursorPos(baddy.x, baddy.y)\
  9190.    if baddy.dtimer==0 then\
  9191.      if baddy.pup then \
  9192.        if term.isColour() then term.setTextColour(colours.blue) end\
  9193.        term.write(\"P\")\
  9194.      elseif baddy.frag then\
  9195.        if term.isColour() then term.setTextColour(colours.brown) end\
  9196.        term.write(\"*\")\
  9197.      else \
  9198.        if term.isColour() then term.setTextColour(colours.brown) end\
  9199.        term.write(\"O\") \
  9200.      end\
  9201.    else\
  9202.      if term.isColour() then term.setTextColour(colours.orange) end\
  9203.      term.write(\"#\")\
  9204.    end\
  9205. end\
  9206. \
  9207. --This now only needs to be called once. Awesome!\
  9208. function drawWorld()\
  9209.  drawLandscape()\
  9210.  drawPlayer()\
  9211.  drawHeader()\
  9212. end\
  9213. \
  9214. function drawLandscape()\
  9215.  if term.isColour() then\
  9216.    term.setTextColour(colours.yellow)\
  9217.  end\
  9218.  for i=1,#stars do\
  9219.    term.setCursorPos(stars[i].x, stars[i].y)\
  9220.    term.write(\".\")\
  9221.  end\
  9222.  \
  9223.  term.setCursorPos(1,h)\
  9224.  local land = string.rep(\"-\", w)\
  9225.  if term.isColour() then\
  9226.    term.setTextColour(colours.green)\
  9227.  end\
  9228.  term.write(land)\
  9229.  if term.isColour() then\
  9230.    term.setTextColour(colours.lime)\
  9231.  end\
  9232.  \
  9233.  for y,line in ipairs(landscape) do\
  9234.     term.setCursorPos(1,h-y-2)\
  9235.     term.write(line)\
  9236.  end\
  9237. end\
  9238. \
  9239. function updateWorld()\
  9240.  --The music stuff  \
  9241.  redstone.setOutput(\"back\", false)\
  9242.  mtimer=mtimer-utime\
  9243.  if mtimer<=0 then\
  9244.    mtimer = minterval\
  9245.    if left then\
  9246.      redstone.setOutput(\"left\", true)\
  9247.      redstone.setOutput(\"right\", false)\
  9248.    else\
  9249.      redstone.setOutput(\"left\", false)\
  9250.      redstone.setOutput(\"right\", true)\
  9251.    end\
  9252.    left = not left\
  9253.  end\
  9254. \
  9255.  local i=1\
  9256.  while i<=#projlist do\
  9257.     drawVacance(projlist[i].x, projlist[i].y)\
  9258.    projlist[i].y = projlist[i].y+projlist[i].dir\
  9259.     if projlist[i].y <= 1 or projlist[i].y > h-1 then\
  9260.      table.remove(projlist,i)\
  9261.      i=i-1\
  9262.    else drawProjectile(projlist[i]) end\
  9263.    i=i+1\
  9264.  end\
  9265.  i=1\
  9266.  while i<=#baddylist do\
  9267.    local baddy = baddylist[i]\
  9268.    baddy.timer=baddy.timer+utime\
  9269. \
  9270.    if baddy.y==h-1 and math.abs(baddy.x-plpos)<2 then\
  9271.      if baddy.pup then\
  9272.         powerup = 10\
  9273.         drawPlayer()\
  9274.      else\
  9275.        gameover = true \
  9276.        redstone.setOutput(\"back\", true)\
  9277.      end\
  9278.    end\
  9279. \
  9280.    j=1\
  9281.    while j<=#projlist do\
  9282.      local proj = projlist[j]\
  9283.      if baddy.x==proj.x and math.abs(baddy.y-proj.y)<2\
  9284.      and baddy.dtimer==0 then\
  9285.        baddy.dtimer = 0.5\
  9286.         drawBaddie(baddy)\
  9287.         drawVacance(projlist[j].x, projlist[j].y)\
  9288.        table.remove(projlist,j)\
  9289.        j=j-1\
  9290.        score=score+5\
  9291.        redstone.setOutput(\"back\", true)\
  9292.        killc=killc+1\
  9293.        if killc>5+(level*5) and level<10 then levelUp() end\
  9294.         drawHeader()\
  9295. \
  9296.        --Adds fragments\
  9297.        if math.random(1, 5) == 2 and not baddy.frag then\
  9298.          table.insert(baddylist, {\
  9299.            x = baddy.x-1,\
  9300.            y = baddy.y,\
  9301.            pup = false,\
  9302.            frag = true,\
  9303.            timer = 0,\
  9304.            dtimer = 0,\
  9305.            speed = baddy.speed/2\
  9306.          })\
  9307.           drawBaddie(baddylist[#baddylist])\
  9308.          table.insert(baddylist, {\
  9309.            x = baddy.x+1,\
  9310.            y = baddy.y,\
  9311.            pup = false,\
  9312.            frag = true,\
  9313.            timer = 0,\
  9314.            dtimer = 0,\
  9315.            speed = baddy.speed/2\
  9316.          })\
  9317.           drawBaddie(baddylist[#baddylist])\
  9318.        end\
  9319.      end\
  9320.      j=j+1\
  9321.    end\
  9322. \
  9323.    if baddy.timer>baddy.speed and baddy.dtimer==0 then\
  9324.       drawVacance(baddy.x, baddy.y)\
  9325.      baddy.y=baddy.y+1\
  9326.      if baddy.y==h then\
  9327.        table.remove(baddylist,i)\
  9328.        i=i-1\
  9329.        score=score-1\
  9330.         drawHeader()\
  9331.      else\
  9332.         drawBaddie(baddy)\
  9333.        baddy.timer = 0\
  9334.       end\
  9335.    elseif baddy.dtimer>0 then\
  9336.      baddy.dtimer=baddy.dtimer-utime\
  9337.      if baddy.dtimer<=0 then\
  9338.        drawVacance(baddy.x, baddy.y)\
  9339.         table.remove(baddylist,i)\
  9340.        i=i-1\
  9341.      end\
  9342.    end    \
  9343.    i=i+1\
  9344.  end  \
  9345.  btimer=btimer+utime\
  9346.  if btimer > bintv then\
  9347.    table.insert(baddylist, {\
  9348.      x = math.random(w/4, 3*(w/4)),\
  9349.      y = 2,\
  9350.      speed = utime*bsmp,\
  9351.      timer = 0,\
  9352.      dtimer = 0,\
  9353.      pup = math.random(1,20)==5,\
  9354.      frag = false\
  9355.    })\
  9356.     drawBaddie(baddylist[#baddylist])\
  9357.    btimer=0\
  9358.  end\
  9359. end\
  9360. \
  9361. function levelUp()\
  9362.  level=level+1\
  9363.  bintv=bintv-0.10\
  9364.  bsmp=bsmp-0.5\
  9365.  killc=0\
  9366.  minterval=minterval-0.10\
  9367. end\
  9368. \
  9369. function updatePlayer(key)\
  9370.  if powerup>0 then\
  9371.    powerup = powerup-utime\
  9372.  end\
  9373. \
  9374.  if key==203 and plpos>1 then\
  9375.     term.setCursorPos(plpos+1,h-1)\
  9376.     term.write(\" \")\
  9377.    plpos=plpos-1\
  9378.     drawPlayer()\
  9379.  elseif key==205 and plpos<w then\
  9380.     term.setCursorPos(plpos-1,h-1)\
  9381.     term.write(\" \")\
  9382.    plpos=plpos+1\
  9383.     drawPlayer()\
  9384.  elseif key==57 then\
  9385.    if powerup>0 then\
  9386.      table.insert(projlist, {\
  9387.        dir = -1,\
  9388.        x = plpos+1,\
  9389.        y = h-2\
  9390.      })\
  9391.       drawProjectile(projlist[#projlist])\
  9392.      table.insert(projlist, {\
  9393.        dir = -1,\
  9394.        x = plpos-1,\
  9395.        y = h-2\
  9396.      })\
  9397.       drawProjectile(projlist[#projlist])\
  9398.    else\
  9399.      table.insert(projlist, {\
  9400.        dir = -1,\
  9401.        x = plpos,\
  9402.        y = h-2\
  9403.      })\
  9404.       drawProjectile(projlist[#projlist])\
  9405.    end\
  9406.  end\
  9407. end\
  9408. \
  9409. term.setBackgroundColour(colours.black)\
  9410. term.clear()\
  9411. drawWorld()\
  9412. local wtimer os.startTimer(utime)\
  9413. while not gameover do\
  9414.  local e, v = os.pullEvent()\
  9415. \
  9416.  if e==\"timer\" then\
  9417.    updateWorld()\
  9418.    wtimer = os.startTimer(utime)\
  9419.  elseif e==\"key\" then\
  9420.    if v==28 then break end\
  9421.    updatePlayer(v)\
  9422.  end\
  9423. end\
  9424. \
  9425. term.setCursorPos(plpos-1, h-1)\
  9426. if term.isColour() then term.setTextColour(colours.red) end\
  9427. term.write(\"###\")\
  9428. local go = \"Game Over!\"\
  9429. term.setCursorPos(w/2 - #go/2, 10)\
  9430. if term.isColour() then term.setTextColour(colours.white) end\
  9431. term.write(go)\
  9432. term.setCursorPos(1,h)\
  9433. sleep(5)\
  9434. redstone.setOutput(\"back\", false)\
  9435. term.clear()",
  9436.   [ "goldrunner/levels/classic_006" ] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbb5bbbbbbbbbbbbbbbbbbb\
  9437. bbbbbbbbbbb 4               8b e 4   bbbbbbbbbbb\
  9438. bbbbbbbbbbb1bbbcbbbbc   4   8bbbbbbbcbbbbbbbbbbb\
  9439. bbbbbbbbbbb1bbbcbbbbbbbbbbbbbb bbb  cbbbbbbbbbbb\
  9440. bbbbbbbbbbb    c  4 e     bbbb bbb  cbbbbbbbbbbb\
  9441. bbbbbbbbbbbcbbbbbbbbbcbbbbbbbb bbb  cbbbbbbbbbbb\
  9442. bbbbbbbbbbbc   bbbbbbcbbbbb44b bbb4 cbbbbbbbbbbb\
  9443. bbbbbbbbbbbc   bbbbbbcbbbbbbbbbbbbbbcbbbbbbbbbbb\
  9444. bbbbbbbbbbbc   b    4c    4  e   4 bcbbbbbbbbbbb\
  9445. bbbbbbbbbbbc   bbbcbbbbbbbcbbbbbbbcbcbbbbbbbbbbb\
  9446. bbbbbbbbbbbc  4bbbc       cbbbbbbbcbcbbbbbbbbbbb\
  9447. bbbbbbbbbbbcbb1b  c    0  c  bb   cbcbbbbbbbbbbb\
  9448. bbbbbbbbbbbcbb1bcbbbbbcbbbbbbbb44 cbcbbbbbbbbbbb\
  9449. bbbbbbbbbbbcbb1bcbbbbbcbbbbbb4bbbbbbcbbbbbbbbbbb\
  9450. bbbbbbbbbbbce   cbb4bbc    4  e     cbbbbbbbbbbb\
  9451. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  9452. 7777777777777777777777777777777777777777777777777",
  9453.   [ "redcast/files/FloppyLoader" ] = "local w, h = term.getSize()\
  9454. local diskSide\
  9455. for i,v in pairs(peripheral.getNames()) do\
  9456.  if peripheral.getType(v) == \"drive\" then\
  9457.    diskSide = v\
  9458.  end\
  9459. end\
  9460. \
  9461. function clearScr()\
  9462.  term.clear()\
  9463.  term.setCursorPos(1,1)\
  9464. end\
  9465. \
  9466. function printCentered(string, y)\
  9467.  local x = (w/2)-(#string/2)\
  9468.  term.setCursorPos(x, y)\
  9469.  print(string)\
  9470. end\
  9471. \
  9472. function renderBase()\
  9473.  term.current().setVisible(false)\
  9474.  term.setBackgroundColour(colours.red)\
  9475.  term.setTextColour(colours.black)\
  9476.  clearScr()\
  9477.  term.setCursorPos(1,1)\
  9478.  term.setBackgroundColour(colours.white)\
  9479.  term.clearLine()\
  9480.  printCentered(\"RedCast Game Loader\", 1)\
  9481.  term.setCursorPos(w,1)\
  9482.  term.setTextColour(colours.red)\
  9483.  term.write(\"X\")\
  9484.  term.setBackgroundColour(colours.red)\
  9485.  term.setTextColour(colours.grey)\
  9486.  if disk.isPresent(diskSide) then\
  9487.    paintutils.drawPixel(w-1,1, colours.green)\
  9488.    term.setTextColour(colours.black)\
  9489.  end\
  9490.  term.setBackgroundColour(colours.red)\
  9491.  term.current().setVisible(true)\
  9492. end\
  9493. \
  9494. brunning = true\
  9495. while brunning do\
  9496.  renderBase()\
  9497.  term.setCursorPos(2,3)\
  9498.  print(\"Install\")\
  9499.  term.setCursorPos(2,4)\
  9500.  print(\"Play\")\
  9501.  --return\
  9502.  local t = os.startTimer(0.5)\
  9503.  local event, button, x, y = os.pullEvent()\
  9504.  if event == \"timer\" then\
  9505.    if button == t then\
  9506.      renderBase()\
  9507.    end\
  9508.  elseif event == \"mouse_click\" then\
  9509.    if x == w and y == 1 then\
  9510.      return\
  9511.    elseif x >= 2 and x <= 9 and y == 3 then\
  9512.      if disk.isPresent(diskSide) then\
  9513.        if fs.exists(\"disk/info\") then\
  9514.          local gameInfo = dofile(\"disk/info\")\
  9515.          fs.copy(\"disk/\"..gameInfo.sGameFile,\"games/\"..gameInfo.sName)\
  9516.          if fs.isDir(\"disk/apis\") then\
  9517.            local apiList = fs.list(\"disk/apis\")\
  9518.            for i,v in pairs(apiList) do\
  9519.              if not fs.exists(\"apis/\"..v) then\
  9520.                fs.copy(\"disk/apis/\"..v,\"apis/\"..v)\
  9521.              end\
  9522.            end\
  9523.          end\
  9524.          if gameInfo.bRequiresExtraFiles then\
  9525.            local extras = gameInfo.tExtraFiles\
  9526.            for i,v in pairs(extras) do\
  9527.              if fs.exists(\"disk/\"..v) then\
  9528.                if fs.isDir(\"disk/\"..v) then\
  9529.                  if not fs.isDir(v) then\
  9530.                    fs.makeDir(v)\
  9531.                  end\
  9532.                  local tempFiles = fs.list(\"disk/\"..v)\
  9533.                  for i,v2 in pairs(tempFiles) do\
  9534.                    if not fs.exists(v..\"/\"..v2) then\
  9535.                      fs.copy(\"disk/\"..v..\"/\"..v2,v..\"/\"..v2)\
  9536.                    end\
  9537.                  end\
  9538.                end\
  9539.                fs.copy(\"disk/\"..v,v)\
  9540.              end\
  9541.            end\
  9542.          end\
  9543.          term.clear()\
  9544.          term.setCursorPos(2,2)\
  9545.          term.write(\"Installed!\")\
  9546.          sleep(1)\
  9547.        else\
  9548.          term.clear()\
  9549.          term.setCursorPos(1,1)\
  9550.          print(\"There is a problem with your disk.\")\
  9551.          sleep(2)\
  9552.          return\
  9553.        end\
  9554.      end\
  9555.    elseif x >= 2 and x <= 6 and y == 4 then\
  9556.      if disk.isPresent(diskSide) then\
  9557.        if fs.exists(\"disk/info\") then\
  9558.          local gameInfo = dofile(\"disk/info\")\
  9559.          if fs.isDir(\"disk/apis\") then\
  9560.            local apiList = fs.list(\"disk/apis\")\
  9561.            for i,v in pairs(apiList) do\
  9562.              os.loadAPI(\"disk/apis/\"..v)\
  9563.            end\
  9564.          end\
  9565.          shell.run(\"disk/\"..gameInfo.sGameFile)\
  9566.        elseif fs.exists(\"disk/startgame\") then\
  9567.          shell.run(\"disk/startgame\")\
  9568.        else\
  9569.          term.clear()\
  9570.          term.setCursorPos(1,1)\
  9571.          print(\"There is a problem with your disk.\")\
  9572.          sleep(2)\
  9573.          return\
  9574.        end\
  9575.      end\
  9576.    end\
  9577.  end\
  9578. end",
  9579.   [ "highorlow/info" ] = "return {\
  9580.  sGameFile = \"startgame\",\
  9581.  sName = \"HighOrLow\",\
  9582. }",
  9583.   [ "highorlow/startgame" ] = "--[[\
  9584. High or low\
  9585. By Konlab\
  9586. \
  9587. ]]\
  9588. --init\
  9589. local version = 1.0\
  9590. local w,h = term.getSize()\
  9591. --functions\
  9592. local function loadscreen()\
  9593.  term.setBackgroundColor(colors.orange)\
  9594.  term.setTextColor(colors.black)\
  9595.  term.clear()\
  9596.  local text = {\"High or Low\",\"By Konlab\",\"version: \"..version}\
  9597.  for i=1,#text do\
  9598.    term.setCursorPos(math.floor(w/2-#text[i]/2),math.floor(h/2-#text/2+i))\
  9599.    term.write(text[i])\
  9600.  end\
  9601. end\
  9602. local function cl()\
  9603.  term.setBackgroundColor(colors.orange)\
  9604.  term.setTextColor(colors.black)\
  9605.  term.clear()\
  9606. end\
  9607. local function dIntf(currentNumber,moneywon)\
  9608.     cl()\
  9609.     term.setBackgroundColor(colors.white)\
  9610.     term.setCursorPos(1,1)\
  9611.     term.clearLine()\
  9612.     term.setCursorPos(1,1)\
  9613.     term.write(\"High or Low\")\
  9614.     term.setCursorPos(w,1)\
  9615.     term.write(\"x\")\
  9616.     term.setCursorPos(1,h)\
  9617.     term.setBackgroundColor(colors.green)\
  9618.     term.write(\"High\")\
  9619.     term.setBackgroundColor(colors.red)\
  9620.     term.setCursorPos(w-2,h)\
  9621.     term.write(\"Low\")\
  9622.     term.setBackgroundColor(colors.orange)\
  9623.     term.setCursorPos(1,3)\
  9624.     term.write(\"Number range: 1-20\")\
  9625.     term.setCursorPos(1,5)\
  9626.     term.write(\"Current number: \"..currentNumber)\
  9627.     term.setCursorPos(1,h-1)\
  9628.     term.write(\"Probability: \"..(20-currentNumber)*5 ..\"% / \"..(currentNumber*5)..\"%\")\
  9629.     term.setCursorPos(1,h-2)\
  9630.     term.write(\"Money won: \"..moneywon)\
  9631.     term.setCursorPos(1,math.floor(h/2)-1)\
  9632.     term.write(\"v\")\
  9633.     term.setCursorPos(1,math.floor(h/2)+1)\
  9634.     term.write(\"^\")\
  9635. end\
  9636. local function animateNums(wonNumber)\
  9637.     for i=wonNumber,wonNumber+20 do\
  9638.         term.clearLine()\
  9639.         for j=0,math.floor(w/5) do\
  9640.           term.setCursorPos(1+j*math.floor(w/5),math.floor(h/2))\
  9641.             local k\
  9642.             if i+j > 20 then k = i+j - 20 else k = i+j end\
  9643.             term.write(k)\
  9644.         end\
  9645.         sleep(0.1)\
  9646.     end\
  9647. end\
  9648. local function calculate(prevNumber,moneywon,high)\
  9649.     local nextNumber = math.random(1,20)\
  9650.     animateNums(nextNumber)\
  9651.     if high == (nextNumber < prevNumber) then\
  9652.       moneywon = moneywon + nextNumber^2\
  9653.     else\
  9654.       moneywon = moneywon - moneywon/2\
  9655.     end\
  9656.     return nextNumber,moneywon\
  9657. end\
  9658. local function waitForActions(currentNumber,moneywon)\
  9659.  dIntf(currentNumber,moneywon)\
  9660.  local _,b,x,y = os.pullEvent(\"mouse_click\")\
  9661.  local high\
  9662.  if b == 1 and y == h then\
  9663.     if x < 5 then high = false print() elseif x > w-3 then high = true end\
  9664.         \
  9665.  end\
  9666.  if b == 1 and y == 1 and x == w then\
  9667.       term.setBackgroundColor(colors.black)\
  9668.       term.setTextColor(colors.white)\
  9669.       term.setCursorPos(1,1)\
  9670.       term.clear()\
  9671.       error(\"Bye\",0)\
  9672.     end\
  9673.  if type(high) == \"boolean\" then currentNumber,moneywon = calculate(currentNumber,moneywon,high) end\
  9674.     return currentNumber,moneywon\
  9675. end\
  9676. --main loop\
  9677. loadscreen()\
  9678. sleep(3)\
  9679. while true do\
  9680.     local moneywon = 0\
  9681.     local currentNumber = 10\
  9682.     while true do\
  9683.         currentNumber,moneywon = waitForActions(currentNumber,moneywon)\
  9684.         sleep(0.5)\
  9685.     end\
  9686. end",
  9687.   [ "tron/info" ] = "return {\
  9688.  sGameFile = \"startgame\",\
  9689.  sName = \"TRON\",\
  9690. }",
  9691.   [ "redcast/files/devconfig" ] = "local version = \"Version 0.5\"\
  9692. return {\
  9693.  bDevMode = false,\
  9694.  bBuildString = false,\
  9695.  sBuildString = \"RedCast Public Beta\",\
  9696.  sBackground = \".background\",\
  9697.  nBackColour = colours.white,\
  9698.  nTextColour = colours.black,\
  9699.  nMenuColour = colours.grey,\
  9700.  nMenuText = colours.white,\
  9701.  bTaskbar = false,\
  9702.  nTaskbarBack = colours.white,\
  9703.  nTaskbarText = colours.black,\
  9704.  nStartBack = colours.white,\
  9705.  nStartText = colours.black,\
  9706.  bFeedback = false,\
  9707.  sComments = \"Comments?\",\
  9708.  lang = \"en\",\
  9709.  gmt = 0,\
  9710. }",
  9711.   [ "goldrunner/levels/12_themaze" ] = "                              ddddd        dddd  \
  9712. 777777777777777777777777c77777   4          4  c \
  9713. 7 4                    dc       1b1       b1b  c \
  9714. 7bc1bbbbb11bbbbcbbb1bbb c           4      4   c \
  9715. 7 c 4 4    44  c   4   dc          bbb  1bb    c \
  9716. 7bcb11bcbbbb111cbbbb    c              4       c \
  9717. 7 cddddc     4 c       dc             b11      c \
  9718. 7bbbbbbbbbbb111bbbb1bbb c       4   5          c \
  9719. 74      4      4   444 dc       ddddddddddddd  c \
  9720. 711bc b1bbbb  bbb1cb1b1 c     77444 e  e  44477c7\
  9721. 7  4c    b4       c    dc       7b7b7b7b7b7b7  c \
  9722. 711bbcdd bbcb11bbbbbbbb c  cdddd4              c \
  9723. 7  4       c          4dc  c          b111111bcbb\
  9724. 711bb1bbbb1bbbb1bbb7777 c bcbbbbb11111b4 4 4  c  \
  9725. 7     ddd4     4ddd 4  dc bc 444 11111b  0    c  \
  9726. 711bbb   b1b111b   bbb1 c bbbbbbbb1111bbbbbbb c 4\
  9727. 7                       c   44444     bbbbbbbbbbb\
  9728. 7777777777777777777777777777777777777777777777777",
  9729.   [ "flappybird/info" ] = "return {\
  9730.  sGameFile = \"startgame\",\
  9731.  sName = \"FlappyPixel\",\
  9732. }",
  9733.   [ "redcast/files/apis/multinet" ] = "\
  9734. function split(str, pat)\
  9735.    local t = {}  -- NOTE: use {n = 0} in Lua-5.0\
  9736.    if str ~= nil then\
  9737.       local fpat = \"(.-)\" .. pat\
  9738.       local last_end = 1\
  9739.       local s, e, cap = str:find(fpat, 1)\
  9740.       while s do\
  9741.          if s ~= 1 or cap ~= \"\" then\
  9742.         table.insert(t,cap)\
  9743.          end\
  9744.          last_end = e+1\
  9745.          s, e, cap = str:find(fpat, last_end)\
  9746.       end\
  9747.       if last_end <= #str then\
  9748.          cap = str:sub(last_end)\
  9749.          table.insert(t, cap)\
  9750.       end\
  9751.    else\
  9752.        print(\"##ERROR failed to split [\"..str..\"] by:\"..pat)\
  9753.    end\
  9754.    return t\
  9755. end\
  9756. \
  9757. local function getTableSize(table)\
  9758.     local sz = 0\
  9759.     for k,v in pairs(table) do\
  9760.         sz = sz + 1\
  9761.     end\
  9762.     return sz\
  9763. end\
  9764. \
  9765. function unformatTable(string, join)\
  9766.     return split(string, join)\
  9767. end\
  9768. \
  9769. function formatTable(table, join, start)\
  9770.     if start == nil then start = 1 end\
  9771.     local str = \"\"\
  9772.     for i=start,#table do\
  9773.         if i == start then str = table[i] else str = str..join..table[i] end\
  9774.     end\
  9775.     return str\
  9776. end\
  9777. \
  9778. function formatComplexTable(table, join, op)\
  9779.     local str = \"\"\
  9780.     for k,v in pairs(table) do\
  9781.         if type(v) ~= \"function\" and type(v) ~= \"nil\" then\
  9782.             if str == \"\" then \
  9783.                 str = k..op..v \
  9784.             else \
  9785.                 str = str..join..k..op..v \
  9786.             end\
  9787.         end\
  9788.     end\
  9789.     return str\
  9790. end\
  9791. \
  9792. function unformatComplexTable(string, join, op)\
  9793.     local table = split(string, join)\
  9794.     local ntable = {}\
  9795.     for i=1,#table do\
  9796.         local splt = split(table[i], op)\
  9797.         if splt[1] ~= nil then\
  9798.             ntable[splt[1]] = splt[2]\
  9799.         end\
  9800.     end\
  9801.     return ntable\
  9802. end\
  9803. \
  9804. function createServer(sname, sid)\
  9805.     local server = {\
  9806.         name = sname,\
  9807.         id = sid,\
  9808.         users = { },\
  9809.         data = { },\
  9810.         getPlayerList = function(self)\
  9811.             local list = {}\
  9812.             for k,v in pairs(self.users) do\
  9813.                 list[#list + 1] = k\
  9814.             end\
  9815.             return list\
  9816.         end,\
  9817.         sendPlayerList = function(self, player)\
  9818.             local p = self.users[player]\
  9819.             if p ~= nil then\
  9820.                 rednet.send(p[1], formatTable(self:getPlayerList(), \"#@#\"))\
  9821.             end\
  9822.         end,\
  9823.         getUsers = function(self)\
  9824.             return self.users\
  9825.         end,\
  9826.         addPlayer = function(self, player, id, data)\
  9827.             self:getUsers()[player] = {id, data}\
  9828.         end,\
  9829.         removePlayer = function(self, player)\
  9830.             local users = self.users\
  9831.             if users == nil then users = {} end\
  9832.             users[player] = nil\
  9833.             self.users = users\
  9834.         end,\
  9835.         addSData = function(self, name, info)\
  9836.             local data = self.data\
  9837.             if data == nil then data = {} end\
  9838.             data[name] = info\
  9839.             self.data = data\
  9840.         end,\
  9841.         getSData = function(self)\
  9842.             local val = self.data\
  9843.             if val ~= nil then\
  9844.                 val = formatComplexTable(val, \"#@#\", \"#=#\")\
  9845.                 return val\
  9846.             end\
  9847.             return nil\
  9848.         end,\
  9849.         getPlayer = function(self, id)\
  9850.             local users = self.users\
  9851.             if users == nil then users = {} end\
  9852.             for k,v in pairs(users) do\
  9853.                 if v[1] == id then return k end\
  9854.             end\
  9855.             self.users = users\
  9856.             return nil\
  9857.         end,\
  9858.         getID = function(self, player)\
  9859.             local users = self.users\
  9860.             if users == nil then users = {} end\
  9861.             local p = users[player]\
  9862.             if p ~= nil then return p[1] else\
  9863.                 return nil\
  9864.             end\
  9865.             self.users = users\
  9866.         end,\
  9867.         getData = function(self, player)\
  9868.             local users = self.users\
  9869.             if users == nil then users = {} end\
  9870.             local p = users[player]\
  9871.             if p ~= nil then return p[2] else\
  9872.                 return data\
  9873.             end\
  9874.             self.users = users\
  9875.         end,\
  9876.         setData = function(self, player, data)\
  9877.             local users = self.users\
  9878.             if users == nil then users = {} end\
  9879.             local p = users[player]\
  9880.             if p ~= nil then \
  9881.                 p[2] = data\
  9882.             end\
  9883.             self.users = users\
  9884.         end,\
  9885.         pingUsers = function(self, info)\
  9886.             local users = self.users\
  9887.             if users == nil then users = {} end\
  9888.             for k,v in pairs(users) do\
  9889.                 rednet.send(v[1], info)\
  9890.             end\
  9891.             self.users = users\
  9892.         end,\
  9893.         waitForCommand = function(self)\
  9894.             local id, message, distance = rednet.receive()\
  9895.             local users = self.users\
  9896.             if users == nil then users = {} end\
  9897.             local data = self.data\
  9898.             if data == nil then data = {} end\
  9899.             \
  9900.             local typ = nil\
  9901.             if id ~= nil then\
  9902.                 if message:sub(1, 5) == \"JOIN \" then\
  9903.                     local splt = split(message, \" \")\
  9904.                     local name = formatTable(splt, \" \", 2)\
  9905.                     users[name] = { id, {} }\
  9906.                     typ = 1\
  9907.                 elseif message == \"LEAVE\" then\
  9908.                     self:removePlayer(self:getPlayer(id))\
  9909.                     typ = 2\
  9910.                 elseif message == \"GET_DATA\" then\
  9911.                     if self:getPlayer(id) ~= nil then\
  9912.                         local player = self:getPlayer(id)\
  9913.                         local dat = self:getData(player)\
  9914.                         if dat ~= nil then\
  9915.                             rednet.send(id, formatTable(dat, \"#@#\"))\
  9916.                             typ = 3\
  9917.                         end\
  9918.                     end\
  9919.                 elseif message:sub(1, string.len(\"SET_DATA \")) == \"SET_DATA \" then\
  9920.                     local type = 11\
  9921.                     if self:getPlayer(id) ~= nil then\
  9922.                         local splt = split(message, \" \")\
  9923.                         local ftabl = formatTable(splt, \" \", 2)\
  9924.                         local table = unformatTable(ftabl, \"#@#\")\
  9925.                         if table ~= nil then\
  9926.                             self.setData(self, self:getPlayer(id), table)\
  9927.                             typ = 8\
  9928.                         end\
  9929.                     end\
  9930.                 elseif message == \"GET_PLAYERLIST\" then\
  9931.                     if self:getPlayer(id) ~= nil then\
  9932.                         local fmt = formatTable(self:getPlayerList(), \"#@#\")\
  9933.                         rednet.send(id, \"PLS::\"..fmt)\
  9934.                         typ = 4\
  9935.                     end\
  9936.                 elseif message == \"@#@GET_NAME@#@\" then\
  9937.                     rednet.send(id, \"~S~\"..self.name)\
  9938.                     typ = 5\
  9939.                 elseif message == \"GET_SERVER_DATA\" then\
  9940.                     if self:getPlayer(id) ~= nil then\
  9941.                         rednet.send(id, self:getSData())\
  9942.                         typ = 6\
  9943.                     end\
  9944.                 elseif message:sub(1, string.len(\"SET_SERVER_DATA@#@\")) == \"SET_SERVER_DATA@#@\" then\
  9945.                     if self:getPlayer(id) ~= nil then\
  9946.                         local splt = split(message, \"@#@\")\
  9947.                         local piece = splt[3]\
  9948.                         local name = splt[2]\
  9949.                         if name == \"#LEN#\" then name = #data end\
  9950.                         if name == \"#LEN+#\" then name = #data + 1 end\
  9951.                         self:addSData(name, piece)\
  9952.                         typ = 7\
  9953.                     end\
  9954.                 end\
  9955.             end\
  9956.             if typ ~= nil then\
  9957.                 return tonumber(typ)\
  9958.             else\
  9959.                 return \"INVALID\"\
  9960.             end\
  9961.             self.users = users\
  9962.             self.data = data\
  9963.         end,\
  9964.     }\
  9965.     return server\
  9966. end\
  9967. \
  9968. function createUser(uname, sname, uid, sid)\
  9969.     local user = {\
  9970.         name = uname,\
  9971.         id = uid,\
  9972.         server_name = sname,\
  9973.         server_id = sid,\
  9974.         joinServer = function(self)\
  9975.             rednet.send(self.server_id, \"JOIN \"..self.name)\
  9976.         end,\
  9977.         leaveServer = function(self)\
  9978.             rednet.send(self.server_id, \"LEAVE\")\
  9979.         end,\
  9980.         getPlayerList = function(self)\
  9981.             rednet.send(self.server_id, \"GET_PLAYERLIST\")\
  9982.             local id, message, distance = rednet.receive()\
  9983.             local typ = string.sub(message, 1, 5)\
  9984.             message = message:sub(6, -1)\
  9985.             local n = 1\
  9986.             while id ~= self.server_id and typ ~= \"PLS::\" and n < 20 do\
  9987.                 id, message, distance = rednet.receive()\
  9988.                 typ = string.sub(message, 1, 5)\
  9989.                 message = message:sub(6, -1)    \
  9990.                 n = n + 1\
  9991.             end\
  9992.             if n < 20 then\
  9993.                 return unformatTable(message, \"#@#\")\
  9994.             end\
  9995.             return nil\
  9996.         end,\
  9997.         getData = function(self)\
  9998.             rednet.send(self.server_id, \"GET_DATA\")\
  9999.             local id, message, distance = rednet.receive()\
  10000.             if id == self.server_id then\
  10001.                 return unformatTable(message, \"#@#\")\
  10002.             end\
  10003.             return nil\
  10004.         end,\
  10005.         setData = function(self, table)\
  10006.             rednet.send(self.server_id, \"SET_DATA \"..formatTable(table, \"#@#\", 1))\
  10007.         end,\
  10008.         getSData = function(self)\
  10009.             rednet.send(self.server_id, \"GET_SERVER_DATA\")\
  10010.             local id, message, distance = rednet.receive()\
  10011.             if id == self.server_id then\
  10012.                 return unformatComplexTable(message, \"#@#\", \"#=#\")\
  10013.             end\
  10014.             return nil\
  10015.         end,\
  10016.         setSData = function(self, name, piece)\
  10017.             rednet.send(self.server_id, \"SET_SERVER_DATA@#@\"..name..\"@#@\"..piece)\
  10018.         end,\
  10019.         waitForPing = function(self)\
  10020.             local id, message, distance = rednet.receive()\
  10021.             if id ~= nil and id == self.server_id then\
  10022.                 return message\
  10023.             end\
  10024.             return nil\
  10025.         end,\
  10026.         isFromServer = function(self, id)\
  10027.             return id == self.server_id\
  10028.         end,\
  10029.     }\
  10030.     return user\
  10031. end\
  10032. \
  10033. function getServers()\
  10034.     local servers = {}\
  10035.     local n = 0\
  10036.     local i = 0\
  10037.     local ok = true\
  10038.     rednet.broadcast(\"@#@GET_NAME@#@\")\
  10039.     while ok and i < 500 do\
  10040.         local id, message, distance = rednet.receive(2)\
  10041.         if id ~= nil then\
  10042.             local str = message:sub(1, 3)\
  10043.             if str == \"~S~\" then\
  10044.                 local sname = message:sub(4, -1)\
  10045.                 servers[sname] = id\
  10046.                 n = 0\
  10047.             else\
  10048.                 n = n + 1\
  10049.                 if n > 5 then ok = false end\
  10050.             end\
  10051.         else\
  10052.             ok = false\
  10053.         end\
  10054.         i = i + 1\
  10055.     end\
  10056.     return servers\
  10057. end",
  10058.   [ "goldrunner/levels/classic_009" ] = "bbbbbbbbbb5                           bbbbbbbbbb \
  10059. bbbbbbbbbb8dddddddddddddddddddddddddddbbbbbbbbbb \
  10060. bbbbbbbbbbcb e   b             b     bbbbbbbbbbb \
  10061. bbbbbbbbbbc bbbbb               bbbbb bbbbbbbbbb \
  10062. bbbbbbbbbbc b bbb               b4bbb bbbbbbbbbb \
  10063. bbbbbbbbbbc bbbbb e    e      e bbbbb bbbbbbbbbb \
  10064. bbbbbbbbbbc bbb b1bbbbbbbbbbbbbbbbb b bbbbbbbbbb \
  10065. bbbbbbbbbbc bbbbb1bbb 4bb 4bbbbbbbbcb bbbbbbbbbb \
  10066. bbbbbbbbbbc bbbbb1bbbbbbbbbbbbbbbbbcb bbbbbbbbbb \
  10067. bbbbbbbbbbc bbbbb1bbbbbbbbbbbbbbbbbcb bbbbbbbbbb \
  10068. bbbbbbbbbbc bbbbb1bbbb    bbbbbbbbbcb bbbbbbbbbb \
  10069. bbbbbbbbbbc bbbbb1bbbb    bbbbbbbbbcb bbbbbbbbbb \
  10070. bbbbbbbbbbc bbbbb1bbbb   4cbbbbbbbbcb bbbbbbbbbb \
  10071. bbbbbbbbbbc           bbbbcddddddddc  bbbbbbbbbb \
  10072. bbbbbbbbbbc      0   7777             bbbbbbbbbb \
  10073. bbbbbbbbbbbbbbbbbbbb7777      e       bbbbbbbbbb \
  10074. 7777777777777777777777777777777777777777777777777",
  10075.   [ "goldrunner/levels/08_cavein" ] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb   bbbbbbbbbbbbbb\
  10076. b  8 8  8   8 8   b 4            5 b4 e      4  b\
  10077. b  888  8 8     8 bbbbbbbcbbbbc  8 bbbbbbbcbbbbbb\
  10078. b  8 8  8  88888  bbbb4bbcbbbbbbbbbb bbb  c     b\
  10079. b     e                  c      bbbb bbb  c     b\
  10080. bbbbbbbbbbbbbbbb77bcbbbbbbbbbbbcbbbb bbb  c 4  4b\
  10081. b  4     4  bb   bbc           cb44b bbb  c     b\
  10082. bbbbbbbbbbbbb     bc           cbbbbbbbb  c     b\
  10083. b   4     4 b4 4 4bc           c    4bbb4 c     b\
  10084. bbbbbbbbbbbbb4 4 4bc    bbbcbbbbbbbbbbbbbbbbbccbb\
  10085. b 4     4   b     bc    bbbc         e  4 cbbccbb\
  10086. bbbbbbbbbbbbbbbcbbbc   4bbbc   cbbbbbbbbbbcbbccbb\
  10087. b              c   cbbbbb  c4  c    bbbbbbcbbccbb\
  10088. b              c   cbbbbbcbbbbbcbbbbbb44  cbbccbb\
  10089. b    4  4  cbbbbbbbcbbbbbcbbbbbcbbbb4bbbbbbbbccbb\
  10090. bbbbbbbbbbbbbbbbbbbce    cbb4bbc      0      cc4b\
  10091. bb     bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  10092. 7777777777777777777777777777777777777777777777777",
  10093.   [ "konelift/info" ] = "return {\
  10094.  sGameFile = \"startgame\",\
  10095.  sName = \"KONE ELEVATOR SIMULATOR\",\
  10096. }",
  10097.   [ "redcast/files/lang/id" ] = "return {\
  10098.  start = {\
  10099.    welcome = \"Selamat datang di RedCast.\",\
  10100.    revolution = \" 'The console revolution' \",\
  10101.    setup = \"Tekan DEL untuk memasuki Setup\",\
  10102.    free = \"Anda memiliki %free% byte tersisa.\"\
  10103.  },\
  10104.  disk = {\
  10105.    detect = \"Disk terdeteksi.\",\
  10106.    media = \"Disk media terdeteksi.\",\
  10107.    playquestion = \"Apakah Anda ingin untuk memutarkan musik?\",\
  10108.    play = \"Sekarang Memutar %title%\"\
  10109.  },\
  10110.  gui = {\
  10111.    advancedonly = \"GUI ini tidak bisa digunakan pada komputer Monochrome.\",\
  10112.    menu = {\
  10113.      restart = \"Restart\",\
  10114.      shutdown = \"Matikan\",\
  10115.      chatmanager = \"Percakapan\",\
  10116.      paint = \"Paint\",\
  10117.      redspace = \"RedSpace\",\
  10118.      floppy = \"Floppy\",\
  10119.      credits = \"Kredit\"\
  10120.    },\
  10121.    paint = {\
  10122.      open = \"Masukkan nama file baru/ file yang sudah dibuat: \"\
  10123.    },\
  10124.    redspace = {\
  10125.      id = \"Masukkan ID server: \"\
  10126.    }\
  10127.  }\
  10128. }",
  10129.   normal = "\
  10130. \
  10131. \
  10132. \
  10133. \
  10134. \
  10135.     ddddddddddddd\
  10136.     cddddddddddddd\
  10137.     ccddddddddddddd\
  10138.      ccddddddddddddd\
  10139.       ccddddddddddddd\
  10140.        cccccccccccccc",
  10141.   [ "goldrunner/levels/03_seeker" ] = "                                                 \
  10142.                                                 \
  10143.                               5                 \
  10144.  4 4                          8     4     4     \
  10145. bbcbb                         8    bbbbbbcb     \
  10146.   c                           8          c      \
  10147.   c 4 dddd  4   e 4  dddddd   8          c      \
  10148.   bbbb    bbbbcbbbbbb         8          c      \
  10149.               c             4 8  e 4     c      \
  10150.               c           bbbbbbbbcbb    c      \
  10151.               c                   c      c      \
  10152.          4    c 4     0        4  c   4  c      \
  10153.      bbbcbbbbbbbbb            bbbbcbbbbbbbc     \
  10154.         c                                 c     \
  10155.         c                                 c     \
  10156.         c                                 c     \
  10157. b        c 4     4          4         4    c    b\
  10158. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  10159.   [ "bankvault/levels/Boxxle1.txt" ] = "; Boxxle 1\
  10160. \
  10161. ; Copyright: Thinking Rabbit\
  10162. ; E-Mail: \
  10163. ; Web Site: \
  10164. ;\
  10165. ; Levels from the Game Boy.\
  10166. \
  10167. #####\
  10168. #   ####\
  10169. #   #  #\
  10170. ##    .#\
  10171. ### ###.#\
  10172. # $ # #.#\
  10173. # $$# ###\
  10174. #@  #\
  10175. #####\
  10176. ; #1\
  10177. \
  10178.  #######\
  10179.  #     #\
  10180.  # $ @ #\
  10181. ##### # #\
  10182. # $     #\
  10183. #  #$## ##\
  10184. #..$  #  #\
  10185. #..      #\
  10186. ##########\
  10187. ; #2\
  10188. \
  10189. ######\
  10190. #..*.#\
  10191. #.$  #\
  10192. ## $ #\
  10193. ##$ ##\
  10194. #@$ #\
  10195. ##  #\
  10196. ####\
  10197. ; #3\
  10198. \
  10199. ########\
  10200. #.   $ #\
  10201. #.$  # #\
  10202. #.# #  #\
  10203. ### # ##\
  10204. # $  #\
  10205. #@ ###\
  10206. #####\
  10207. ; #4\
  10208. \
  10209. ########\
  10210. ##..#   #\
  10211. # ..# $ ##\
  10212. # @ $  $ #\
  10213. ##$###   #\
  10214. #     ###\
  10215. #######\
  10216. ; #5\
  10217. \
  10218. #######\
  10219. #     ####\
  10220. # ###.   #\
  10221. ##    # # #\
  10222. # .#$ $ # #\
  10223. # #  *  # #\
  10224. # # $ $#. #\
  10225. # # #    ##\
  10226. #   .### ##\
  10227. ####      #\
  10228.   #####  #\
  10229.       #@ #\
  10230.       ####\
  10231. ; #6\
  10232. \
  10233. #########\
  10234. #.....  #\
  10235. ### $ # ##\
  10236.  # $##  #\
  10237.  #$ $ $ #\
  10238.  #   #  #\
  10239.  ##  # @#\
  10240.   #######\
  10241. ; #7\
  10242. \
  10243.    #####\
  10244. #####   #\
  10245. #.. $ $ ##\
  10246. #..$ $  @#\
  10247. ##. $## ##\
  10248. ###    #\
  10249.   ######\
  10250. ; #8\
  10251. \
  10252. ###########\
  10253. #     # @ #\
  10254. # $  $  $ #\
  10255. ## #...# ##\
  10256. # #...# #\
  10257. #$ ### $#\
  10258. #   $   #\
  10259. #  ##   #\
  10260. #########\
  10261. ; #9\
  10262. \
  10263.   ####\
  10264. ####  #\
  10265. # $...##\
  10266. #@ $.. #\
  10267. ###$$$ #\
  10268.  #    #\
  10269.  ######\
  10270. ; #10\
  10271. \
  10272. ##########\
  10273. ##    # @ ##\
  10274. #  $.... $ #\
  10275. # $ ####$  #\
  10276. ##  #  #   #\
  10277. ####  #####\
  10278. ; #11\
  10279. \
  10280.    ########\
  10281.    #      #########\
  10282. ##### #### #@##  ..#\
  10283. # $  $           ..#\
  10284. #   # ### #####  ..#\
  10285. ### # ### #   ######\
  10286.  #  $  $ #\
  10287.  ###  $###\
  10288.    #$  #\
  10289.    #   #\
  10290.    #####\
  10291. ; #12\
  10292. \
  10293.  #####\
  10294.  #   ##\
  10295. ### *$ #\
  10296. #  .$. #\
  10297. #  $. ##\
  10298. ###  @#\
  10299.  #####\
  10300. ; #13\
  10301. \
  10302.  ########\
  10303.  #      #   ######\
  10304.  #$ $ $ #   #  ..#\
  10305. ###  $  $#####  ..##\
  10306. #  $$$   $      ...#\
  10307. # #  $ ####@##  ..##\
  10308. # #  $ #  ####  ..#\
  10309. #    ###     ######\
  10310. ######\
  10311. ; #14\
  10312. \
  10313. ########\
  10314. #  @   #\
  10315. #  #$$ #\
  10316. ## $  ##\
  10317. #  $.#\
  10318. ## .##\
  10319.  #..#\
  10320.  ####\
  10321. ; #15\
  10322. \
  10323. #########\
  10324. #   #   ##\
  10325. # $$#$$ @#\
  10326. #    $  ##\
  10327. #   # ##############\
  10328. ####  $ #     #....#\
  10329.   # $$ #$ $ $#....#\
  10330.   #  $     $ #....#\
  10331.   # $$$#$  $ #  ..#\
  10332.   #    #  $ $   ..#\
  10333.   ############  ..#\
  10334.              #  ..#\
  10335.              ######\
  10336. ; #16\
  10337. \
  10338.   #######\
  10339.   #  @  #\
  10340. #### # $ #\
  10341. #...$#$ ##\
  10342. #... $   #\
  10343. ### $ ## #\
  10344.  # $    #\
  10345.  #    ###\
  10346.  ######\
  10347. ; #17\
  10348. \
  10349.      ####\
  10350. #######@ #\
  10351. #   #    #\
  10352. #   $  $ #\
  10353. ## ##$# ##\
  10354. #  $ #*.#\
  10355. ##  $...#\
  10356.  #   #. #\
  10357.  ########\
  10358. ; #18\
  10359. \
  10360. ########\
  10361. # @    #\
  10362. ##  ..$ #\
  10363. #  #..###\
  10364. # $$$##\
  10365. #    #\
  10366. ######\
  10367. ; #19\
  10368. \
  10369. ########\
  10370. #  #   #\
  10371. # $..$ #\
  10372. #@$.* ##\
  10373. # $..$ #\
  10374. #  #   #\
  10375. ########\
  10376. ; #20\
  10377. \
  10378.   #####\
  10379. #### @ ###\
  10380. #    #   #\
  10381. # $$  #$ #\
  10382. #  $#$ $ #\
  10383. ###...$###\
  10384. #.... #\
  10385. #######\
  10386. ; #21\
  10387. \
  10388. ###  ####\
  10389. ##.####  ##\
  10390. #...  #  @###\
  10391. ##..     $  #\
  10392. #...  # $ $ #\
  10393. ##.###### ######\
  10394. ###    # $ $  #\
  10395.       ## $ $# #\
  10396.       #   $   #\
  10397.       #  $ $# #\
  10398.       # # # # #\
  10399.       #       #\
  10400.       #########\
  10401. ; #22\
  10402. \
  10403. #######\
  10404. #  #@ #\
  10405. # $$$ #\
  10406. #  $  #\
  10407. # $$$ #\
  10408. #..#..#\
  10409. #..$..#\
  10410. #######\
  10411. ; #23\
  10412. \
  10413. ########\
  10414. #  ##  #\
  10415. #  ##$ #\
  10416. #  $   ##\
  10417. ## #    ##\
  10418. # ## #  #\
  10419. # $ $## #  ####\
  10420. ## ##    ####..#\
  10421. # $ #$ #$##  ..#\
  10422. #      $     ..#\
  10423. ########@##  ..#\
  10424.       #########\
  10425. ; #24\
  10426. \
  10427.  ######\
  10428.  #  @ #\
  10429.  # $  #\
  10430. #### $ #\
  10431. # .#$ ##\
  10432. #..# $#\
  10433. #..$  ##\
  10434. #.. $  #\
  10435. ####$  #\
  10436.   #   #\
  10437.   #####\
  10438. ; #25\
  10439. \
  10440.       #####\
  10441.      ##   #\
  10442.      #  $ #####\
  10443.      # $ $    #\
  10444.      ### #### ##\
  10445. ######## $    @#\
  10446. ##...  ## $$## ##\
  10447. #....       ## #\
  10448. ##...  #### ## #\
  10449. ######## $ $  #\
  10450.        #  $ $ #\
  10451.        #      #\
  10452.        ########\
  10453. ; #26\
  10454. \
  10455. ########\
  10456. #  #  @#\
  10457. #$  $  #\
  10458. # ## $ #\
  10459. ##...$ ##\
  10460. # ...# #\
  10461. # #$$  #\
  10462. #      #\
  10463. ########\
  10464. ; #27\
  10465. \
  10466.  ######\
  10467.  #....#\
  10468.  #  ..#\
  10469. ###$$#####\
  10470. # $   $ @#\
  10471. #   $ $  #\
  10472. ###   ####\
  10473.  #####\
  10474. ; #28\
  10475. \
  10476. #######\
  10477. #     ##\
  10478. # $  $ #\
  10479. ## # #@#\
  10480.  #.# $ #\
  10481. ###..$ ##\
  10482. #  ..# #\
  10483. # #.*# ###\
  10484. #  #.$$$ #\
  10485. ##   # # #\
  10486. ###     #\
  10487.   #######\
  10488. ; #29\
  10489. \
  10490.  ####\
  10491.  #  ####   ####\
  10492.  #     #####  #\
  10493.  #  $$$       #\
  10494.  ## #  #  # # #\
  10495.   #$ $ ####$# #\
  10496.   # $####     #\
  10497. ####  #  #  ## ####\
  10498. # @$$    ## # ....#\
  10499. # #  $$ ### # ....#\
  10500. # $ $  $    # ....#\
  10501. # ## $  ##  # ....#\
  10502. #    $  ###########\
  10503. ######  #\
  10504.     ####\
  10505. ; #30\
  10506. \
  10507.  ############\
  10508.  #    #     #\
  10509.  # $  $ $ $ #\
  10510. ###### ##$ $ #\
  10511. #..  # #  $ ##\
  10512. #..    @ ##  #\
  10513. #..  #$####  #\
  10514. #..  # $  $  #\
  10515. #..  #     ###\
  10516. ############\
  10517. ; #31\
  10518. \
  10519.      #######\
  10520.     ##@#   #\
  10521.    ##  # $ #\
  10522. ####  # $  #\
  10523. #    # $ # ##\
  10524. #   # $  #  #\
  10525. #  # $  #   #\
  10526. # # $  #    #\
  10527. ##  $  ### # #\
  10528. #  $  ##...# #\
  10529. #   ##.....  #\
  10530. ########  ####\
  10531.       ####\
  10532. ; #32\
  10533. \
  10534. ########\
  10535. #....  ##########\
  10536. ##...    $  $   #\
  10537. #....  ## $  $  #\
  10538. ######### $ # ###\
  10539.        ##$ $ #\
  10540.        # $  $#\
  10541.        # $#$ ##\
  10542.        #     @#\
  10543.        ########\
  10544. ; #33\
  10545. \
  10546. ############\
  10547. #...#  @#  ##\
  10548. #...#$$  $  #\
  10549. #...   ##  $#\
  10550. #   # ##    ###\
  10551. #####  $ #$$  #\
  10552.  # $ $       #\
  10553.  #   #########\
  10554.  #####\
  10555. ; #34\
  10556. \
  10557.   #########\
  10558.   #  ##   #\
  10559.   # $  $  #\
  10560.   #  $# $ #\
  10561. #### $ #$  #\
  10562. #..### # $ #\
  10563. #..  # # $ #\
  10564. #..     $$ #\
  10565. #..  ###   #\
  10566. #..  # ##@##\
  10567. ######  ###\
  10568. ; #35\
  10569. \
  10570.          #########\
  10571. ######## ##   #   #\
  10572. #...#  ###  $  $  #\
  10573. #...#    @ # ### ##\
  10574. #...    # ##  #   #\
  10575. #  ### $#$  $  $  #\
  10576. ##      # #  ## ###\
  10577. #### #$$ ## ##  #\
  10578.    #   #   $    #\
  10579.    #####  #  ####\
  10580.        #######\
  10581. ; #36\
  10582. \
  10583.           #####\
  10584. ###########   #\
  10585. #     $    ...#\
  10586. #$$#  #####...#\
  10587. ##  #$ #   #...#\
  10588. #  $   #   #...#\
  10589. #@#$$ ##   #...#\
  10590. # $    #   #...#\
  10591. ##  $$ ######.##\
  10592. # $ $ #   #   #\
  10593. #$ $ $ $ $    #\
  10594. #  ## #  $$# ##\
  10595. #     ###    #\
  10596. ####### ######\
  10597. ; #37\
  10598. \
  10599. ############\
  10600. ###..##    #\
  10601. ##....#  $ #\
  10602. #.....# $# #\
  10603. ####.. $ #@#\
  10604. #   ..# ####\
  10605. # $# $#    #\
  10606. #  #  #  $ #\
  10607. #   # # $ ##\
  10608. # $$$ # ####\
  10609. #   $ #    #\
  10610. #### ## $$ #\
  10611. ##   $   $ #\
  10612. ##     ##  #\
  10613. ############\
  10614. ; #38\
  10615. \
  10616.        ####\
  10617.        #  #\
  10618.        #  #\
  10619.        #  #\
  10620.     #### ###\
  10621.     # $    #\
  10622. ###### $$ $ #####\
  10623. #@ $  $    $  $ #\
  10624. ##   #$ $   #   #\
  10625. #####  $ $ #####\
  10626.     # $$$ ##\
  10627.     ### ########\
  10628.      ## ##  ...#\
  10629.      #  ##  ...#\
  10630.      #      ...#\
  10631.      #####  ...#\
  10632.          #  ...#\
  10633.          #######\
  10634. ; #39\
  10635. \
  10636. ####      ####\
  10637. #..########..#\
  10638. #.*.*.....*.*#\
  10639. #$ $ $ $ $ $ #\
  10640. # $ $ $ $ $ $#\
  10641. #$ $ $@$ $ $ #\
  10642. # $ $ $ $ $ $#\
  10643. #*.*.....*.*.#\
  10644. #..########..#\
  10645. ####      ####\
  10646. ; #40\
  10647. \
  10648.   ####\
  10649.   #  #####\
  10650. ###$ $   ###\
  10651. #  $ #  $  #\
  10652. #    ## ## ##\
  10653. #  ###  ##  #\
  10654. # #  $ $ ## #\
  10655. #$  $ $ $#  #\
  10656. ## ###  $    #\
  10657. #     #$ ##$ #\
  10658. # ....#  #  ##\
  10659. ##....# # @##\
  10660. #.#.#  $ ##\
  10661. #....   ##\
  10662. #########\
  10663. ; #41\
  10664. \
  10665.    ######\
  10666.    #....####\
  10667.    #....#  #\
  10668.    #...  $ #\
  10669. #####   #   #\
  10670. #   #####$####\
  10671. #   #      # #\
  10672. ## $  $#     #\
  10673. #$ ## # $ $ #\
  10674. #  $   ####$##\
  10675. # # #  ####  #\
  10676. ## $       $  #\
  10677. #@  ########  #\
  10678. #####      ####\
  10679. ; #42\
  10680. \
  10681. ######\
  10682. #    ######  ####\
  10683. # $  $ #  ####  ##\
  10684. #  $   # $$      #\
  10685. ##   $$#  ### #  #\
  10686. # $#  ## ##  #  #\
  10687. #$ $  $@$ # ##  ##\
  10688. #  #  #   # #....#\
  10689. # $ $ ##$## #....#\
  10690. ##   # #  # #....#\
  10691.  ##### #  $ #....#\
  10692.        #  # ######\
  10693.        ######\
  10694. ; #43\
  10695. \
  10696.      ####\
  10697.      #  #\
  10698.      #$ ###\
  10699.      #   ###\
  10700. ######$ $  #\
  10701. #... # $   #\
  10702. #....  $$ ##\
  10703. #....#   $#\
  10704. #....#$ $ #\
  10705. #### ##   $#\
  10706. #@$ $ # $  #\
  10707. ## $  ## ###\
  10708. ##     $#\
  10709.  #####  #\
  10710.      ####\
  10711. ; #44\
  10712. \
  10713.    #########\
  10714.    #.......#\
  10715.    #.......#\
  10716.    #.......#\
  10717.    #### $###\
  10718.     #  $  ##\
  10719.     # $ $  #\
  10720. ###### # # ###\
  10721. #  ## $ $ $  #\
  10722. ## $$         #\
  10723. #   #####$##$##\
  10724. #   $     $ $ ###\
  10725. ######## $#     #\
  10726.     #  $ #  #  #\
  10727.     #   @#$  $ #\
  10728.     ## $ $   $ #\
  10729.      ########  #\
  10730.             ####\
  10731. ; #45\
  10732. \
  10733. ######\
  10734. #....#\
  10735. #....#\
  10736. ##   ############\
  10737. #   #  #   #   #\
  10738. ## ## $ $ $$   #\
  10739.  #    @# # #####\
  10740.  #  ##$# $  #\
  10741.  ####   $   #\
  10742.  #  $   #####\
  10743.  #      #\
  10744.  ########\
  10745. ; #46\
  10746. \
  10747.       #######\
  10748. ########.....#\
  10749. # $   $ .....####\
  10750. #  $ $ #.....   #\
  10751. ##  ## #.....#  #\
  10752. #  $  ###$### ##\
  10753. # $  $  $   $ #\
  10754. #$####  $   $ #\
  10755. #   #  $# #####\
  10756. ###   $$ $ $  #\
  10757.   #### $  $   #\
  10758.     #@  #######\
  10759.     #####\
  10760. ; #47\
  10761. \
  10762.   #####\
  10763.   #...#\
  10764.   #...##\
  10765.   #....####\
  10766. ####......####\
  10767. #  #....     #\
  10768. ##  ###  ###$ #\
  10769. # $ $ #$#  #  #\
  10770. # $    $  $## ####\
  10771. #  #  # #   $$$  #\
  10772. ##  $## #$ $     #\
  10773. #$  $  # $ $#  ##\
  10774. #  $# $ $   ####\
  10775. ##  ## @#   #\
  10776.  #  #########\
  10777.  ####\
  10778. ; #48\
  10779. \
  10780.   #####\
  10781.   #   ##\
  10782.   # #  #\
  10783. ### $  #\
  10784. ##   # ##\
  10785. # .#.#  #\
  10786. # ..*$$ #\
  10787. # *#.#  #\
  10788. ##  ##$##\
  10789. #$ @  #\
  10790. #  ####\
  10791. ####\
  10792. ; #49\
  10793. \
  10794.      ########\
  10795.      #      ##\
  10796. ######  ##$$@#\
  10797. ##  #  $$ #   #\
  10798. ##$       $ $ #\
  10799. #   # $########\
  10800. #  $#  #... .#\
  10801. # $ #$$ ...  #\
  10802. #  $#  #...  #\
  10803. ##  #  #...###\
  10804. #  #  #####\
  10805. #######\
  10806. ; #50\
  10807. \
  10808.            #####\
  10809.     ########   #\
  10810. ######@#   ## # #\
  10811. #   ##   $      #\
  10812. #...   ## ### ###\
  10813. #..## ##    # #\
  10814. #..#  ##$#### ##\
  10815. #..# $$     #  #\
  10816. #..#  ## $  $  #\
  10817. #####  #  $ #  #\
  10818.    #$$ $$# ####\
  10819.    #       #\
  10820.    #########\
  10821. ; #51\
  10822. \
  10823. ########\
  10824. #      ######\
  10825. # ####      #\
  10826. # #  ### ## #\
  10827. #     $   # #\
  10828. # #  #    # #\
  10829. # #$ ### #  # ######\
  10830. # # #### # #### ...#\
  10831. # #   # $$ #  #  ..#\
  10832. # #   #   ##$    ..#\
  10833. #  $$ #     $ #  ..#\
  10834. ###   #   ##$ ######\
  10835.  ##########@ #\
  10836.           ####\
  10837. ; #52\
  10838. \
  10839. #####\
  10840. #@  #######\
  10841. # #$#  #  #\
  10842. # $    $$ #\
  10843. ### ##$#  #\
  10844. #  # .# ##\
  10845. #  $..   #\
  10846. #  #..## #\
  10847. #####.   #\
  10848.     ######\
  10849. ; #53\
  10850. \
  10851.      #####\
  10852.     ##   #####\
  10853. ##### $  #...#\
  10854. #   # # ##...#\
  10855. # #   # #.. .#\
  10856. #   ##   ....#\
  10857. ####  $$$ $#  #\
  10858. #  # ##  $ ####\
  10859. #  # ## $  #\
  10860. # $$$ $  $$#\
  10861. ## #@##    #\
  10862. ## #### #  #\
  10863. #       ####\
  10864. #       #\
  10865. #########\
  10866. ; #54\
  10867. \
  10868.            ########\
  10869.        #####   #  #\
  10870.      ###   #$ $ $ #\
  10871.     ## #     $ $  #\
  10872. #####    # #$ # $ #\
  10873. #  #  # ## #   #  #\
  10874. #    ##### ### #$ #\
  10875. # $## ...# ##  $  #\
  10876. ## ## ...#  #    ##\
  10877. #  ###...   ######\
  10878. #  $ ....####\
  10879. #  #######\
  10880. ### $ #\
  10881. #@$   #\
  10882. ##  ###\
  10883. ####\
  10884. ; #55\
  10885. \
  10886.   ######\
  10887. ###    ###\
  10888. #        ####\
  10889. # #$$$## #  #\
  10890. # #    # #  #######\
  10891. # #    # # $   ...#\
  10892. # #$#$## #$    ...#\
  10893. ##         $$###...#\
  10894. #  #$$$## #$   #...#\
  10895. # #     # #    #...#\
  10896. # #  $  # # ## #...#\
  10897. #  #$#$##  #   #...#\
  10898. ##       $   $ #...#\
  10899. # #$$$# ####$##.###\
  10900. # # @ #  #  $   #\
  10901. #  ###   # $$ ###\
  10902. ##     ###    #\
  10903.  ####### ######\
  10904. ; #56\
  10905. \
  10906. ####\
  10907. # @#\
  10908. # $#####\
  10909. #  $   ##    #####\
  10910. #   $#  #    #   #\
  10911. ##   $  #    # $ #\
  10912. ##$# $ #######  #\
  10913.  #   #$    #  ..#\
  10914.  # # # $## # #..#\
  10915.  #      $     ..#\
  10916.  ###########  ..#\
  10917.      #     #$#..#\
  10918.      # $      ..#\
  10919.      #     #   ##\
  10920.      ###########\
  10921. ; #57\
  10922. \
  10923.      #####\
  10924.  #####   #######\
  10925.  #@$    $   $  #\
  10926. #### #$#  ##$  #\
  10927. #  #  $  $ #   #\
  10928. #  ### ##  # ####\
  10929. #  $ # $  #  $  #\
  10930. #        ### $  #\
  10931. #######$ ##  $ ###\
  10932. #.....#  #  $  #\
  10933. #.....## $ #$  #\
  10934. #....     $   ##\
  10935. #...   ########\
  10936. ########\
  10937. ; #58\
  10938. \
  10939. #######\
  10940. #     #\
  10941. # ### ###\
  10942. # #  $  #\
  10943. # # $ $ ##\
  10944. # #@ #$  #######\
  10945. # # $# $$#  ...#\
  10946. # #$ #   #  ...#\
  10947. # #  #$     ...#\
  10948. # #$ #  $#  ...#\
  10949. #   $ $  #  ...#\
  10950. ###  $  $#######\
  10951.  ### ## #\
  10952.    #    #\
  10953.    ######\
  10954. ; #59\
  10955. \
  10956.    ###########\
  10957. ####.........#\
  10958. #   .*******.#\
  10959. # ###.......##\
  10960. ## # #.$$$$$.#\
  10961. #@ ####     ##\
  10962. # $  ## $$$ #\
  10963. # $ $  #   ##\
  10964. # $ $ $    #\
  10965. # $ $ $  ###\
  10966. # $ $  ###\
  10967. # $  ###\
  10968. #  ###\
  10969. ####\
  10970. ; #60\
  10971. \
  10972. ###\
  10973. ##@#########\
  10974. # $#   ##  #\
  10975. #      $   #\
  10976. # $##$###  ##\
  10977. #  ## ### ###\
  10978. #####.###   #\
  10979.    #....#  #\
  10980.    #....#  #\
  10981.    #....## ##\
  10982.   ### ####  #\
  10983.   #         #\
  10984.   #   #### ####\
  10985.   #####  $ $  #\
  10986.       # $ $   #\
  10987.       # $$$$$ #\
  10988.       #       #\
  10989.       #########\
  10990. ; #61\
  10991. \
  10992. ####  ####\
  10993. #  ####  #\
  10994. #   @    #\
  10995. # $$$$$$ #\
  10996. ##      ##\
  10997. # $$$$$$ #\
  10998. #        #\
  10999. #  $$$$  #\
  11000. ###    ###\
  11001. # $$$$ #\
  11002. #      #\
  11003. #  $$  #\
  11004. ###..###\
  11005. #..**..#\
  11006. #......#\
  11007. #..##..#\
  11008. #......#\
  11009. ########\
  11010. ; #62\
  11011. \
  11012.  ###########\
  11013.  #....   ..#\
  11014.  # .......##\
  11015. ### .#....#####\
  11016. #  #$##..##   #\
  11017. #     #### $  #\
  11018. # $$  #  #  $ #\
  11019. ##  $$#   $$ ##\
  11020. #$  $   #$  #\
  11021. # $$ #  #  $#\
  11022. # $ $#### $ #\
  11023. #       #  ##\
  11024. #### $  # ##\
  11025.    ### ## #\
  11026.     # $   #\
  11027.     #@ #  #\
  11028.     #######\
  11029. ; #63\
  11030. \
  11031.   ######\
  11032.   #    #\
  11033. #### ## #######\
  11034. # @$  $   #   ##\
  11035. # # $  $  # $  #\
  11036. #  $  ##### #  #\
  11037. #### ##  #### ##\
  11038.  #  #  ##  #  #\
  11039.  #            #\
  11040.  #######  #  ##\
  11041.   #..  #  ####\
  11042.   #..      #\
  11043.   #..  #   #\
  11044.   ##########\
  11045. ; #64\
  11046. \
  11047. #######\
  11048. #.....#\
  11049. #...#.#\
  11050. #.. ..# ####\
  11051. #.    ###  ########\
  11052. #### ## $         #\
  11053. ####    #  $$ #   #\
  11054. #   $ #  # $ #####\
  11055. # # $ $$ # ###\
  11056. #  #$##     #\
  11057. ##  $ $$## ##\
  11058.  ##   @  $  #\
  11059.   ###  ###$ #\
  11060.     #### #  #\
  11061.          ####\
  11062. ; #65\
  11063. \
  11064.       #########\
  11065.       #  ##   #\
  11066.     ### $     #\
  11067.  #### @$  ##$##\
  11068. ###  #### ### #\
  11069. #  $ # #.*..# #\
  11070. # #   $ ....# #\
  11071. #    # #....$ #\
  11072. ###  # #####  #\
  11073.  ####    $   #\
  11074.     ###$  $ ##\
  11075.       # $$ ##\
  11076.       #   ##\
  11077.       #  ##\
  11078.       ####\
  11079. ; #66\
  11080. \
  11081. ##################\
  11082. #   ##       $...#\
  11083. # $ $ $#$ ####  .#\
  11084. # $$#$       @...#\
  11085. # $   #$##$$ #...#\
  11086. # $ $$#    $ #...#\
  11087. #         ## #...#\
  11088. ##################\
  11089. ; #67\
  11090. \
  11091. #######\
  11092. #     #\
  11093. # $ $ #\
  11094. # $ ####\
  11095. ## $##  #########\
  11096. #   #  $  ......#\
  11097. # *##  #$ #  $  #\
  11098. #.....*.  ## $  #\
  11099. #.###   ##  ##$ #\
  11100. ### ######      #\
  11101.      #@$  $ $$ #\
  11102.      ###   #   #\
  11103.        #########\
  11104. ; #68\
  11105. \
  11106.              ####\
  11107.             ##  ###\
  11108. ##############  $  #\
  11109. #........... #   $ #\
  11110. #.# #######. #$ $###\
  11111. #.# ####### ##   ##\
  11112. #..           $$$@#\
  11113. #  ######## ##    #\
  11114. ####   #   $$ #####\
  11115.       # $    $ #\
  11116.       ## $$  $ #\
  11117.        ##  $$  #\
  11118.         ##     #\
  11119.          ##   ##\
  11120.           #####\
  11121. ; #69\
  11122. \
  11123.      #######\
  11124.  #####     #\
  11125. ###   # ##$ ##\
  11126. # $   #      #\
  11127. # $# ##$# #$ #\
  11128. #@ # # $  #  #\
  11129. # $# # $###$ #\
  11130. # $  $    # ##\
  11131. ## # $# #    #\
  11132. # $#  ..##. .#\
  11133. #  ### ..#.# #\
  11134. #   ## ......#\
  11135. ##############\
  11136. ; #70\
  11137. \
  11138.        #######\
  11139.        #     #\
  11140.    #####     ###\
  11141. #####   ## ##...#\
  11142. #     # ## ##...#\
  11143. # ###$$$ $ ##...#\
  11144. # #   $ $  ##...#\
  11145. # # #$ $ $###...#\
  11146. # #   $@$   ## ##\
  11147. # #  $ $ $ $#  #\
  11148. # # ######     #\
  11149. #              #\
  11150. ################\
  11151. ; #71\
  11152. \
  11153.             ####\
  11154.      ########  #\
  11155.      #     #   #\
  11156.    ### ###   # #\
  11157. #####     $   # #\
  11158. #   $ $ ###$$ # #\
  11159. #  $ $$$  # $## #\
  11160. #  #$   #  $  # #\
  11161. ##   #### ### #$##\
  11162. # ###......     #\
  11163. #   $......## # #\
  11164. # ###......##   #\
  11165. #$$ #   #########\
  11166. #     # $@$ #\
  11167. #######     #\
  11168.       #######\
  11169. ; #72\
  11170. \
  11171.    ####     ####\
  11172.  ###  #######  ##\
  11173.  #  ........... #\
  11174.  # $ ##### ### $##\
  11175. ####  $ $ #   $  #\
  11176. #  #  # # #$# @# ##\
  11177. #         #   $ $ #\
  11178. #   ##   # $$$#   #\
  11179. ##  #     #      ###\
  11180. #    # ##  #  ####\
  11181. #         #   #\
  11182. ########  #####\
  11183.       ####\
  11184. ; #73\
  11185. \
  11186.  #####\
  11187.  #   #\
  11188. ###$# ###\
  11189. # $...  ###\
  11190. # #.#*#   #\
  11191. # $.#.$   #\
  11192. #  ## ## ##\
  11193. ## @ $ $ #\
  11194. ###   ###\
  11195.   #####\
  11196. ; #74\
  11197. \
  11198.          #### ####\
  11199.          #  ###  #\
  11200.          #  $    #\
  11201.          # # $ $ #\
  11202.      ##### # #  ##\
  11203.      #.....# $$$#\
  11204.      #....* $   #\
  11205.      #*..*.# #$##\
  11206. #######....*# $  #\
  11207. #     $*.*..#    #\
  11208. #  $$ # ##$###$$ #\
  11209. #    $   #      ##\
  11210. #####$ $ ####  ##\
  11211. #@# $        ##\
  11212. #    ######  #\
  11213. ######    ####\
  11214. ; #75\
  11215. \
  11216.      #####\
  11217.     ##   ##\
  11218.    ##  *  ##\
  11219.   ##  * *  ##\
  11220.  ##  * * *  ##\
  11221. ##  * * * *  ####\
  11222. ##  * * * * *  # ##\
  11223. #  * * * * * *    #\
  11224. # * * * . * * *@$ #\
  11225. #  * * * * * *    #\
  11226. ##  * * * * *  # ##\
  11227. ##  * * * *  ####\
  11228.  ##  * * *  ##\
  11229.   ##  * *  ##\
  11230.    ##  *  ##\
  11231.     ##   ##\
  11232.      #####\
  11233. ; #76\
  11234. \
  11235.  ########\
  11236. ##..    #\
  11237. #...$ $ #\
  11238. ###.## ###\
  11239. #   ##$ #\
  11240. #  $@$  #\
  11241. ##$ ##  #\
  11242. #  #####\
  11243. ####\
  11244. ; #77\
  11245. \
  11246.  ####\
  11247.  #  #\
  11248.  #  #########\
  11249.  # $$ #.....#\
  11250.  #    #.*...#\
  11251. ###   $..##.#\
  11252. #  #$##$  #.#\
  11253. # $  ## ## .#\
  11254. #  ##  $ $ ##\
  11255. ###@ #$    ##\
  11256. #  $$ $   $#\
  11257. # $  ####  #\
  11258. #    #  ####\
  11259. #   ##\
  11260. #####\
  11261. ; #78\
  11262. \
  11263. ###\
  11264. # ##    ####\
  11265. #  ######  ###\
  11266. #   # $ $$ $ ###\
  11267. #  $ @ $    $  #\
  11268. # $ # #$  $    #\
  11269. #  ## # ### ####\
  11270. # ##    #  $  #\
  11271. ###... ## $ $ #\
  11272. ##....##   $  #\
  11273. #....## $  $###\
  11274. #...###  $  #\
  11275. #...# #  ####\
  11276. ##### ####\
  11277. ; #79\
  11278. \
  11279.           ####\
  11280.      ######  #\
  11281.      #   $   #\
  11282.      # $$ $  #\
  11283.      ## # $  #\
  11284. ######   $ # #\
  11285. #      $ $ $ ##\
  11286. # ## #######  #\
  11287. # $  ##...##$ #\
  11288. ##   ##...#.#  #\
  11289. # $ $ #.....$$ #\
  11290. #    $$.....#  #\
  11291. ##$   #..#..#$##\
  11292. # $#$####### #\
  11293. #    #       #\
  11294. #### # # #####\
  11295.    #   #@#\
  11296.    #######\
  11297. ; #80\
  11298. \
  11299.    ######\
  11300.    #    #\
  11301. #### ##$###\
  11302. #         #\
  11303. # #....#  #\
  11304. ## #....#$$#\
  11305. #   ....#  #\
  11306. # ##....   ##\
  11307. # ##....#$$ #\
  11308. #  $....#   #\
  11309. # $#### #   #\
  11310. #  $  $$$$$##\
  11311. ##$    $   #\
  11312. # $$# #   #\
  11313. #  $ $ $$$#\
  11314. # $   $   #\
  11315. #@##   ####\
  11316. ########\
  11317. ; #81\
  11318. \
  11319. ####\
  11320. #  #######\
  11321. #$  $    #\
  11322. #   # #$ #\
  11323. # #. .# ##\
  11324. # $...  #\
  11325. ##$#...# #\
  11326. #   $## $#\
  11327. #     $  #\
  11328. ####### @#\
  11329.      ####\
  11330. ; #82\
  11331. \
  11332. #####\
  11333. #   #    ##########\
  11334. #$  ######    ##  #\
  11335. ## $$  $   $  $... #\
  11336. # $ ##   #  #$#.#. #\
  11337. #    ##  ##$ $ ... #\
  11338. # $#    $ # # #.#. #\
  11339. #  ## #$  #    ... #\
  11340. # #  $#@$## # #.#. #\
  11341. #  $$ #$ #  #  ... #\
  11342. ###      #  #   ####\
  11343.  ###   ##  #####\
  11344.    #########\
  11345. ; #83\
  11346. \
  11347.   #####\
  11348.   #   #\
  11349.   # #$#\
  11350. ####   #\
  11351. #  #.# ##\
  11352. #  *.* @#\
  11353. #  #.#  #\
  11354. ## # #$##\
  11355. #  # #  #\
  11356. #    $  #\
  11357. #  ###  #\
  11358. #### ####\
  11359. ; #84\
  11360. \
  11361.     #####\
  11362. ######   #\
  11363. #  #     #\
  11364. # $$  #  #\
  11365. #   ### #######\
  11366. ##  #.....#   #\
  11367. #  $...*. $# ###\
  11368. # $#.....# #   #\
  11369. ## ####$##     #\
  11370. #  #      $ ####\
  11371. #  # @ $ # $#\
  11372. #  $  ##$   #\
  11373. ### #$   ####\
  11374.   #  $ $ #\
  11375.   ##  #  #\
  11376.    ####  #\
  11377.       ####\
  11378. ; #85\
  11379. \
  11380.   ####\
  11381.   #  #####\
  11382. ###$     #\
  11383. #     .# #\
  11384. # ## #.  #\
  11385. # $  #*####\
  11386. ## ####.   #\
  11387. #  #  @.#  #\
  11388. # $  #$.#$##\
  11389. ###    . $ #\
  11390.  ######   #\
  11391.       #####\
  11392. ; #86\
  11393. \
  11394.          #########\
  11395.          #       #\
  11396.          # ### # #\
  11397.     #### # #...# #\
  11398. ######  ###  ...  #\
  11399. #         # #...# #\
  11400. #  $#  $  # ## ## #\
  11401. ##  #### ##$      #\
  11402. # ##### #  #$ ####\
  11403. # #### $    $ #\
  11404. # $ ##$ ###   #\
  11405. #      $@######\
  11406. # # ######\
  11407. #   #\
  11408. #####\
  11409. ; #87\
  11410. \
  11411. ####\
  11412. # @#   ####\
  11413. #  #####..###\
  11414. #  # $  $...#\
  11415. ##   #  ... #\
  11416. #$$  ###$# #\
  11417. ##  # ### $ #\
  11418. # $   $   # #\
  11419. #    ####   #\
  11420. ######  #####\
  11421. ; #88\
  11422. \
  11423.    ########\
  11424. ####  ....#\
  11425. # #  $....######\
  11426. # $  #....## ..####\
  11427. #  $$## #### ....##\
  11428. ####    $ @## .....#\
  11429. #    $ $$ #### #####\
  11430. # #$$$$# $$ $  #\
  11431. #       # $ ## #\
  11432. ###  ## $  $  $#\
  11433.  # $   $      #\
  11434.  ####  $ ### $#\
  11435.     ###  # #  #\
  11436.       #### ####\
  11437. ; #89\
  11438. \
  11439.     #####\
  11440. ######   #\
  11441. #   ## # #\
  11442. #        #\
  11443. ##$###*###\
  11444. ## #.@.##\
  11445. #  *.#  #\
  11446. # # $ $ #\
  11447. #   ##  #\
  11448. #########\
  11449. ; #90\
  11450. \
  11451.     #####\
  11452.  ####   #\
  11453.  #    #@#\
  11454.  # ###  #\
  11455.  # #  $ ###\
  11456.  # # # $$ #\
  11457.  # # $$   #\
  11458. ### #   #$ #\
  11459. #   # $$ $ #\
  11460. # $ $      #\
  11461. ##$#########\
  11462. # ....#\
  11463. # ....#\
  11464. # ....#\
  11465. #######\
  11466. ; #91\
  11467. \
  11468. #########     #####\
  11469. #       #######   #\
  11470. # # # # #         #\
  11471. #   $ $ # ###### ##\
  11472. #####$#$# #  ..  ###\
  11473.  #  @$  $   ..# $ #\
  11474.  # #$#$# ###... $ #\
  11475.  #       ##...#   #\
  11476.  ##################\
  11477. ; #92\
  11478. \
  11479. ####\
  11480. #  #\
  11481. #  ###\
  11482. # $  ###\
  11483. ## ##.  #\
  11484. # $$..# #\
  11485. #  #*.$ #\
  11486. ## #. ###\
  11487. #   @#\
  11488. #$ ###\
  11489. #  #\
  11490. ####\
  11491. ; #93\
  11492. \
  11493.       #####\
  11494. ####  ##   #######\
  11495. #  #  #  $   $   #\
  11496. #  #### $ $ $ #  #\
  11497. #... $ $  #$#$## #\
  11498. #...# $ $        #\
  11499. #..# $ $ $########\
  11500. #...$ $ $@##\
  11501. ###### $ $ ###\
  11502.     # ##  ..#\
  11503.     # #  ...#\
  11504.     #    ...#\
  11505.     #########\
  11506. ; #94\
  11507. \
  11508.    #####\
  11509.    #   #\
  11510. ##### # #\
  11511. #   $   #\
  11512. #   #$#####\
  11513. ##$## $ $ #\
  11514. # ...#   #\
  11515. # #..*   #\
  11516. # @ ######\
  11517. #####\
  11518. ; #95\
  11519. \
  11520.    #######\
  11521.   ##     ##\
  11522.   #  ###  #\
  11523. ###$##. # ###\
  11524. ##    #..$   #\
  11525. #  $$ #..#   #\
  11526. # $$@ #.*# ###\
  11527. #  $#$#*.# #\
  11528. ##     ..# #\
  11529. ###$##  # #\
  11530.   #   ##  #\
  11531.   ###    ##\
  11532.     ######\
  11533. ; #96\
  11534. \
  11535. ###### ######\
  11536. #    # #    #\
  11537. ## ## ### $  #\
  11538. # $$     $$  #\
  11539. #  $ ## ## # #\
  11540. # # $ $    # #\
  11541. # $  $  # ## #######\
  11542. #  # #$   ## ##    #\
  11543. #### #  #### ## ## #\
  11544. #  $ $##  #       #\
  11545. # $ $     # ## ####\
  11546. ## ## ###  #   ....#\
  11547. #   # ###   ## ....#\
  11548. #   $$#       .....#\
  11549. #   #    #@####....#\
  11550. ############  ######\
  11551. ; #97\
  11552. \
  11553.  #########\
  11554.  #.......#\
  11555.  #.......###\
  11556.  #         #\
  11557.  ##  ##### #\
  11558.   # ##   # #\
  11559.   # #   $  #\
  11560.   #  $ $ ###\
  11561.  ##$#   $ @#\
  11562.  #  ## # $##\
  11563. ###$  $$#  ###\
  11564. #       #$   #\
  11565. # # $ $ $  $ #\
  11566. # ###### #  ##\
  11567. #        ####\
  11568. ##########\
  11569. ; #98\
  11570. \
  11571. #########\
  11572. #....   #\
  11573. #....   #\
  11574. #.#... ##\
  11575. #....#  ########\
  11576. ######$$   #   #\
  11577.   #    ## $$# #\
  11578.   #  #  ##  $ #\
  11579.   ## $ $   ## #\
  11580.   #   # $   # #\
  11581.   #   $ #$  # #\
  11582.   ## ## # $ # ##\
  11583.    #$ #$#  ## @#\
  11584.    #  # #$$ $  #\
  11585.    #          ##\
  11586.    ############\
  11587. ; #99\
  11588. \
  11589.  ####\
  11590.  #  #######\
  11591. ###$       #######\
  11592. # $  $$  $ ##....#\
  11593. #  $# ###$$   ...#\
  11594. # #    @  #   ...#\
  11595. # #$$ $ $$#$##...#\
  11596. #   ## ##   ##...#\
  11597. ##  $      $ #####\
  11598. #########  ##\
  11599.         ####\
  11600. ; #100\
  11601. \
  11602. #############\
  11603. #@$ $ $ *...#\
  11604. #  $ $ $.*..#\
  11605. # $ $ $ *...#\
  11606. #  $ $ $.*..#\
  11607. # $ $ $ *...#\
  11608. #  $ $ $.*..#\
  11609. # $ $ $ *...#\
  11610. #  $ $ $.*..#\
  11611. # $ $ $ *...#\
  11612. #  $ $ $.*..#\
  11613. #############\
  11614. ; #101\
  11615. \
  11616.     #####    #####\
  11617. ######   ######...##\
  11618. #   ## $ #  ##.... #\
  11619. # $$   $ #   #.. . #\
  11620. #   ### ## $ #....##\
  11621. ### #     $  #....#\
  11622. ## #   ### #####$#\
  11623. ## ###   # ##    #\
  11624. # $  @$$ # ##$$$ #\
  11625. # $ ##   # ## $  #\
  11626. #   ##### $## # ##\
  11627. #####  #     $ $ #\
  11628.        #   #     #\
  11629.        ###########\
  11630. ; #102\
  11631. \
  11632.  ####      ######\
  11633.  #  #      #    ##\
  11634.  #  ###   ##     #\
  11635.  #$   #   #   #  #\
  11636.  # $# #####      #\
  11637.  #   $   # # #####\
  11638. ###$$   # # # # #\
  11639. # $   $   # #   #\
  11640. # @$ $ ###  # # ##\
  11641. #  ## #          #\
  11642. ####...#  #    # #\
  11643.   #..*.# # # $  #\
  11644.   ##..*.# # #$ ##\
  11645.    ##..* $    $ #\
  11646.     ##..    #   #\
  11647.      ############\
  11648. ; #103\
  11649. \
  11650. ###################\
  11651. #  #   #   #   #  #\
  11652. #  $   $  $    $  #\
  11653. # $########## ##$ #\
  11654. ## ## *.*..*.* # ##\
  11655. #  ## ..*..... # ##\
  11656. #  ### ######### ##\
  11657. #  #      $ #   $ #\
  11658. ## #   $#$#@  #   #\
  11659. ## # #       ######\
  11660. # $  #########\
  11661. #   ##\
  11662. #####\
  11663. ; #104\
  11664. \
  11665.      ####\
  11666. #######  #\
  11667. #  #     #\
  11668. # $$ $#  #\
  11669. #  ##.# ####\
  11670. ## ##.#  $ #\
  11671. ## # . $ # #\
  11672. #   *..#   #\
  11673. #  # . # ###\
  11674. ## ##.##$#\
  11675. #     $@#\
  11676. #  ######\
  11677. ####\
  11678. ; #105\
  11679. \
  11680. ##########\
  11681. ##  ..... #\
  11682. #  #..... #\
  11683. # $ #### ##\
  11684. # $  @   #\
  11685. ## $ $ $ #\
  11686. # $$$$$ #\
  11687. #   #   #\
  11688. #########\
  11689. ; #106\
  11690. \
  11691. ##############\
  11692. #     #      #\
  11693. # $$$    $$$ #\
  11694. ##   $$$$   ##\
  11695. #$ $    $ $#\
  11696. #   $$$$   #\
  11697. #$$$    $$$#\
  11698. # $ $$$$ $ #\
  11699. #          #\
  11700. ######..######\
  11701. #..*.****.*..#\
  11702. #..*......*..#\
  11703. ##.********.##\
  11704. #..........#\
  11705. ######@#####\
  11706.      ###\
  11707. ; #107\
  11708. \
  11709.     #####\
  11710. ######   #\
  11711. # $ .. $ #\
  11712. #@$$.. $##\
  11713. # $ ..  #\
  11714. #########\
  11715. ; #108\
  11716. ",
  11717.   startgame = "function drawDisp()\
  11718. term.setCursorPos(1,1)\
  11719. term.setBackgroundColor(colors.white)\
  11720. term.clear()\
  11721. term.setCursorPos(1,1)\
  11722. term.setBackgroundColor(colors.brown)\
  11723. term.clearLine()\
  11724. write(\"RedCube Wallpaper Chooser\")\
  11725. term.setCursorPos(1,3)\
  11726. term.setBackgroundColor(colors.blue)\
  11727. write(\"P\")\
  11728. term.setBackgroundColor(colors.green)\
  11729. write(\"lains\")\
  11730. term.setCursorPos(1,5)\
  11731. term.setBackgroundColor(colors.blue)\
  11732. write(\"N\")\
  11733. term.setBackgroundColor(colors.green)\
  11734. write(\"ormal\")\
  11735. term.setCursorPos(1,7)\
  11736. term.setBackgroundColor(colors.blue)\
  11737. write(\"B\")\
  11738. term.setBackgroundColor(colors.green)\
  11739. write(\"SOD\")\
  11740. term.setCursorPos(1,9)\
  11741. term.setBackgroundColor(colors.blue)\
  11742. write(\"C\")\
  11743. term.setBackgroundColor(colors.green)\
  11744. write(\"ube\")\
  11745. term.setCursorPos(1,11)\
  11746. term.setBackgroundColor(colors.blue)\
  11747. write(\"E\")\
  11748. term.setBackgroundColor(colors.green)\
  11749. write(\"xit\")\
  11750. end\
  11751. \
  11752. drawDisp()\
  11753. \
  11754. evt, side, xPos, yPos = os.pullEvent(\"mouse_click\")\
  11755. \
  11756. if xPos == 1 and yPos == 3 then\
  11757. fs.delete(\"/.background\")\
  11758. fs.copy(\"/disk/plains\",\"/.background\")\
  11759. shell.run(\"/disk/startgame\")\
  11760. elseif xPos == 1 and yPos == 5 then\
  11761. fs.delete(\"/.background\")\
  11762. fs.copy(\"/disk/normal\",\"/.background\")\
  11763. shell.run(\"/disk/startgame\")\
  11764. elseif xPos == 1 and yPos == 7 then\
  11765. fs.delete(\"/.background\")\
  11766. fs.copy(\"/disk/bsod\",\"/.background\")\
  11767. shell.run(\"/disk/startgame\")\
  11768. elseif xPos == 1 and yPos == 9 then\
  11769. fs.delete(\"/.background\")\
  11770. fs.copy(\"cube\",\"/.background\")\
  11771. shell.run(\"/disk/startgame\")\
  11772. elseif xPos == 1 and yPos == 11 then\
  11773. shell.run(\"/startgui\")\
  11774. else\
  11775. shell.run(\"/disk/startgame\")\
  11776. end\
  11777. ",
  11778.   [ "ccsand/info" ] = "return {\
  11779.  sGameFile = \"startgame\",\
  11780.  sName = \"CCSand\",\
  11781. }",
  11782.   [ "redcast/files/gamelib" ] = "local w,h = term.getSize()\
  11783. local previousDir = currentDir\
  11784. local currentDir = \"games\"\
  11785. local dirFiles = fs.list(currentDir)\
  11786. local newDirFiles = {}\
  11787. local choice = 1\
  11788. \
  11789. function printCentered(string, y)\
  11790.  local x = (w/2)-(string.len(string)/2)\
  11791.  term.setCursorPos(x,y)\
  11792.  term.write(string)\
  11793. end\
  11794. \
  11795. function clearScr()\
  11796.  term.clear()\
  11797.  term.setCursorPos(1,1)\
  11798. end\
  11799. \
  11800. function updateList()\
  11801.  for i = 1,#dirFiles do\
  11802.    newDirFiles[i] = currentDir..\"/\"..dirFiles[i]\
  11803.    --dirFiles[i] = currentDir..dirFiles[i]\
  11804.  end\
  11805.  clearScr()\
  11806.  for i = 1,#newDirFiles do\
  11807.    print(newDirFiles[i])\
  11808.  end\
  11809.  --error()\
  11810. end\
  11811. \
  11812. --clearScr()\
  11813. --printCentered(\"Simple File Manager\",2)\
  11814. --printCentered(\"By Gonow32\",3)\
  11815. --printCentered(\"Press B to go back a folder\",5)\
  11816. --printCentered(\"Press C to create a file\",6)\
  11817. --printCentered(\"Press D to delete a file/folder\",7)\
  11818. --printCentered(\"Press M to make a folder\",8)\
  11819. --printCentered(\"Press R to go to the root directory\",9)\
  11820. --sleep(5)\
  11821. \
  11822. function renderDir()\
  11823.  clearScr()\
  11824.  for i = 1,#dirFiles do\
  11825.    if fs.isDir(newDirFiles[i]) then\
  11826.      if choice == i then\
  11827.        term.setBackgroundColour(colours.white)\
  11828.      end\
  11829.      term.setTextColour(colours.green)\
  11830.      printCentered(dirFiles[i], i)\
  11831.      term.setTextColour(colours.white)\
  11832.      term.setBackgroundColour(colours.black)\
  11833.    else\
  11834.      if choice == i then\
  11835.        term.setBackgroundColour(colours.white)\
  11836.        term.setTextColour(colours.black)\
  11837.      end\
  11838.      printCentered(dirFiles[i], i)\
  11839.      term.setBackgroundColour(colours.black)\
  11840.      term.setTextColour(colours.white)\
  11841.    end\
  11842.  end\
  11843.  --printCentered(\"Simple File Manager\",h)\
  11844.  --printCentered(\"Press B to go back\",h-1)\
  11845.  --printCentered(\"Press C to make a new file\",h-2)\
  11846.  --if fs.exists(\"partitiontable\") then\
  11847.    --file = fs.open(\"partitiontable\",\"r\")\
  11848.    --if not tonumber(file.readLine()) then\
  11849.      --term.setCursorPos(1,h)\
  11850.      --term.write(\"Corrupt Disk\")\
  11851.    --else\
  11852.      --term.setCursorPos(1,h)\
  11853.      --term.write(\"FDisk Format\")\
  11854.    --end\
  11855.    --file.close()\
  11856.  --else\
  11857.    --term.setCursorPos(1,h)\
  11858.    --term.write(\"Regular Disk\")\
  11859.  --end\
  11860.  --local freeSpace = tostring(fs.getFreeSpace(currentDir))\
  11861.  --term.setCursorPos((w-string.len(freeSpace))-1,h)\
  11862.  --term.write(freeSpace..\"B\")\
  11863. end\
  11864. \
  11865. updateList()\
  11866. \
  11867. while true do\
  11868.  renderDir()\
  11869.  local event, key = os.pullEvent(\"key\")\
  11870.  if key == keys.up then\
  11871.    if choice == 1 then\
  11872.      choice = #dirFiles\
  11873.    else\
  11874.      choice = choice - 1\
  11875.    end\
  11876.  elseif key == keys.q then\
  11877.    return\
  11878.  elseif key == keys.down then\
  11879.    if choice == #dirFiles then\
  11880.      choice = 1\
  11881.    else\
  11882.      choice = choice + 1      \
  11883.    end\
  11884.  elseif key == keys.d then\
  11885.    printCentered(\"Confirm Delete [Y/N]\",h-1)\
  11886.    local event, key = os.pullEvent(\"key\")\
  11887.    if key == keys.y then\
  11888.      if not fs.isReadOnly(newDirFiles[choice]) then\
  11889.        fs.delete(newDirFiles[choice])\
  11890.        dirFiles = fs.list(currentDir)\
  11891.        updateList()\
  11892.        choice = 1\
  11893.        renderDir()\
  11894.      end\
  11895.    end\
  11896.  elseif key == keys.enter then\
  11897.    shell.run(newDirFiles[choice])\
  11898.    term.setBackgroundColour(colours.black)\
  11899.    term.setTextColour(colours.white)\
  11900.  end\
  11901. end",
  11902.   [ "tron/startgame" ] = "local isOpen=false\
  11903. for k,v in pairs({\"right\",\"left\",\"top\",\"bottom\",\"front\",\"back\"}) do\
  11904.     if peripheral.getType(v)==\"modem\" then\
  11905.         rednet.open(v)\
  11906.         isOpen=true\
  11907.     end\
  11908. end\
  11909. if not isOpen then\
  11910.     error(\"no modem attached\")\
  11911. end\
  11912. local Mx,My=term.getSize()\
  11913. local Cx,Cy=math.floor(Mx/2),math.floor(My/2)\
  11914. function maingame()\
  11915.     local lang={\"Waiting for player\",{[0]=\"^\",\">\",\"v\",\"<\"},{{\"|\",\"/\",\"|\",\"\\\\\"},{\"/\",\"-\",\"\\\\\",\"-\"},{\"|\",\"\\\\\",\"|\",\"/\"},{\"\\\\\",\"-\",\"/\",\"-\"}},\"You died.\",\"You won.\"}\
  11916.     local board=setmetatable({},{__index=function(s,n) s[n]={} return s[n] end})\
  11917.     for l1=99,-99,-1 do\
  11918.         board[l1][-99]={\"-\",3}\
  11919.     end\
  11920.     for l1=99,-99,-1 do\
  11921.         board[l1][99]={\"|\",3}\
  11922.     end\
  11923.     for l1=99,-99,-1 do\
  11924.         board[-99][l1]={\"-\",3}\
  11925.     end\
  11926.     for l1=99,-99,-1 do\
  11927.         board[99][l1]={\"|\",3}\
  11928.     end\
  11929.     board[100][100]={\"/\",3}\
  11930.     board[100][-100]={\"\\\\\",3}\
  11931.     board[-100][100]={\"/\",3}\
  11932.     board[-100][-100]={\"\\\\\",3}\
  11933.     local modem\
  11934.     local initheader=\"TRON:\"\
  11935.     local pnid\
  11936.     local function send(...)\
  11937.         rednet.send(pnid,string.sub(textutils.serialize({...}),2,-2))\
  11938.     end\
  11939.     local function decode(dat)\
  11940.         return textutils.unserialize(\"{\"..dat..\"}\")\
  11941.     end\
  11942.     local col\
  11943.     term.setCursorPos(math.floor(Cx-(#lang[1])/2),Cy)\
  11944.     term.setTextColor(colors.orange)\
  11945.     term.setBackgroundColor(colors.black)\
  11946.     term.clear()\
  11947.     term.write(lang[1])\
  11948.     rednet.broadcast(initheader..\"pingcon\")\
  11949.     local p1,p2\
  11950.     while true do\
  11951.         local p={os.pullEvent()}\
  11952.         if p[1]==\"rednet_message\" and p[2]~=os.getComputerID() then\
  11953.             if p[3]==initheader..\"pingcon\" then\
  11954.                 rednet.send(p[2],initheader..\"pongcon\")\
  11955.                 pnid=p[2]\
  11956.                 col={colors.blue,colors.red}\
  11957.                 p1={pos={x=2,y=1},dir=0}\
  11958.                 p2={pos={x=1,y=1},dir=0}\
  11959.                 break\
  11960.             elseif p[3]==initheader..\"pongcon\" then\
  11961.                 pnid=p[2]\
  11962.                 col={colors.red,colors.blue}\
  11963.                 p1={pos={x=1,y=1},dir=0}\
  11964.                 p2={pos={x=2,y=1},dir=0}\
  11965.                 break\
  11966.             end\
  11967.         end\
  11968.     end\
  11969.     term.setBackgroundColor(colors.black)\
  11970.     term.clear()\
  11971.     local frs=0\
  11972.     local fps=0 -- frame counter (debugging)\
  11973.     local function render()\
  11974.         frs=frs+1\
  11975.         term.setTextColor(colors.gray)\
  11976.         for l1=1,My do\
  11977.             term.setCursorPos(1,l1)\
  11978.             local pre=p1.pos.x%3\
  11979.             if (l1+p1.pos.y)%3==0 then\
  11980.                 if pre==1 then\
  11981.                     pre=\"--\"\
  11982.                 elseif pre==2 then\
  11983.                     pre=\"-\"\
  11984.                 else\
  11985.                     pre=\"\"\
  11986.                 end\
  11987.                 term.write(pre..string.rep(\"+--\",math.ceil(Mx/2)))\
  11988.             else\
  11989.                 if pre==1 then\
  11990.                     pre=\"  \"\
  11991.                 elseif pre==2 then\
  11992.                     pre=\" \"\
  11993.                 else\
  11994.                     pre=\"\"\
  11995.                 end\
  11996.                 term.write(pre..string.rep(\"|  \",math.ceil(Mx/2)))\
  11997.             end\
  11998.         end\
  11999.         term.setTextColor(colors.blue)\
  12000.         local num=0\
  12001.         for k,v in pairs(board) do\
  12002.             for l,y in pairs(v) do\
  12003.                 if (k-p1.pos.x)+Cx<=Mx and (k-p1.pos.x)+Cx>=1 and (l-p1.pos.y)+Cy<=My and (l-p1.pos.y)+Cy>=1 then\
  12004.                     term.setTextColor(col[y[2]] or y[2])\
  12005.                     term.setCursorPos((k-p1.pos.x)+Cx,(l-p1.pos.y)+Cy)\
  12006.                     term.write(y[1])\
  12007.                     num=num+1\
  12008.                 end\
  12009.             end     \
  12010.         end\
  12011.         term.setCursorPos(1,1)\
  12012.         if col[1]==colors.blue then\
  12013.             term.setTextColor(colors.blue)\
  12014.             term.write(\"BLUE\")\
  12015.         else\
  12016.             term.setTextColor(colors.red)\
  12017.             term.write(\"RED\")\
  12018.         end\
  12019.     end\
  12020.     local odr={[p1]=p1.dir,[p2]=p2.dir}\
  12021.     local function processmove(u)\
  12022.         local ccol\
  12023.         if u==p1 then\
  12024.             ccol=col[1]\
  12025.         else\
  12026.             ccol=col[2]\
  12027.         end\
  12028.         term.setTextColor(ccol)\
  12029.         if u==p1 and board[u.pos.x][u.pos.y] then\
  12030.             send(\"DIE\")\
  12031.             term.setCursorPos(Cx,Cy)\
  12032.             term.write(\"x\")\
  12033.             sleep(2)\
  12034.             term.setCursorPos(Cx-math.floor(#lang[4]/2),Cy)\
  12035.             term.setTextColor(colors.orange)\
  12036.             term.clear()\
  12037.             term.write(lang[4])\
  12038.             sleep(5)\
  12039.             term.setTextColor(colors.white)\
  12040.             term.setBackgroundColor(colors.black)\
  12041.             term.setCursorPos(1,1)\
  12042.             term.clear()\
  12043.             error(\"\",0)\
  12044.         end\
  12045.         if odr[u]~=u.dir then\
  12046.             board[u.pos.x][u.pos.y]={lang[3][odr[u]+1][u.dir+1],ccol}\
  12047.         end\
  12048.         if not board[u.pos.x][u.pos.y] then\
  12049.             if u.dir%2==0 then\
  12050.                 board[u.pos.x][u.pos.y]={\"|\",ccol}\
  12051.             else\
  12052.                 board[u.pos.x][u.pos.y]={\"-\",ccol}\
  12053.             end\
  12054.         end\
  12055.         local chr=board[u.pos.x][u.pos.y][1]\
  12056.         local shr={x=u.pos.x,y=u.pos.y}\
  12057.         if u.dir==0 then\
  12058.             u.pos.y=u.pos.y-1\
  12059.         elseif u.dir==1 then\
  12060.             u.pos.x=u.pos.x+1\
  12061.         elseif u.dir==2 then\
  12062.             u.pos.y=u.pos.y+1\
  12063.         else\
  12064.             u.pos.x=u.pos.x-1\
  12065.         end\
  12066.         odr[u]=u.dir\
  12067.         return chr,shr\
  12068.     end\
  12069.     local function renderchar(u)\
  12070.         local ccol\
  12071.         if u==p1 then\
  12072.             ccol=col[1]\
  12073.             term.setCursorPos(Cx,Cy)\
  12074.         else\
  12075.             ccol=col[2]\
  12076.             term.setCursorPos((p2.pos.x-p1.pos.x)+Cx,(p2.pos.y-p1.pos.y)+Cy)\
  12077.         end\
  12078.         term.setTextColor(ccol)\
  12079.         term.write(lang[2][u.dir])\
  12080.     end\
  12081.     function processturn(p,u)\
  12082.         local dirs={[keys.up]=0,[keys.right]=1,[keys.down]=2,[keys.left]=3}\
  12083.         if (odr[u]+2)%4~=dirs[p] then\
  12084.             u.dir=dirs[p]\
  12085.             renderchar(u)\
  12086.             if u==p1 then\
  12087.                 send(\"ROT\",u.dir)\
  12088.             end\
  12089.         end\
  12090.     end\
  12091.     render()\
  12092.     local move=os.startTimer(0.1)\
  12093.     local fct=os.startTimer(1)\
  12094.     while true do\
  12095.         local p={os.pullEvent()}\
  12096.         if p[1]==\"key\" then\
  12097.             if p[2]==keys.up or p[2]==keys.right or p[2]==keys.down or p[2]==keys.left then\
  12098.                 processturn(p[2],p1)\
  12099.             end\
  12100.         elseif p[1]==\"timer\" then\
  12101.             if p[2]==move then\
  12102.                 local ret,ret2=processmove(p1)\
  12103.                 move=os.startTimer(0.1)\
  12104.                 send(\"MOVE\",ret2,ret)\
  12105.             elseif p[2]==fct then\
  12106.                 fps=frs\
  12107.                 frs=0\
  12108.                 fct=os.startTimer(1)\
  12109.             end\
  12110.         elseif p[1]==\"rednet_message\" and p[2]==pnid then\
  12111.             local dat=decode(p[3])\
  12112.             if dat[1]==\"ROT\" then\
  12113.                 p2.dir=dat[2]\
  12114.                 renderchar(p2)\
  12115.             elseif dat[1]==\"DIE\" then\
  12116.                 p1.pos=p2.pos\
  12117.                 render()\
  12118.                 term.setTextColor(col[2])\
  12119.                 term.setCursorPos(Cx,Cy)\
  12120.                 term.write(\"x\")\
  12121.                 sleep(2)\
  12122.                 term.setCursorPos(Cx-math.floor(#lang[5]/2),Cy)\
  12123.                 term.setTextColor(colors.orange)\
  12124.                 term.clear()\
  12125.                 term.write(lang[5])\
  12126.                 sleep(5)\
  12127.                 term.setTextColor(colors.white)\
  12128.                 term.setBackgroundColor(colors.black)\
  12129.                 term.setCursorPos(1,1)\
  12130.                 term.clear()\
  12131.                 return\
  12132.             elseif dat[1]==\"MOVE\" then\
  12133.                 p2.pos=dat[2]\
  12134.                 board[p2.pos.x][p2.pos.y]={dat[3],col[2]}\
  12135.                 render()\
  12136.                 renderchar(p1)\
  12137.                 renderchar(p2)\
  12138.             end\
  12139.         end\
  12140.     end\
  12141. end\
  12142. local selected=1\
  12143. function rmain()\
  12144.     term.setBackgroundColor(colors.black)\
  12145.     term.clear()\
  12146.     term.setCursorPos(1,1)\
  12147.     term.setTextColor(colors.blue)\
  12148.     local txt=\"  _  _______________     ________    __       _\\n/ \\\\/  _____________\\\\   /  ____  \\\\  |  \\\\     / |\\n\\\\_/| /    / \\\\       | /  /    \\\\  \\\\ |   \\\\ __/  |\\n   | |    | |\\\\  ___/ |  |      |  ||    \\\\     |\\n   | |    | | \\\\ \\\\    |  |      |  ||   __\\\\    |\\n   | |    | |  \\\\ \\\\    \\\\  \\\\____/  / |  /   \\\\   |\\n   \\\\_/    \\\\_/   \\\\_/    \\\\________/  |_/     \\\\__|\"\
  12149.     local cnt=1\
  12150.     local cnt2=Cx-23\
  12151.     for char in string.gmatch(txt,\".\") do\
  12152.         if char~=\" \" and char~=\"\\n\" then\
  12153.             term.setCursorPos(cnt2,cnt)\
  12154.             term.write(char)\
  12155.         elseif char==\"\\n\" then\
  12156.             cnt=cnt+1\
  12157.             cnt2=Cx-23\
  12158.         end\
  12159.         cnt2=cnt2+1\
  12160.     end\
  12161.     local selections={\"Multiplayer\",\"Exit\"}\
  12162.     selected=((selected-1)%(#selections))+1\
  12163.     for k,v in pairs(selections) do\
  12164.         if k==selected then\
  12165.             term.setTextColor(colors.blue)\
  12166.             term.setCursorPos(Cx-(math.floor(#v/2)+1),k+10)\
  12167.             term.write(\">\"..v..\"<\")\
  12168.             term.setTextColor(colors.lightBlue)\
  12169.             term.setCursorPos(Cx-math.floor(#v/2),k+10)\
  12170.             term.write(v)\
  12171.         else\
  12172.             term.setTextColor(colors.lightBlue)\
  12173.             term.setCursorPos(Cx-math.floor(#v/2),k+10)\
  12174.             term.write(v)\
  12175.         end\
  12176.     end\
  12177. end\
  12178. rmain()\
  12179. while true do\
  12180.     p={os.pullEvent()}\
  12181.     if p[1]==\"key\" then\
  12182.         if p[2]==keys.up then\
  12183.             selected=selected-1\
  12184.             rmain()\
  12185.         elseif p[2]==keys.down then\
  12186.             selected=selected+1\
  12187.             rmain()\
  12188.         elseif p[2]==keys.enter then\
  12189.             if selected==1 then\
  12190.                 a,b=pcall(maingame)\
  12191.                 if not a and b~=\"\" then\
  12192.                     error(b,0)\
  12193.                 end\
  12194.                 rmain()\
  12195.             else\
  12196.             break\
  12197.             end\
  12198.         end\
  12199.     end\
  12200. end\
  12201. term.setCursorPos(1,1)\
  12202. term.clear()",
  12203.   [ "quicktype/info" ] = "return {\
  12204.  sGameFile = \"startgame\",\
  12205.  sName = \"QuickType\",\
  12206. }",
  12207.   [ "redcast/files/manager" ] = "local w,h = term.getSize()\
  12208. local previousDir = currentDir\
  12209. local currentDir = \"/\"\
  12210. local dirFiles = fs.list(currentDir)\
  12211. local newDirFiles = {}\
  12212. local choice = 1\
  12213. \
  12214. function printCentered(string, y)\
  12215.  local x = (w/2)-(string.len(string)/2)\
  12216.  term.setCursorPos(x,y)\
  12217.  term.write(string)\
  12218. end\
  12219. \
  12220. function clearScr()\
  12221.  term.clear()\
  12222.  term.setCursorPos(1,1)\
  12223. end\
  12224. \
  12225. function updateList()\
  12226.  for i = 1,#dirFiles do\
  12227.    newDirFiles[i] = currentDir..\"/\"..dirFiles[i]\
  12228.    --dirFiles[i] = currentDir..dirFiles[i]\
  12229.  end\
  12230.  clearScr()\
  12231.  for i = 1,#newDirFiles do\
  12232.    print(newDirFiles[i])\
  12233.  end\
  12234.  --error()\
  12235. end\
  12236. \
  12237. clearScr()\
  12238. printCentered(\"Simple File Manager\",2)\
  12239. printCentered(\"By Gonow32\",3)\
  12240. printCentered(\"Press B to go back a folder\",5)\
  12241. printCentered(\"Press C to create a file\",6)\
  12242. printCentered(\"Press D to delete a file/folder\",7)\
  12243. printCentered(\"Press M to make a folder\",8)\
  12244. printCentered(\"Press R to go to the root directory\",9)\
  12245. sleep(5)\
  12246. \
  12247. function renderDir()\
  12248.  clearScr()\
  12249.  for i = 1,#dirFiles do\
  12250.    if fs.isDir(newDirFiles[i]) then\
  12251.      if choice == i then\
  12252.        term.setBackgroundColour(colours.white)\
  12253.      end\
  12254.      term.setTextColour(colours.green)\
  12255.      printCentered(dirFiles[i], i)\
  12256.      term.setTextColour(colours.white)\
  12257.      term.setBackgroundColour(colours.black)\
  12258.    else\
  12259.      if choice == i then\
  12260.        term.setBackgroundColour(colours.white)\
  12261.        term.setTextColour(colours.black)\
  12262.      end\
  12263.      printCentered(dirFiles[i], i)\
  12264.      term.setBackgroundColour(colours.black)\
  12265.      term.setTextColour(colours.white)\
  12266.    end\
  12267.  end\
  12268.  printCentered(\"Simple File Manager\",h)\
  12269.  --printCentered(\"Press B to go back\",h-1)\
  12270.  --printCentered(\"Press C to make a new file\",h-2)\
  12271.  if fs.exists(\"partitiontable\") then\
  12272.    file = fs.open(\"partitiontable\",\"r\")\
  12273.    if not tonumber(file.readLine()) then\
  12274.      term.setCursorPos(1,h)\
  12275.      term.write(\"Corrupt Disk\")\
  12276.    else\
  12277.      term.setCursorPos(1,h)\
  12278.      term.write(\"FDisk Format\")\
  12279.    end\
  12280.    file.close()\
  12281.  else\
  12282.    term.setCursorPos(1,h)\
  12283.    term.write(\"Regular Disk\")\
  12284.  end\
  12285.  local freeSpace = tostring(fs.getFreeSpace(currentDir))\
  12286.  term.setCursorPos((w-string.len(freeSpace))-1,h)\
  12287.  term.write(freeSpace..\"B\")\
  12288. end\
  12289. \
  12290. updateList()\
  12291. \
  12292. while true do\
  12293.  renderDir()\
  12294.  local event, key = os.pullEvent(\"key\")\
  12295.  if key == keys.up then\
  12296.    if choice == 1 then\
  12297.      choice = #dirFiles\
  12298.    else\
  12299.      choice = choice - 1\
  12300.    end\
  12301.  elseif key == keys.down then\
  12302.    if choice == #dirFiles then\
  12303.      choice = 1\
  12304.    else\
  12305.      choice = choice + 1      \
  12306.    end\
  12307.  elseif key == keys.c then\
  12308.    local filename = \"\"\
  12309.    while filename == \"\" do\
  12310.      clearScr()\
  12311.      term.write(\"Filename: \")\
  12312.      filename = read()\
  12313.    end\
  12314.    shell.run(\"edit \"..currentDir..filename)\
  12315.    dirFiles = fs.list(currentDir)\
  12316.    updateList()\
  12317.    renderDir()\
  12318.  elseif key == keys.d then\
  12319.    printCentered(\"Confirm Delete [Y/N]\",h-1)\
  12320.    local event, key = os.pullEvent(\"key\")\
  12321.    if key == keys.y then\
  12322.      if not fs.isReadOnly(newDirFiles[choice]) then\
  12323.        fs.delete(newDirFiles[choice])\
  12324.        dirFiles = fs.list(currentDir)\
  12325.        updateList()\
  12326.        choice = 1\
  12327.        renderDir()\
  12328.      end\
  12329.    end\
  12330.  elseif key == keys.r then\
  12331.    currentDir = \"/\"\
  12332.    dirFiles = fs.list(currentDir)\
  12333.    updateList()\
  12334.    choice = 1\
  12335.    renderDir()\
  12336.  elseif key == keys.m then\
  12337.    local name = \"\"\
  12338.    while name == \"\" do\
  12339.      clearScr()\
  12340.      term.write(\"Folder Name: \")\
  12341.      name = read()\
  12342.    end\
  12343.    splitter = \"/\"\
  12344.    if currentDir == \"/\" then\
  12345.      splitter = \"\"\
  12346.    end\
  12347.    fs.makeDir(currentDir..splitter..name)\
  12348.    dirFiles = fs.list(currentDir)\
  12349.    updateList()\
  12350.    renderDir()\
  12351.  elseif key == keys.b then\
  12352.    local pseudoDir = previousDir\
  12353.    previousDir = currentDir\
  12354.    currentDir = pseudoDir\
  12355.    dirFiles = fs.list(currentDir)\
  12356.    updateList()\
  12357.    choice = 1\
  12358.    renderDir()\
  12359.  elseif key == keys.enter then\
  12360.    if fs.isDir(newDirFiles[choice]) then\
  12361.      previousDir = currentDir\
  12362.      currentDir = newDirFiles[choice]\
  12363.      dirFiles = fs.list(currentDir)\
  12364.      updateList()\
  12365.      choice = 1\
  12366.      renderDir()\
  12367.    else\
  12368.      clearScr()\
  12369.      local invalid = true\
  12370.      --error(\"I reached here!\")\
  12371.      repeat\
  12372.        clearScr()\
  12373.        term.write(\"Run, Edit, Cancel or Delete? [R/E/C/D] \")\
  12374.        option = read()\
  12375.        if option == \"r\" or option == \"R\" then\
  12376.          invalid = false\
  12377.          shell.run(newDirFiles[choice])\
  12378.        elseif option == \"e\" or option == \"E\" then\
  12379.          invalid = false\
  12380.          shell.run(\"edit \"..newDirFiles[choice])\
  12381.        elseif option == \"c\" or option == \"C\" then\
  12382.          invalid = false\
  12383.        elseif option == \"d\" or option == \"D\" then\
  12384.          invalid = false\
  12385.          fs.delete(newDirFiles[choice])\
  12386.          dirFiles = fs.list(currentDir)\
  12387.          updateList()\
  12388.        end\
  12389.      until invalid == false\
  12390.    end\
  12391.  end\
  12392. end",
  12393.   [ "redcast/eula" ] = "CubeSpace RedCast\
  12394. End User License Agreement\
  12395. ---------------------------------------------------\
  12396. 1. Distribution\
  12397. As the end user, you shall not redistribute this\
  12398. software without permission from CubeSpace.\
  12399. 2. Source Code\
  12400. As the end user, you shall not copy code directly\
  12401. from the base of RedCast without\
  12402. permission from CubeSpace.\
  12403. 3. End Usage\
  12404. The software cannot be blamed for causing errors in\
  12405. originally unintended purposes such as work areas.",
  12406.   [ ".background" ] = "\
  12407.            eeeeeeeeeeeeeee\
  12408.            eeeeeeeeeeeeeee\
  12409.            eeeeeeeeeeeeeee\
  12410.            eeeeeeeeeeeeeee\
  12411.            eeeeeeeeeeeeeee\
  12412.            eeeeeeeeeeeeeee\
  12413.            eeeeeeeeeeeeeee\
  12414.            eeeeeeeeeeeeeee\
  12415.            eeeeeeeeeeeeeee\
  12416.            eeeeeeeeeeeeeee",
  12417.   [ "goldrunner/levels/classic_012" ] = "bbbbbbbbbb      4     4           5   bbbbbbbbbb\
  12418. bbbbbbbbbbcbbbbbbbbbbbbbbbbbc     c   bbbbbbbbbb\
  12419. bbbbbbbbbbc             4   cdddddc  4bbbbbbbbbb\
  12420. bbbbbbbbbbbbbbbbbbbcbbbbbbbbb     cbbbbbbbbbbbbb\
  12421. bbbbbbbbbbbbbbbbbbcc              c   bbbbbbbbbb\
  12422. bbbbbbbbbbbbbbbbbccdddddddc       c   bbbbbbbbbb\
  12423. bbbbbbbbbbb4 4bbcc      e c  4  e c  4bbbbbbbbbb\
  12424. bbbbbbbbbbbbbbbcc     cbbbb777bbbbcbbbbbbbbbbbbb\
  12425. bbbbbbbbbb     c      c           c   bbbbbbbbbb\
  12426. bbbbbbbbbb     c      c           c   bbbbbbbbbb\
  12427. bbbbbbbbbb    ec   4  cdddddddddddc  4bbbbbbbbbb\
  12428. bbbbbbbbbbcbbbbbbbbbbbc  4     4  cbbbbbbbbbbbbb\
  12429. bbbbbbbbbbc           c bbbbbbbbb c   bbbbbbbbbb\
  12430. bbbbbbbbbbc           c           c   bbbbbbbbbb\
  12431. bbbbbbbbbbc      4    c    0 4    c   bbbbbbbbbb\
  12432. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  12433. 7777777777777777777777777777777777777777777777777",
  12434.   [ "goldrunner/levels/classic_003" ] = "bbbbbbbbbb                           5bbbbbbbbbb\
  12435. bbbbbbbbbbdddddddddd    4            8bbbbbbbbbb\
  12436. bbbbbbbbbbc 4      cbbbbbbbbbbc      8bbbbbbbbbb\
  12437. bbbbbbbbbbbbbbbc   c          c7777777bbbbbbbbbb\
  12438. bbbbbbbbbb     c e c     4    c       bbbbbbbbbb\
  12439. bbbbbbbbbb     cbbbbbbcbbbbbcbb       bbbbbbbbbb\
  12440. bbbbbbbbbb  4  c      c     c  dd     bbbbbbbbbb\
  12441. bbbbbbbbbbbbbbcb      c  e  c    dd   bbbbbbbbbb\
  12442. bbbbbbbbbb    c    cbbbbbbcbb      dd4bbbbbbbbbb\
  12443. bbbbbbbbbb    cddddc      c  e       bbbbbbbbbbb\
  12444. bbbbbbbbbb    c       cbbbbbbbbbc     bbbbbbbbbb\
  12445. bbbbbbbbbb    c       cbbbbbbbbbc     bbbbbbbbbb\
  12446. bbbbbbbbbbbbbcbbbbbbbbbb   4   bbbbbcbbbbbbbbbbb\
  12447. bbbbbbbbbbbbbcbbbbbbbbbb cbbbc bbbbbcbbbbbbbbbbb\
  12448. bbbbbbbbbb   c      0    cbbbc   4  c bbbbbbbbbb\
  12449. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  12450. 7777777777777777777777777777777777777777777777777",
  12451.   [ "redcast/files/chatlib" ] = "modems = {peripheral.find(\"modem\")}\
  12452. timers = {}\
  12453. for i,v in pairs(modems) do\
  12454.  if v.isWireless() then m = v end\
  12455. end\
  12456. if not m then\
  12457.  error(\"You need at least 1 wireless modem!\")\
  12458. end\
  12459. if not fs.exists(\"favourites\") then\
  12460.  fs.makeDir(\"favourites\")\
  12461. end\
  12462. m.open(os.getComputerID())\
  12463. servers = fs.list(\"favourites\")\
  12464. status = {}\
  12465. for i,v in pairs(servers) do\
  12466.  status[i] = \"Unknown\"\
  12467. end\
  12468. sel = 1\
  12469. t = os.startTimer(0) --lower update time is the first thing\
  12470. term.clear()\
  12471. for i,v in pairs(servers) do\
  12472.  term.setCursorPos(2,i)\
  12473.  if sel == i then\
  12474.    write(\"-->\"..v..\" - \"..status[i]..\"<--\")\
  12475.  else\
  12476.    write(\"   \"..v..\" - \"..status[i])\
  12477.  end\
  12478. end\
  12479. while true do\
  12480.  e = {os.pullEvent()}\
  12481.  if e[1] == \"key\" then\
  12482.    if e[2] == keys.up then\
  12483.      sel = sel - 1\
  12484.      if sel <= 0 then\
  12485.        sel = #servers\
  12486.      end\
  12487.    elseif e[2] == keys.q then\
  12488.      return\
  12489.    elseif e[2] == keys.a then\
  12490.      term.clear()\
  12491.      term.setCursorPos(2,2)\
  12492.      term.write(\"New Server: \")\
  12493.      local input = read()\
  12494.      local f = fs.open(\"favourites/\"..input,\"w\")\
  12495.      f.write(\"\")\
  12496.      f.close()\
  12497.      servers = fs.list(\"favourites\")\
  12498.      for i,v in pairs(servers) do\
  12499.        status[i] = \"Unknown\"\
  12500.      end\
  12501.    elseif e[2] == keys.enter then\
  12502.      term.clear()\
  12503.      term.setCursorPos(1,1)\
  12504.      term.write(\"Username: \")\
  12505.      local input = read()\
  12506.      shell.run(\"chat join \"..servers[sel]..\" \"..input)\
  12507.    elseif e[2] == keys.down then\
  12508.      sel = sel + 1\
  12509.      if sel > #servers then\
  12510.        sel = 1\
  12511.      end\
  12512.    end\
  12513.    term.clear()\
  12514.    for i,v in pairs(servers) do\
  12515.      term.setCursorPos(2,i)\
  12516.      if sel == i then\
  12517.        write(\"-->\"..v..\" - \"..status[i]..\"<--\")\
  12518.       else\
  12519.        write(\"   \"..v..\" - \"..status[i])\
  12520.      end\
  12521.    end\
  12522.  elseif e[1] == \"timer\" then\
  12523.    if e[2] == t then\
  12524.      --send request to all servers\
  12525.      for i,v in pairs(servers) do\
  12526.        m.transmit(rednet.CHANNEL_BROADCAST,os.getComputerID(),{nMessageID = math.random(1,2147483647), nRecipient = rednet.CHANNEL_BROADCAST, message = {sType=\"lookup\",sProtocol=\"chat\",sHostname=v}, sProtocol=\"dns\"})\
  12527.        timers[i] = os.startTimer(0.5)\
  12528.      end\
  12529.      t = os.startTimer(1)\
  12530.    else\
  12531.      for i,v in pairs(timers) do\
  12532.        if v == e[2] then\
  12533.          status[i] = \"Offline\"\
  12534.        end\
  12535.      end\
  12536.    end\
  12537.  elseif e[1] == \"modem_message\" then\
  12538.    if type(e[5]) == \"table\" then\
  12539.      if e[5].sProtocol and e[5].sProtocol == \"dns\" then\
  12540.        if e[5].message and e[5].message.sType and e[5].message.sHostname and e[5].message.sProtocol then\
  12541.          if e[5].message.sType == \"lookup response\" and e[5].message.sProtocol == \"chat\" then\
  12542.            for i,v in pairs(servers) do\
  12543.              if v == e[5].message.sHostname then\
  12544.                status[i] = \"Online\"\
  12545.                timers[i] = nil\
  12546.                             for i,v in pairs(servers) do\
  12547.                  term.setCursorPos(2,i)\
  12548.                  if sel == i then\
  12549.                    write(\"-->\"..v..\" - \"..status[i]..\"<--\")\
  12550.                  else\
  12551.                    write(\"   \"..v..\" - \"..status[i])\
  12552.                  end\
  12553.                end\
  12554.              end\
  12555.            end\
  12556.          end\
  12557.        end\
  12558.      end\
  12559.    end\
  12560.  end\
  12561. end",
  12562.   [ "laserblast/info" ] = "return {\
  12563.  sGameFile = \"startgame\",\
  12564.  sName = \"Laserblast\",\
  12565. }",
  12566.   [ "redcast/files/credits" ] = "                 RedCast Credits\
  12567.               -------------------\
  12568.                            \
  12569. Gonow32 - Lead Developer\
  12570. \
  12571. datcoder1208 - RedCast Developer\
  12572. \
  12573. Mr_Iron2 - API and Game Contribution\
  12574. \
  12575. The_Nightmare - RedCube Clock Developer\
  12576. \
  12577. Luca_S - Chat Library Developer\
  12578. \
  12579. Translators\
  12580. -----------\
  12581. \
  12582. \
  12583. Gonow32 - English\
  12584. \
  12585. Luca_S - German\
  12586. \
  12587. Ale2610 - Italian\
  12588. \
  12589. RafiOfDevelop - Indonesian\
  12590. \
  12591.  _______ _                 _    \
  12592. |__   __| |               | |   \
  12593.    | |  | |__   __ _ _ __ | | __\
  12594.    | |  | '_ \\ / _` | '_ \\| |/ /\
  12595.    | |  | | | | (_| | | | |   < \
  12596.    |_|  |_| |_|\\__,_|_| |_|_|\\_\\\
  12597.                                 \
  12598.          __     __         \
  12599.          \\ \\   / /         \
  12600.           \\ \\_/ /__  _   _ \
  12601.            \\   / _ \\| | | |\
  12602.             | | (_) | |_| |\
  12603.             |_|\\___/ \\__,_|\
  12604.                            ",
  12605.   [ "redcast/files/apis/gameutils" ] = "--[[\
  12606.     GameUtil\
  12607.     An API for drawing sprites and animations made in NPaintPro\
  12608.     By NitrogenFingers\
  12609. ]]--\
  12610. \
  12611. \
  12612. --The back buffer. Initialized as nil\
  12613. local backbuffer = nil\
  12614. --The bounds of the terminal the back buffer displays to\
  12615. local tw,th = nil, nil\
  12616. \
  12617. --[[Constructs a new buffer. This must be done before the buffer can written to.\
  12618.     Params: terminal:?table = The function table to draw to a screen. By default (nil) this refers\
  12619.             to the native terminal, but monitor displays can be passed through as well:\
  12620.             local leftMonitor = peripherals.wrap(\"left\")\
  12621.             initializeBuffer(leftMonitor)\
  12622.     Returns:boolean = True if the buffer was successfully initialized; false otherwise\
  12623. ]]--\
  12624. function initializeBuffer(terminal)\
  12625.     if not terminal then terminal = term end\
  12626.     if not terminal.getSize then\
  12627.         error(\"Parameter cannot be used to initialize the backbuffer.\")\
  12628.     end\
  12629.     if not terminal.isColour() then\
  12630.         error(\"Parameter does not represent an advanced computer.\")\
  12631.     end\
  12632.     \
  12633.     tw,th = terminal.getSize()\
  12634.     backbuffer = { }\
  12635.     for y=1,th do\
  12636.         backbuffer[y] = { }\
  12637.     end\
  12638.     return true\
  12639. end\
  12640. \
  12641. --[[Will clear the buffer and reset to nil, or to a colour if provided\
  12642.     Params: colour:?number = The colour to set the back buffer to\
  12643.     Returns:nil\
  12644. ]]--\
  12645. function clearBuffer(colour)\
  12646.     if not backbuffer then\
  12647.         error(\"Back buffer not yet initialized!\")\
  12648.     end \
  12649.     \
  12650.     for y=1,#backbuffer do\
  12651.         backbuffer[y] = { }\
  12652.         if colour then\
  12653.             for x=1,tw do\
  12654.                 backbuffer[y][x] = colour\
  12655.             end\
  12656.         end\
  12657.     end\
  12658. end\
  12659. \
  12660. --[[Draws the given entity to the back buffer\
  12661.     Params: entity:table = the entity to draw to the buffer\
  12662.     Returns:nil\
  12663. ]]--\
  12664. function writeToBuffer(entity)\
  12665.     if not backbuffer then\
  12666.         error(\"Back buffer not yet initialized!\")\
  12667.     end \
  12668.     \
  12669.     local image = nil\
  12670.     if entity.type == \"animation\" then\
  12671.         image = entity.frames[entity.currentFrame]\
  12672.     else\
  12673.         image = entity.image\
  12674.     end\
  12675.     \
  12676.     for y=1,image.dimensions.height do\
  12677.         for x=1,image.dimensions.width do\
  12678.             if image[y][x] then\
  12679.                 local xpos,ypos = x,y\
  12680.                 if entity.mirror.x then xpos = image.dimensions.width - x + 1 end\
  12681.                 if entity.mirror.y then ypos = image.dimensions.height - y + 1 end\
  12682.                 \
  12683.                 --If the YPos doesn't exist, no need to loop through the rest of X!\
  12684.                 --Don't you love optimization?\
  12685.                 if not backbuffer[entity.y + ypos - 1] then break end\
  12686.                 \
  12687.                 backbuffer[entity.y + ypos - 1][entity.x + xpos - 1] = image[y][x]\
  12688.             end\
  12689.         end\
  12690.     end\
  12691. end\
  12692. \
  12693. --[[Draws the contents of the buffer to the screen. This will not clear the screen or the buffer.\
  12694.     Params: terminal:table = the terminal to draw to\
  12695.     Returns:nil\
  12696. ]]--\
  12697. function drawBuffer(terminal)\
  12698.     if not backbuffer then\
  12699.         error(\"Back buffer not yet initialized!\")\
  12700.     end \
  12701.     if not terminal then terminal = term end\
  12702.     if not terminal.setCursorPos or not terminal.setBackgroundColour or not terminal.write then\
  12703.         error(\"Parameter cannot be used to initialize the backbuffer.\")\
  12704.     end\
  12705.     if not terminal.isColour() then\
  12706.         error(\"Parameter does not represent an advanced computer.\")\
  12707.     end\
  12708.     \
  12709.     for y=1,math.min(#backbuffer, th) do\
  12710.         for x=1,tw do\
  12711.             if backbuffer[y][x] then\
  12712.                 terminal.setCursorPos(x,y)\
  12713.                 terminal.setBackgroundColour(backbuffer[y][x])\
  12714.                 terminal.write(\" \")\
  12715.             end\
  12716.         end\
  12717.     end\
  12718. end\
  12719. \
  12720. --[[Converts a hex digit into a colour value\
  12721.     Params: hex:?string = the hex digit to be converted\
  12722.     Returns:string A colour value corresponding to the hex, or nil if the character is invalid\
  12723. ]]--\
  12724. local function getColourOf(hex)\
  12725.     local value = tonumber(hex, 16)\
  12726.     if not value then return nil end\
  12727.     value = math.pow(2,value)\
  12728.     return value\
  12729. end\
  12730. \
  12731. --[[Converts every pixel of one colour in a given sprite to another colour\
  12732.     Use for \"reskinning\". Uses OO function.\
  12733.     Params: self:sprite = the sprite to reskin\
  12734.             oldcol:number = the colour to replace\
  12735.             newcol:number = the new colour\
  12736.     Returns:nil\
  12737. ]]--\
  12738. local function repaintS(self, oldcol, newcol)\
  12739.     for y=1,self.image.bounds.height do\
  12740.         for x=1, self.image.bounds.width do\
  12741.             if self.image[y][x] == oldcol then\
  12742.                 self.image[y][x] = newcol\
  12743.             end\
  12744.         end\
  12745.     end\
  12746. end\
  12747. \
  12748. --[[Converts every pixel of one colour in a given animation to another colour\
  12749.     Use for \"reskinning\". Uses OO function.\
  12750.     Params: self:animation = the animation to reskin\
  12751.             oldcol:number = the colour to replace\
  12752.             newcol:number = the new colour\
  12753.     Returns:nil\
  12754. ]]--\
  12755. local function repaintA(self, oldcol, newcol)\
  12756.     for f=1,#self.frames do\
  12757.         print(self.frames[f].bounds)\
  12758.         for y=1,self.frames[f].bounds.height do\
  12759.             for x=1, self.frames[f].bounds.width do\
  12760.                 if self.frames[f][y][x] == oldcol then\
  12761.                     self.frames[f][y][x] = newcol\
  12762.                 end\
  12763.             end\
  12764.         end\
  12765.     end\
  12766. end\
  12767. \
  12768. --[[Prints the sprite on the screen\
  12769.     Params: self:sprite = the sprite to draw\
  12770.     Returns:nil\
  12771. ]]--\
  12772. local function drawS(self)\
  12773.     local image = self.image\
  12774.     \
  12775.     for y=1,image.dimensions.height do\
  12776.         for x=1,image.dimensions.width do\
  12777.             if image[y][x] then\
  12778.                 local xpos,ypos = x,y\
  12779.                 if self.mirror.x then xpos = image.dimensions.width - x + 1 end\
  12780.                 if self.mirror.y then ypos = image.dimensions.height - y + 1 end\
  12781.                 \
  12782.                 term.setBackgroundColour(image[y][x])\
  12783.                 term.setCursorPos(self.x + xpos - 1, self.y + ypos - 1)\
  12784.                 term.write(\" \")\
  12785.             end\
  12786.         end\
  12787.     end\
  12788. end\
  12789. \
  12790. --[[Prints the current frame of the animation on screen\
  12791.     Params: self:anim = the animation to draw\
  12792.             frame:?number = the specific frame to draw (default self.currentFrame)\
  12793.     Returns:nil\
  12794. ]]--\
  12795. local function drawA(self, frame)\
  12796.     if not frame then frame = self.currentFrame end\
  12797.     local image = self.frames[frame]\
  12798. \
  12799.     for y=1,image.dimensions.height do\
  12800.         for x=1,image.dimensions.width do\
  12801.             if image[y][x] then\
  12802.                 local xpos,ypos = x,y\
  12803.                 if self.mirror.x then xpos = image.dimensions.width - x + 1 end\
  12804.                 if self.mirror.y then ypos = image.dimensions.height - y + 1 end\
  12805.                 \
  12806.                 term.setBackgroundColour(image[y][x])\
  12807.                 term.setCursorPos(self.x + xpos - 1, self.y + ypos - 1)\
  12808.                 term.write(\" \")\
  12809.             end\
  12810.         end\
  12811.     end\
  12812. end\
  12813. \
  12814. --[[Checks the animation timer provided to see whether or not the animation needs to be updated.\
  12815.     If so, it makes the necessary change.\
  12816.     Params: self:animation = the animation to be updated\
  12817.             timerID:number = the ID of the most recent timer event\
  12818.     Returns:bool = true if the animation was update; false otherwise\
  12819. ]]--\
  12820. local function updateA(self, timerID)\
  12821.     if self.timerID and timerID and self.timerID == timerID then\
  12822.         self.currentFrame = self.currentFrame + 1\
  12823.         if self.currentFrame > self.upperBound then\
  12824.             self.currentFrame = self.lowerBound\
  12825.         end\
  12826.         return true\
  12827.     else\
  12828.         return false\
  12829.     end\
  12830. end\
  12831. \
  12832. --[[Moves immediately to the next frame in the sequence, as though an update had been called.\
  12833.     Params: self:animation = the animation to update\
  12834.     Returns:nil\
  12835. ]]--\
  12836. local function nextA(self)\
  12837.     self.currentFrame = self.currentFrame + 1\
  12838.     if self.currentFrame > self.upperBound then\
  12839.         self.currentFrame = self.lowerBound\
  12840.     end\
  12841. end\
  12842. \
  12843. --[[Moves immediately to the previous frame in the sequence\
  12844.     Params: self:animation = the animation to update\
  12845.     Returns:nil\
  12846. ]]--\
  12847. local function previousA(self)\
  12848.     self.currentFrame = self.currentFrame - 1\
  12849.     if self.currentFrame < self.lowerBound then\
  12850.         self.currentFrame = self.upperBound\
  12851.     end\
  12852. end\
  12853. \
  12854. --[[A simple debug function that displays the outline of the bounds\
  12855.     on a given shape. Useful when testing collision detection or other game\
  12856.     features.\
  12857.     Params: entity:table = the bounded entity to represent\
  12858.             colour:?number = the colour to draw the rectangle (default red)\
  12859.     Returns:nil\
  12860. ]]--\
  12861. local function drawBounds(entity, colour)\
  12862.     if not colour then colour = colours.red end\
  12863.     local image = nil\
  12864.     if entity.type == \"animation\" then image = entity.frames[entity.currentFrame]\
  12865.     else image = entity.image end\
  12866.     \
  12867.     term.setBackgroundColour(colour)\
  12868.     \
  12869.     corners = {\
  12870.         topleft = { x = entity.x + image.bounds.x - 1, y = entity.y + image.bounds.y - 1 };\
  12871.         topright = { x = entity.x + image.bounds.x + image.bounds.width - 2, y = entity.y + image.bounds.y - 1 };\
  12872.         botleft = { x = entity.x + image.bounds.x - 1, y = entity.y + image.bounds.y + image.bounds.height - 2 };\
  12873.         botright = { x = entity.x + image.bounds.x + image.bounds.width - 2, y = entity.y + image.bounds.y + image.bounds.height - 2 };\
  12874.     }\
  12875.     \
  12876.     term.setCursorPos(corners.topleft.x, corners.topleft.y)\
  12877.     term.write(\" \")\
  12878.     term.setCursorPos(corners.topright.x, corners.topright.y)\
  12879.     term.write(\" \")\
  12880.     term.setCursorPos(corners.botleft.x, corners.botleft.y)\
  12881.     term.write(\" \")\
  12882.     term.setCursorPos(corners.botright.x, corners.botright.y)\
  12883.     term.write(\" \")\
  12884. end\
  12885. \
  12886. --[[Creates a bounding rectangle object. Used in drawing the bounds and the rCollidesWith methods\
  12887.     Params: self:table = the entity to create the rectangle\
  12888.     Returns:table = the left, right, top and bottom edges of the rectangle\
  12889. ]]--\
  12890. local function createRectangle(entity)\
  12891.     local image = nil\
  12892.     if entity.type == \"animation\" then\
  12893.         image = entity.frames[entity.currentFrame]\
  12894.     else\
  12895.         image = entity.image\
  12896.     end\
  12897.     --Note that the origin is always 1, so we subtract 1 for every absolute coordinate we have to test.\
  12898.     return {\
  12899.         left = entity.x + image.bounds.x - 1;\
  12900.         right = entity.x + image.bounds.x + image.bounds.width - 2;\
  12901.         top = entity.y + image.bounds.y - 1;\
  12902.         bottom = entity.y + image.bounds.y + image.bounds.height - 2;\
  12903.     }\
  12904. end\
  12905. \
  12906. --[[Performs a rectangle collision with another given entity. Entity can be of sprite or animation\
  12907.     type (also true of the self). Bases collision using a least squared approach (rectangle precision).\
  12908.     Params: self:sprite,animation = the object in question of the testing\
  12909.             other:sprite,animation = the other object tested for collision\
  12910.     Returns:bool = true if bounding rectangle intersect is true; false otherwse\
  12911. ]]--\
  12912. local function rCollidesWith(self, other)\
  12913.     --First we construct the rectangles\
  12914.     local img1C, img2C = createRectangle(self), createRectangle(other)\
  12915.     \
  12916.     --We then determine the \"relative position\" , in terms of which is farther left or right\
  12917.     leftmost,rightmost,topmost,botmost = nil,nil,nil,nil\
  12918.     if img1C.left < img2C.left then\
  12919.         leftmost = img1C\
  12920.         rightmost = img2C\
  12921.     else\
  12922.         leftmost = img2C\
  12923.         rightmost = img1C\
  12924.     end\
  12925.     if img1C.top < img2C.top then\
  12926.         topmost = img1C\
  12927.         botmost = img2C\
  12928.     else\
  12929.         topmost = img2C\
  12930.         botmost = img1C\
  12931.     end\
  12932.     \
  12933.     --Then we determine the distance between the \"extreme\" edges-\
  12934.         --distance between leftmost/right edge and rightmost/left edge\
  12935.         --distance between topmost/bottom edge and bottommost/top edge\
  12936.     local xdist = rightmost.left - leftmost.right\
  12937.     local ydist = botmost.top - topmost.bottom\
  12938.     \
  12939.     --If both are negative, our rectangles intersect!\
  12940.     return xdist <= 0 and ydist <= 0\
  12941. end\
  12942. \
  12943. --[[Performs a pixel collision test on another given entity. Either entity can be of sprite or animation\
  12944.     type. This is done coarsegrain-finegrain, we first find the intersection between the rectangles\
  12945.     (if there is one), and then test the space within that intersection for any intersecting pixels.\
  12946.     Params: self:sprite,animation = the object in question of the testing\
  12947.             other:sprite,animation = the other object being tested for collision\
  12948.     Returns:?number,?number: The X and Y position in which the collision occurred.\
  12949. ]]--\
  12950. local function pCollidesWith(self, other)\
  12951.     --Identically to rCollidesWith, we create our rectangles...\
  12952.     local img1C, img2C = createRectangle(self), createRectangle(other)\
  12953.     --We'll also need the images to compare pixels later\
  12954.     local img1, img2 = nil,nil\
  12955.     if self.type == \"animation\" then img1 = self.frames[self.currentFrame]\
  12956.     else img1 = self.image end\
  12957.     if other.type == \"animation\" then img2 = other.frames[other.currentFrame]\
  12958.     else img2 = other.image end\
  12959.     \
  12960.     --...then we position them...\
  12961.     leftmost,rightmost,topmost,botmost = nil,nil,nil,nil\
  12962.     --We also keep track of which is left and which is right- it doesn't matter in a rectangle\
  12963.     --collision but it does in a pixel collision.\
  12964.     img1T,img2T = {},{}\
  12965.     \
  12966.     if img1C.left < img2C.left then\
  12967.         leftmost = img1C\
  12968.         rightmost = img2C\
  12969.         img1T.left = true\
  12970.     else\
  12971.         leftmost = img2C\
  12972.         rightmost = img1C\
  12973.         img2T.left = true\
  12974.     end\
  12975.     if img1C.top < img2C.top then\
  12976.         topmost = img1C\
  12977.         botmost = img2C\
  12978.         img1T.top = true\
  12979.     else\
  12980.         topmost = img2C\
  12981.         botmost = img1C\
  12982.         img2T.top = true\
  12983.     end\
  12984.     \
  12985.     --...and we again find the distances between the extreme edges.\
  12986.     local xdist = rightmost.left - leftmost.right\
  12987.     local ydist = botmost.top - topmost.bottom\
  12988.     \
  12989.     --If these distances are > 0 then we stop- no need to go any farther.\
  12990.     if xdist > 0 or ydist > 0 then return false end\
  12991.     \
  12992.     \
  12993.     for x = rightmost.left, rightmost.left + math.abs(xdist) do\
  12994.         for y = botmost.top, botmost.top + math.abs(ydist) do\
  12995.             --We know a collision has occurred if a pixel is occupied by both images. We do this by\
  12996.             --first transforming the coordinates based on which rectangle is which, then testing if a\
  12997.             --pixel is at that point\
  12998.                 -- The leftmost and topmost takes the distance on x and y and removes the upper component\
  12999.                 -- The rightmost and bottommost, being the farther extremes, compare from 1 upwards\
  13000.             local testX,testY = 1,1\
  13001.             if img1T.left then testX = x - img1C.left + 1\
  13002.             else testX = x - img1C.left + 1 end\
  13003.             if img1T.top then testY = y - img1C.top + 1\
  13004.             else testY = y - img1C.top + 1 end\
  13005.             \
  13006.             local occupy1 = img1[testY + img1.bounds.y-1][testX + img1.bounds.x-1] ~= nil\
  13007.             \
  13008.             if img2T.left then testX = x - img2C.left + 1\
  13009.             else testX = x - img2C.left + 1 end\
  13010.             if img2T.top then testY = y - img2C.top + 1\
  13011.             else testY = y - img2C.top + 1 end\
  13012.             \
  13013.             local occupy2 = img2[testY + img2.bounds.y-1][testX + img2.bounds.x-1] ~= nil\
  13014.             \
  13015.             if occupy1 and occupy2 then return true end\
  13016.         end\
  13017.     end\
  13018.     --If the looop terminates without returning, then no pixels overlap\
  13019.     return false\
  13020. end\
  13021. \
  13022. --[[Moves the sprite or animation to the specified coordinates. This performs the auto-centering, so\
  13023.     the user doesn't have to worry about adjusting for the bounds of the shape. Recommended for absolute\
  13024.     positioning operations (as relative direct access to the X will have unexpected results!)\
  13025.     Params: self:table = the animation or sprite to move\
  13026.     x:number = the new x position\
  13027.     y:number = the new y position\
  13028. ]]--\
  13029. local function moveTo(self, x, y)\
  13030.     local image = nil\
  13031.     if self.type == \"animation\" then\
  13032.         image = self.frames[self.currentFrame]\
  13033.     else\
  13034.         image = self.image\
  13035.     end\
  13036.     \
  13037.     self.x = x - image.bounds.x + 1\
  13038.     self.y = y - image.bounds.y + 1\
  13039. end\
  13040. \
  13041. --[[\
  13042.     Sprites Fields:\
  13043. x:number = the x position of the sprite in the world\
  13044. y:number = the y position of the sprite in the world\
  13045. image:table = a table of the image. Indexed by height, a series of sub-tables, each entry being a pixel\
  13046.         at [y][x]. It also contains:\
  13047.     bounds:table =\
  13048.         x:number = the relative x position of the bounding rectangle\
  13049.         y:number = the relative y position of the bounding rectangle\
  13050.         width:number = the width of the bounding rectangle\
  13051.         height:number = the height of the bounding rectangle\
  13052.     dimensions:table =\
  13053.         width = the width of the entire image in pixels\
  13054.         height = the height of the entire image in pixels\
  13055.         \
  13056. mirror:table =\
  13057.     x:bool = whether or not the image is mirrored on the X axis\
  13058.     y:bool = whether or not the image is mirrored on the Y axis\
  13059. repaint:function = see repaintS (above)\
  13060. rCollidesWith:function = see rCollidesWith (above)\
  13061. pCollidesWith:function = see pCollidesWith (above)\
  13062. draw:function = see drawS (above)\
  13063. ]]--\
  13064. \
  13065. --[[Loads a new sprite into a table, and returns it to the user.\
  13066.     Params: path:string = the absolute path to the desired sprite\
  13067.     x:number = the initial X position of the sprite\
  13068.     y:number = the initial Y position of the sprite\
  13069. ]]--\
  13070. function loadSprite(path, x, y)\
  13071.     local sprite = { \
  13072.         type = \"sprite\",\
  13073.         x = x,\
  13074.         y = y,\
  13075.         image = { },\
  13076.         mirror = { x = false, y = false }\
  13077.     }\
  13078.     \
  13079.     if fs.exists(path) then\
  13080.         local file = io.open(path, \"r\" )\
  13081.         local leftX, rightX = math.huge, 0\
  13082.         local topY, botY = nil,nil\
  13083.         \
  13084.         local lcount = 0\
  13085.         for line in file:lines() do\
  13086.             lcount = lcount+1\
  13087.             table.insert(sprite.image, {})\
  13088.             for i=1,#line do\
  13089.                 if string.sub(line, i, i) ~= \" \" then\
  13090.                     leftX = math.min(leftX, i)\
  13091.                     rightX = math.max(rightX, i)\
  13092.                     if not topY then topY = lcount end\
  13093.                     botY = lcount\
  13094.                 end\
  13095.                 sprite.image[#sprite.image][i] = getColourOf(string.sub(line,i,i))\
  13096.             end\
  13097.         end\
  13098.         file:close()\
  13099.         \
  13100.         sprite.image.bounds = {\
  13101.             x = leftX,\
  13102.             width = rightX - leftX + 1,\
  13103.             y = topY,\
  13104.             height = botY - topY + 1\
  13105.         }\
  13106.         sprite.image.dimensions = {\
  13107.             width = rightX,\
  13108.             height = botY\
  13109.         }\
  13110.         \
  13111.         sprite.x = sprite.x - leftX + 1\
  13112.         sprite.y = sprite.y - topY + 1\
  13113.         \
  13114.         sprite.repaint = repaintS\
  13115.         sprite.rCollidesWith = rCollidesWith\
  13116.         sprite.pCollidesWith = pCollidesWith\
  13117.         sprite.draw = drawS\
  13118.         sprite.moveTo = moveTo\
  13119.         return sprite\
  13120.     else\
  13121.         error(path..\" not found!\")\
  13122.     end\
  13123. end\
  13124. \
  13125. --Animations contain\
  13126.     --Everything a sprite contains, but the image is a series of frames, not just one image\
  13127.     --An timerID that tracks the last animation\
  13128.     --An upper and lower bound on the active animation\
  13129.     --An update method that takes a timer event and updates the animation if necessary\
  13130. \
  13131. --[[\
  13132. \
  13133. ]]--\
  13134. function loadAnimation(path, x, y, currentFrame)\
  13135.     local anim = {\
  13136.         type = \"animation\",\
  13137.         x = x,\
  13138.         y = y,\
  13139.         frames = { },\
  13140.         mirror = { x = false, y = false },\
  13141.         currentFrame = currentFrame\
  13142.     }\
  13143.     \
  13144.     table.insert(anim.frames, { })\
  13145.     if fs.exists(path) then\
  13146.         local file = io.open(path, \"r\")\
  13147.         local leftX, rightX = math.huge, 0\
  13148.         local topY, botY = nil,nil\
  13149.         \
  13150.         local lcount = 0\
  13151.         for line in file:lines() do\
  13152.             lcount = lcount+1\
  13153.             local cFrame = #anim.frames\
  13154.             if line == \"~\" then\
  13155.                 anim.frames[cFrame].bounds = {\
  13156.                     x = leftX,\
  13157.                     y = topY,\
  13158.                     width = rightX - leftX + 1,\
  13159.                     height = botY - topY + 1\
  13160.                 }\
  13161.                 anim.frames[cFrame].dimensions = {\
  13162.                     width = rightX,\
  13163.                     height = botY\
  13164.                 }\
  13165.                 table.insert(anim.frames, { })\
  13166.                 leftX, rightX = math.huge, 0\
  13167.                 topY, botY = nil,nil\
  13168.                 lcount = 0\
  13169.             else\
  13170.                 table.insert(anim.frames[cFrame], {})\
  13171.                 for i=1,#line do\
  13172.                     if string.sub(line, i, i) ~= \" \" then\
  13173.                         leftX = math.min(leftX, i)\
  13174.                         rightX = math.max(rightX, i)\
  13175.                         if not topY then topY = lcount end\
  13176.                         botY = lcount\
  13177.                     end\
  13178.                     anim.frames[cFrame][#anim.frames[cFrame]] [i] = getColourOf(string.sub(line,i,i))\
  13179.                 end\
  13180.             end\
  13181.         end\
  13182.         file:close()\
  13183.         local cFrame = #anim.frames\
  13184.         anim.frames[cFrame].bounds = {\
  13185.             x = leftX,\
  13186.             y = topY,\
  13187.             width = rightX - leftX + 1,\
  13188.             height = botY - topY + 1\
  13189.         }\
  13190.         anim.frames[cFrame].dimensions = {\
  13191.             width = rightX,\
  13192.             height = botY\
  13193.         }\
  13194.         anim.x = anim.x - leftX + 1\
  13195.         anim.y = anim.y - topY + 1\
  13196.         \
  13197.         if not currentFrame or type(currentFrame) ~= \"number\" or currentFrame < 1 or \
  13198.                 currentFrame > #anim.frames then \
  13199.             anim.currentFrame = 1 \
  13200.         end\
  13201.     \
  13202.         anim.timerID = nil\
  13203.         anim.lowerBound = 1\
  13204.         anim.upperBound = #anim.frames\
  13205.         anim.updating = false\
  13206.     \
  13207.         anim.repaint = repaintA\
  13208.         anim.rCollidesWith = rCollidesWith\
  13209.         anim.pCollidesWith = pCollidesWith\
  13210.         anim.draw = drawA\
  13211.         anim.update = updateA\
  13212.         anim.next = nextA\
  13213.         anim.previous = previousA\
  13214.         anim.moveTo = moveTo\
  13215.         return anim\
  13216.     else\
  13217.         error(path..\" not found!\")\
  13218.     end\
  13219. end",
  13220.   [ "redcast/files/lang/de" ] = "return {\
  13221.  start = {\
  13222.    welcome = \"Willkommen zu RedCast.\",\
  13223.    revolution = \"Die Revolution der Konsolen.\",\
  13224.    setup = \"DrÃ¥BCcke ENTF um in den Setup zu gelangen.\",\
  13225.    free = \"%free%B freier Speicher.\"\
  13226.  },\
  13227.  disk = {\
  13228.    detect = \"Disk erkannt.\",\
  13229.    media = \"Musik disk erkannt\",\
  13230.    playquestion = \"MÃ¥B6chtest du die Musik abspielen?\",\
  13231.    play = \"Spiele %title%\"\
  13232.  },\
  13233.  gui = {\
  13234.    advancedonly = \"Diese GUI kann nur auf Advanced computern ausgefÃ¥BChrt werden.\",\
  13235.    menu = {\
  13236.      restart = \"Neustarten\",\
  13237.      shutdown = \"Herunterfahren\",\
  13238.      chatmanager = \"Chat\",\
  13239.      paint = \"Paint\",\
  13240.      redspace = \"RedSpace\",\
  13241.      floppy = \"Disk\",\
  13242.      credits = \"Credits\"\
  13243.    },\
  13244.    paint = {\
  13245.      open = \"Gebe einen neuen/existierenden Namen ein: \"\
  13246.    },\
  13247.    redspace = {\
  13248.      id = \"Server ID eingeben: \"\
  13249.    }\
  13250.  }\
  13251. }",
  13252.   [ "redcast/files/redspace2" ] = "local args = {...}\
  13253. local side = args[1]\
  13254. local currenturl = \"1830\"\
  13255. local w, h = term.getSize()\
  13256. local menu = 0\
  13257. local message = \"\"\
  13258. \
  13259. if not term.isColor() then\
  13260.  print(\"This software is incompatible with monochrome computers.\")\
  13261.  return\
  13262. end\
  13263. \
  13264. if not side then\
  13265.  print(\"Usage: redspace2 [modem side]\")\
  13266.  return\
  13267. end\
  13268. \
  13269. rednet.open(side)\
  13270. \
  13271. rednet.send(tonumber(currenturl), \"get\")\
  13272. local id3, message3 = rednet.receive(0.5)\
  13273. message = message3\
  13274. \
  13275. --error(\"I reached here!\"..message3)\
  13276. \
  13277. function clearScr()\
  13278.  term.clear()\
  13279.  term.setCursorPos(1,1)\
  13280. end\
  13281. \
  13282. clearScr()\
  13283. \
  13284. function urlBar()\
  13285.  term.setCursorPos(1,1)\
  13286.  paintutils.drawLine(1, 1, w, 1, colours.white)\
  13287.  term.setTextColour(colours.black)\
  13288.  term.setCursorPos(1,1)\
  13289.  print(\"URL: \"..currenturl)\
  13290. end\
  13291. \
  13292. function drawMenu()\
  13293.  term.setCursorPos(1,h)\
  13294.  term.setBackgroundColour(colours.red)\
  13295.  term.setTextColour(colours.black)\
  13296.  term.write(\"          \")\
  13297.  term.setCursorPos(1,h-1)\
  13298.  term.write(\" EnterURL \")\
  13299.  term.setCursorPos(1,h-2)\
  13300.  term.write(\" Refresh  \")\
  13301.  term.setCursorPos(1,h-3)\
  13302.  term.write(\" Exit     \")\
  13303.  term.setCursorPos(1,h-4)\
  13304.  term.write(\"          \")\
  13305. end\
  13306. \
  13307. function drawBrowser()\
  13308.  term.current().setVisible(false)\
  13309.  term.setBackgroundColour(colours.black)\
  13310.  term.setTextColour(colours.white)\
  13311.  clearScr()\
  13312.  urlBar()\
  13313.  term.setBackgroundColour(colours.black)\
  13314.  term.setTextColour(colours.white)\
  13315.  term.setCursorPos(1,2)\
  13316.  if message then\
  13317.    print(message)\
  13318.  else\
  13319.    print(\"There was no reply from the server. Your connecton may have timed out or the server may be offline.\")\
  13320.  end\
  13321.  term.current().setVisible(true)\
  13322. end\
  13323. \
  13324. drawBrowser()\
  13325. \
  13326. while true do\
  13327.  local event, button, x, y = os.pullEvent(\"mouse_click\")\
  13328.  if menu == 0 then\
  13329.    menu = 1\
  13330.    drawBrowser()\
  13331.    --error(\"I reached here!\")\
  13332.    drawMenu()\
  13333.  elseif x >= 1 and x <= 10 and y == h-1 and menu == 1 then\
  13334.    term.setCursorPos(1,1)\
  13335.    term.setBackgroundColour(colours.white)\
  13336.    term.setTextColour(colours.black)\
  13337.    term.clearLine()\
  13338.    currenturl = read()\
  13339.    drawBrowser()\
  13340.    menu = 0\
  13341.    if not tonumber(currenturl) then\
  13342.      currenturl = 1830\
  13343.    end\
  13344.    term.setCursorPos(1,2)\
  13345.    rednet.send(tonumber(currenturl), \"get\")\
  13346.    local id, message4 = rednet.receive(0.5)\
  13347.    term.setBackgroundColour(colours.black)\
  13348.    term.setTextColour(colours.white)\
  13349.    message = message4\
  13350.    clearScr()\
  13351.    drawBrowser()\
  13352.    --print(message)\
  13353.  elseif x >= 1 and x <= 10 and y == h-2 and menu == 1 then\
  13354.    drawBrowser()\
  13355.    menu = 0\
  13356.    if not tonumber(currenturl) then\
  13357.      currenturl = 1830\
  13358.    end\
  13359.    rednet.send(tonumber(currenturl), \"get\")\
  13360.    local id2, message2 = rednet.receive(0.5)\
  13361.    term.setBackgroundColour(colours.black)\
  13362.    term.setTextColour(colours.white)\
  13363.    message = message2\
  13364.    clearScr()\
  13365.    drawBrowser()\
  13366.    --print(message2)\
  13367.  elseif x >= 1 and x <= 10 and y == h-3 and menu == 1 then\
  13368.    term.setBackgroundColour(colours.black)\
  13369.    term.setTextColour(colours.white)\
  13370.    term.clear()\
  13371.    term.setCursorPos(1,1)\
  13372.    return\
  13373.  else\
  13374.    menu = 0\
  13375.    drawBrowser()\
  13376.  end\
  13377. end\
  13378. ",
  13379.   [ "goldrunner/levels/classic_001" ] = "bbbbbbbbbb                  5         bbbbbbbbbb\
  13380. bbbbbbbbbb    4             8         bbbbbbbbbb\
  13381. bbbbbbbbbbbbbbbbbcbbbbbbb   8         bbbbbbbbbb\
  13382. bbbbbbbbbb       cdddddddddd8    4    bbbbbbbbbb\
  13383. bbbbbbbbbb       c    bbc   bbbbbbbcbbbbbbbbbbbb\
  13384. bbbbbbbbbb       c    bbc          c  bbbbbbbbbb\
  13385. bbbbbbbbbb     e c    bbc       4e c  bbbbbbbbbb\
  13386. bbbbbbbbbbbbcbbbbb    bbbbbbbbcbbbbbbbbbbbbbbbbb\
  13387. bbbbbbbbbb  c                 c       bbbbbbbbbb\
  13388. bbbbbbbbbb  c           e     c       bbbbbbbbbb\
  13389. bbbbbbbbbbbbbbbbbbbcbbbbbbbbbbc       bbbbbbbbbb\
  13390. bbbbbbbbbb         c          c       bbbbbbbbbb\
  13391. bbbbbbbbbb       4 cddddddddddc   4   bbbbbbbbbb\
  13392. bbbbbbbbbb    cbbbbbb         bbbbbbbcbbbbbbbbbb\
  13393. bbbbbbbbbb    c         0  4         cbbbbbbbbbb\
  13394. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
  13395. 7777777777777777777777777777777777777777777777777",
  13396.   [ "goldrunner/levels/01_welcome" ] = "                                                 \
  13397.                                             5   \
  13398.                                           bb8bb \
  13399.                                            b8b  \
  13400.                                             8   \
  13401.             4          ddddddddddddddd      8   \
  13402.            bbbbcbbbbbbb                     8   \
  13403.             bbbc                            8   \
  13404.                c                       4  4 8   \
  13405.                c                      bbbbbbb   \
  13406.        bcbbbbbbbb                       bbbbbbb \
  13407.         c               44                  bbbb\
  13408.         c   4          bbbb                  bbb\
  13409.     4bbbbbbbbbbc        bb    4     4         bb\
  13410.     bbbbbbbbbb c             bbbcbbbbb        bb\
  13411. b       bbb     c                c             bb\
  13412. bbb             c 4     4        c       0    bbb\
  13413. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  13414.   [ "CCQT/highscore.txt" ] = "0",
  13415.   [ "minesweeper/startgame" ] = "local displays={}\
  13416. local termOption\
  13417. if term.isColor() then\
  13418.  displays[1]={wrap=nil,side=nil,name=\"Terminal\"}\
  13419.  termOption=true\
  13420. end\
  13421. \
  13422. for _,side in pairs(rs.getSides()) do\
  13423.  if peripheral.getType(side)==\"monitor\" then\
  13424.    local wrap=peripheral.wrap(side)\
  13425.    if wrap.isColor() then\
  13426.      local disp={wrap=wrap,side=side, name=\"Monitor (\"..side..\")\"}\
  13427.      displays[#displays+1]=disp\
  13428.    end\
  13429.  end\
  13430. end\
  13431. \
  13432. function writeCentered(text,line,clearFirst,fg,bg,padChar)\
  13433.  local w=term.getSize()\
  13434.  fg=fg or colors.white\
  13435.  bg=bg or colors.black\
  13436.  local x=math.floor((w-#text)/2)\
  13437.  term.setTextColor(fg)\
  13438.  term.setBackgroundColor(bg)\
  13439.  \
  13440.  if padChar then\
  13441.     text=string.rep(padChar,x)..text\
  13442.     text=text..string.rep(padChar,w-#text)\
  13443.     term.setCursorPos(1,line)\
  13444.  else\
  13445.     term.setCursorPos(x+1,line)\
  13446.     if clearFirst then term.clearLine() end\
  13447.  end\
  13448.  term.write(text)\
  13449.  return x+1\
  13450. end\
  13451. \
  13452. if #displays==0 then\
  13453.  print(\"Minesweep requires an advanced computer or monitor!\")\
  13454.  return\
  13455. end\
  13456. local redirected=false\
  13457. local prevRedir\
  13458. \
  13459. local function exitnow(forced)\
  13460.  if redirected then if term.restore then term.restore() else term.redirect(prevRedir) end end\
  13461.  term.setTextColor(colors.white)\
  13462.  term.setBackgroundColor(colors.black)\
  13463.  local w,h=term.getSize()\
  13464.  term.setCursorPos(1,h)\
  13465.  if forced then\
  13466.    print(\"terminated\")\
  13467.    error()\
  13468.  else\
  13469.    term.scroll(1)\
  13470.    print(\"Thanks for playing!\")\
  13471.  end\
  13472.   \
  13473. end\
  13474. \
  13475. local function doSimpleMenu(title, list)\
  13476.  term.clear()\
  13477.  local selected=1\
  13478.  writeCentered(title,1)\
  13479.  local done=false\
  13480.  buttonPos={}\
  13481.  while not done do\
  13482.    for i=1,#list do\
  13483.      local text=list[i].name\
  13484.      local fg, bg\
  13485.      if i==selected then\
  13486.        fg=colors.black\
  13487.        bg=colors.white\
  13488.        text=\"[\"..text..\"]\"\
  13489.      else\
  13490.        fg=colors.white\
  13491.        bg=colors.black\
  13492.        text=\" \"..text..\" \"\
  13493.      end   \
  13494.      buttonPos[i]=writeCentered(text,4+i,false, fg,bg)+1\
  13495.    end\
  13496.  \
  13497.    while true do\
  13498.      local e={os.pullEventRaw()}\
  13499.      if e[1]==\"terminate\" then\
  13500.        exitnow(true)\
  13501.      elseif e[1]==\"key\" then\
  13502.        if e[2]==keys.up then\
  13503.          selected=selected-1\
  13504.          if selected==0 then selected=#list end\
  13505.          break\
  13506.        elseif e[2]==keys.down then\
  13507.          selected=selected+1\
  13508.          if selected>#list then selected=1 end\
  13509.          break\
  13510.        elseif e[2]==keys.enter then\
  13511.          done=true\
  13512.          break\
  13513.        end\
  13514.      elseif e[1]==\"mouse_click\" or e[1]==\"monitor_touch\" then\
  13515.        if e[4]>4 and e[4]<=4+#list then\
  13516.          local i=e[4]-4\
  13517.          if e[3]>=buttonPos[i] and e[3]<buttonPos[i]+#list[i].name then\
  13518.            selected=i\
  13519.            done=true\
  13520.            break\
  13521.          end\
  13522.        end\
  13523.      end          \
  13524.    end\
  13525.  end\
  13526.  return selected\
  13527. end\
  13528. \
  13529. local activeDisplay=1\
  13530. if #displays>1 then\
  13531.  activeDisplay=doSimpleMenu(\"Select the display to play on:\",displays) \
  13532. end\
  13533. \
  13534. if displays[activeDisplay].wrap then\
  13535.  term.setTextColor(colors.white)\
  13536.  term.setBackgroundColor(colors.black)\
  13537.  term.setCursorPos(1,19)\
  13538.  term.scroll(1)\
  13539.  print(\"Playing Minesweep on \"..displays[activeDisplay].side..\" monitor...\")  \
  13540.  prevRedir=term.redirect(displays[activeDisplay].wrap)\
  13541.  redirected=true\
  13542.  term.setTextColor(colors.white)\
  13543.  term.setBackgroundColor(colors.black)\
  13544.  term.clear()\
  13545.  displays[activeDisplay].wrap.setTextScale(.5)\
  13546. end\
  13547. \
  13548. local difLevels={\
  13549.  { name=\"easy\", width=6, height=6,mines=6},\
  13550.  { name=\"medium\", width=15, height=8,mines=15},\
  13551.  { name=\"hard\", width=30,height=17,mines=60},\
  13552. }\
  13553. \
  13554. local w,h=term.getSize()\
  13555. if w<20 then\
  13556.  difLevels[3]=nil\
  13557. end\
  13558. \
  13559. local level=doSimpleMenu(\"difficulty\",difLevels)\
  13560. local level=difLevels[level]\
  13561. \
  13562. local field={}\
  13563. \
  13564. local function forEachValidNeighbor(x,y,func)\
  13565.  for y2=math.max(y-1,1),math.min(y+1,level.height) do\
  13566.    for x2=math.max(x-1,1),math.min(x+1,level.width) do\
  13567.      if x~=x2 or y~=y2 then\
  13568.        func(x2,y2)      \
  13569.      end\
  13570.    end\
  13571.  end\
  13572. end\
  13573. \
  13574. local function genField()\
  13575.  for y=1,level.height do\
  13576.    field[y]={}\
  13577.    for x=1,level.width do\
  13578.      field[y][x]={mine=false,count=0,revealed=false,flag=false}\
  13579.    end\
  13580.  end\
  13581.  \
  13582. \
  13583.  for i=1,level.mines do\
  13584.    local x, y\
  13585.    repeat\
  13586.      x,y=math.random(1,level.width),math.random(level.height)\
  13587.    until field[y][x].mine==false\
  13588.    field[y][x].mine=true\
  13589.    forEachValidNeighbor(x,y,function(x,y) field[y][x].count=field[y][x].count+1 end)\
  13590.  end\
  13591. end\
  13592. \
  13593. local xoff,yoff=math.floor((w-level.width)/2), math.floor((h-level.height+2)/2)\
  13594. \
  13595. local mineColor, mineColorBg=colors.black,colors.red\
  13596. local flagColor=colors.red\
  13597. local unrevealedColorB=colors.lightGray\
  13598. local flagWrong=colors.black\
  13599. local flagWrongBg=colors.red\
  13600. local screenBg=colors.gray\
  13601. local infoBarColor=colors.yellow\
  13602. local infoBarBG=colors.blue\
  13603. local winColor, winColorBG, loseColor, loseColorBG=colors.green,colors.lightGray, colors.red, colors.lightGray\
  13604. \
  13605. if not term.isColor() then\
  13606.  mineColor, mineColorBg=colors.white,colors.black\
  13607.  flagColor=colors.black\
  13608.  unrevealedColorB=colors.white\
  13609.  flagWrong=colors.white\
  13610.  flagWrongBg=colors.black\
  13611.  screenBg=colors.black\
  13612.  infoBarColor=colors.white\
  13613.  infoBarBG=colors.black\
  13614.  winColor, winColorBG, loseColor, loseColorBG=colors.white, colors.black, colors.white, colors.black\
  13615. end\
  13616. \
  13617. local numColors = {\
  13618.  colors.lightBlue,\
  13619.  colors.green,\
  13620.  colors.red,\
  13621.  colors.blue,\
  13622.  colors.magenta,\
  13623.  colors.cyan,\
  13624.  colors.pink,\
  13625.  colors.purple,\
  13626. }\
  13627.  \
  13628. local function getNumColor(n)\
  13629.  if n>0 and term.isColor() then\
  13630.    return numColors[n]\
  13631.  end\
  13632.  return colors.white\
  13633. end\
  13634. \
  13635. local function drawTile(x,y)\
  13636.  term.setCursorPos(xoff+x,yoff+y)\
  13637.  if field[y][x].revealed then\
  13638.    if field[y][x].mine then\
  13639.      if field[y][x].flag then\
  13640.        term.setTextColor(mineColorBg)\
  13641.        term.setBackgroundColor(mineColor)\
  13642.      else\
  13643.        term.setTextColor(mineColor)\
  13644.        term.setBackgroundColor(mineColorBg)\
  13645.      end\
  13646.      term.write(\"X\")\
  13647.    else\
  13648.      local n=field[y][x].count\
  13649.      if field[y][x].flag==true then\
  13650.        term.setBackgroundColor(flagWrongBg)\
  13651.        term.setTextColor(flagWrong)\
  13652.        term.write(\"?\")\
  13653.      else\
  13654.        term.setTextColor(getNumColor(n))\
  13655.        term.setBackgroundColor(colors.black)\
  13656.        if n==0 then\
  13657.          term.write(\" \")\
  13658.        else\
  13659.          term.write(string.char(string.byte(\"0\")+field[y][x].count))\
  13660.        end\
  13661.      end\
  13662.    end\
  13663.  elseif field[y][x].flag==true then\
  13664.    term.setTextColor(flagColor)\
  13665.    term.setBackgroundColor(unrevealedColorB)\
  13666.    term.write(\"?\")\
  13667.  else\
  13668.    term.setTextColor(colors.black)\
  13669.    term.setBackgroundColor(unrevealedColorB)\
  13670.    term.write(\" \")\
  13671.  end\
  13672. end\
  13673. \
  13674. \
  13675. \
  13676. function drawGrid()\
  13677.  for y=1,level.height do\
  13678.    for x=1,level.width do  \
  13679.      drawTile(x,y)\
  13680.    end\
  13681.  end\
  13682. end\
  13683. \
  13684. local clickMode=1\
  13685. local gameover\
  13686. local revealToWin\
  13687. \
  13688. local buttonOffset\
  13689. \
  13690. local function drawButtons()\
  13691.  local text=\"new quit \"\
  13692.  if clickMode==1 then\
  13693.    text=text..\"flag\"\
  13694.  else\
  13695.    text=text..\"show\"\
  13696.  end\
  13697.  \
  13698.  buttonOffset=writeCentered(text,1,true,infoBarColor,infoBarBG)\
  13699. end\
  13700. \
  13701. \
  13702. local function reveal(x,y)\
  13703.  local revealStack={{x,y}}\
  13704.  local visited={}\
  13705.  visited[x+y*level.width]=true\
  13706.  while #revealStack>0 do\
  13707.    x,y=unpack(table.remove(revealStack,1))\
  13708.    \
  13709.    if not field[y][x].revealed and not field[y][x].flag then\
  13710.      revealToWin=revealToWin-1\
  13711.      field[y][x].revealed=true\
  13712.      drawTile(x,y)\
  13713.      if field[y][x].count==0 then\
  13714.        forEachValidNeighbor(x,y,\
  13715.          function(x,y) \
  13716.            if not visited[x+y*level.width] and (field[y][x].revealed or field[y][x].flag)==false then\
  13717.              revealStack[#revealStack+1]={x,y} \
  13718.            end\
  13719.          end\
  13720.        )\
  13721.      end\
  13722.    end\
  13723.  end\
  13724. end\
  13725. \
  13726. --declared here, so drawBar can see it\
  13727. local seconds=0\
  13728. local numMinesLeft=0\
  13729. \
  13730. local function drawInfoBar(message,fg,bg)\
  13731.  fg=fg or infoBarColor\
  13732.  bg=bg or infoBarBG\
  13733.  \
  13734.  local text\
  13735.  if message then\
  13736.    text=\"[\"..message..\"]\"\
  13737.  else\
  13738.    text=string.format(\"[ %2d/%2d  %3ds ]\",numMinesLeft,level.mines,seconds)\
  13739.  end\
  13740. \
  13741.  writeCentered(text,2,false,fg,bg,\"-\")\
  13742.    \
  13743. end\
  13744. \
  13745. local function confirm(text)\
  13746.  writeCentered(text,1,true,infoBarColor,infoBarBG)\
  13747.  local x=writeCentered(\"[ yes no ]\",2,true,infoBarColor,infoBarBG,\"-\")+2\
  13748.  local res  \
  13749.  while true do\
  13750.    local e={os.pullEvent()}\
  13751.    if e[1]==\"mouse_click\" or e[1]==\"monitor_touch\" then\
  13752.      if e[4]==2 then\
  13753.        local cx=e[3]-x+1\
  13754.        if cx>0 and cx<4 then\
  13755.          res=true\
  13756.          break\
  13757.        elseif cx>4 and cx<7 then\
  13758.          res=false\
  13759.          break\
  13760.        end\
  13761.      end\
  13762.    end\
  13763.  end\
  13764.  drawButtons()\
  13765.  drawInfoBar()\
  13766.  return res\
  13767. end\
  13768. \
  13769. --length of a real second, in units of os.time()\
  13770. local timeSecond=1/50\
  13771. \
  13772. function runGame()\
  13773.  while true do\
  13774.    term.setTextColor(colors.white)\
  13775.    term.setBackgroundColor(screenBg)  \
  13776.    term.clear()\
  13777.    drawInfoBar()\
  13778. \
  13779.    genField()\
  13780.    drawGrid()\
  13781.    revealToWin=level.width*level.height-level.mines\
  13782.    numMinesLeft=level.mines\
  13783. \
  13784.    drawButtons()\
  13785. \
  13786.    gameover=nil\
  13787.    local startTime=nil\
  13788.    local alarmTime=nil\
  13789.    local secondAlarm=nil\
  13790.    seconds=0\
  13791. \
  13792.    while true do\
  13793.      local e={os.pullEventRaw()}\
  13794.      if e[1]==\"terminate\" then\
  13795.        exitnow(true)\
  13796.      elseif e[1]==\"alarm\" and e[2]==secondAlarm then\
  13797.        seconds=seconds+1\
  13798.        drawInfoBar()\
  13799.        alarmTime=(alarmTime+timeSecond)%24\
  13800.        secondAlarm=os.setAlarm(alarmTime)\
  13801.      elseif e[1]==\"mouse_click\" or e[1]==\"monitor_touch\" then\
  13802.        local clickModeX=clickMode\
  13803. \
  13804.        if e[1]==\"mouse_click\" and e[2]~=1 then\
  13805.          --use button to determine action\
  13806.          clickModeX=e[2]\
  13807.        end\
  13808. \
  13809.        --determine target tile\
  13810.        local x,y=e[3],e[4]\
  13811.        if x>xoff and x<=xoff+level.width and y>yoff and y<=yoff+level.height then\
  13812.          --clicked field!\
  13813.          x,y=x-xoff,y-yoff\
  13814.          local tile=field[y][x]\
  13815.          if clickModeX==1 then\
  13816.            --reveal, unless flagged?\
  13817.            if tile.revealed then\
  13818.              --count flags around\
  13819.              local count=0\
  13820.              forEachValidNeighbor(x,y,function(x,y) if not field[y][x].revealed and field[y][x].flag then count=count+1 end end)\
  13821.              if count==tile.count then\
  13822.                forEachValidNeighbor(x,y,\
  13823.                  function(x,y) \
  13824.                    if field[y][x].revealed==false and field[y][x].flag==false then \
  13825.                      if field[y][x].mine then \
  13826.                        gameover=\"lose\" \
  13827.                      else \
  13828.                        reveal(x,y)\
  13829.                      end \
  13830.                    drawTile(x,y) \
  13831.                    end \
  13832.                  end)\
  13833.                if gameover then break end\
  13834.              end\
  13835.            elseif tile.flag==false then\
  13836.              if startTime==nil then\
  13837.                startTime=os.time()\
  13838.                alarmTime=startTime+timeSecond\
  13839.                secondAlarm=os.setAlarm(alarmTime)\
  13840.              end\
  13841.              reveal(x,y)\
  13842.              if tile.mine then\
  13843.                gameover=\"lose\"\
  13844.                break\
  13845.              end\
  13846.            end\
  13847.          elseif clickModeX==2 then\
  13848.            --toggle flag\
  13849.            if tile.revealed==false then\
  13850.              if tile.flag then\
  13851.                numMinesLeft=numMinesLeft+1\
  13852.              else\
  13853.                numMinesLeft=numMinesLeft-1\
  13854.              end\
  13855.              drawInfoBar()\
  13856.              tile.flag=not tile.flag\
  13857.              drawTile(x,y)          \
  13858.            else\
  13859.              --flag all tiles if the surrounding unrevealed count equals mine count\
  13860.              local count=0\
  13861.              forEachValidNeighbor(x,y,\
  13862.                function(x,y) \
  13863.                  if not field[y][x].revealed then \
  13864.                    count=count+1 \
  13865.                  end \
  13866.                end)\
  13867.              if count==field[y][x].count then\
  13868.                forEachValidNeighbor(x,y,\
  13869.                  function(x,y)\
  13870.                    if not field[y][x].revealed and not field[y][x].flag then\
  13871.                      field[y][x].flag=true\
  13872.                      numMinesLeft=numMinesLeft-1\
  13873.                      drawTile(x,y)\
  13874.                    end\
  13875.                  end)\
  13876.                drawInfoBar()\
  13877.              end\
  13878.            end          \
  13879.          end\
  13880.        else\
  13881.          --not a tile, check menu\
  13882.          if y==1 then\
  13883.            x=x-buttonOffset+1\
  13884.            if x>0 and x<4 then\
  13885.              --new\
  13886.              if confirm(\"Start new game?\") then\
  13887.                gameover=\"new\"\
  13888.                break\
  13889.              end\
  13890.            elseif x>4 and x<9 then\
  13891.              --quit\
  13892.              if confirm(\"Exit minesweep?\") then\
  13893.                gameover=\"quit\"\
  13894.                break\
  13895.              end\
  13896.            elseif x>9 and x<14 then\
  13897.              clickMode=clickMode==1 and 2 or 1\
  13898.              drawButtons()\
  13899.            end\
  13900.          end\
  13901.        end\
  13902.      else\
  13903.        --any other event\
  13904.      end\
  13905.      if revealToWin==0 then\
  13906.        gameover=\"win\"\
  13907.        break\
  13908.      end\
  13909.    end\
  13910.    term.setTextColor(colors.white)\
  13911.    term.setBackgroundColor(colors.black)\
  13912.    if gameover==\"quit\" then\
  13913.      break\
  13914.    end\
  13915.    if gameover~=\"new\" then\
  13916. \
  13917.      drawInfoBar(\"You \"..gameover..\"!\",gameover==\"win\" and winColor or loseColor, gameover==\"win\" and winColorBG or loseColorBG)\
  13918.      term.setTextColor(colors.white)\
  13919.      for y=1,level.height do\
  13920.        for x=1,level.width do\
  13921.          if field[y][x].mine and not field[y][x].revealed then\
  13922.            field[y][x].revealed=true\
  13923.            drawTile(x,y)\
  13924.          elseif field[y][x].mine==false and field[y][x].flag then\
  13925.            field[y][x].revealed=true\
  13926.            drawTile(x,y)\
  13927.          end\
  13928.        end\
  13929.      end\
  13930. \
  13931.      os.startTimer(5)\
  13932.      while ({os.pullEvent()})[1]==\"alarm\" do\
  13933.        --skip alarm so it doesn't override within a second from the game timer events\
  13934.      end\
  13935. \
  13936.      drawInfoBar()\
  13937. \
  13938.      if not confirm(\"Play Again?\") then\
  13939.        break\
  13940.      end\
  13941.    end  \
  13942.  end\
  13943. end\
  13944. \
  13945. local ok, err=pcall(runGame)\
  13946. \
  13947. term.setTextColor(colors.white)\
  13948. term.setBackgroundColor(colors.black)\
  13949. term.clear()\
  13950. \
  13951. if not ok then\
  13952.  print(err)\
  13953. end\
  13954. \
  13955. exitnow()",
  13956. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement