Guest User

Frames Beta 1.3

a guest
Aug 27th, 2012
517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.31 KB | None | 0 0
  1. -- Frames by Jan
  2. -- You are free to spread it :)
  3. -- You may ONLY edit this program by adding mods to it,
  4. -- using the newMod() function!
  5. -- If you want to mod it in any otherway, or need a hook,
  6. -- or have a suggestion, please go to Jan on the Computercraft forums.
  7. -- ddd
  8. --
  9. -- This program is called Frames because there are multiple
  10. -- 'windows' which you can run at the same time
  11. -- it has nothing to do with Microsoft Windows :) (ugh ugh)
  12.  
  13. -- From 1.1 to 1.2:
  14. -- Made taskbar automaticly choose the right width
  15. -- (More programs; smaller taskbar items)
  16. -- Fixed the 'edit' problem, because 'edit' uses negative x-pos
  17. -- Made a 'preloop' hook, which runs before starting the mainloop.
  18. -- Made the 'shared' variable: should be used for windows-things.
  19. -- Frames only updates screen when something in the GUI had changed
  20. -- There must be at least 0.04 seconds between screen updates.
  21. -- The 0.04 value is changable, and called the frame_limiter.
  22. -- Started with Frames update. Type 'update' to see if there is a new version
  23.  
  24.  
  25. local version = "Frames Beta 1.3"
  26.  
  27.  
  28. -- PART II ESSENTIALS FOR ALL
  29. local p = {}
  30. local q = 1
  31. local focus=1
  32. local rarg
  33. local larg
  34. local lresult
  35. local fw
  36. local files={}
  37. local mods = {}
  38. local shared = {}
  39. shared.updateurl="http://janvanrosmalen.nl/vn/winupdate.txt"
  40. shared.render=true
  41. shared.num=0
  42. shared.limiter=0.04
  43. shared.tasksize=8
  44. shared.maxtasksize=13
  45. shared.livings=1
  46. shared.updates=0
  47. shared.needupdate=true
  48. shared.forceupdate=false
  49. shared.newest = "error"
  50. local isFaked =true
  51. local errr = ""
  52. local currentmod
  53. local hooks = {}
  54. local hooknames = {}
  55.  
  56. function pack(...)
  57.  return arg
  58. end
  59.  
  60.  
  61.  
  62.  
  63.  
  64. --- THE SHELLS
  65.  
  66.  
  67.  
  68.  
  69. -- PART II: TERM VIRTUALISATION
  70.  
  71. function requpdate()
  72. if q==focus then
  73. shared.needupdate=true
  74. end
  75. end
  76.  
  77.  
  78.  
  79. local u ={}
  80. u.os = {}
  81. u.os.version = os.version
  82. os.version = function() return u.os.version().." window "..q end
  83.  
  84. u.term = {}
  85. for a,b in pairs(term) do
  86. u.term[a] = b
  87. end
  88. local realw,realh = term.getSize()
  89.  
  90. local video={}
  91. local pos={}
  92. pos.x=1
  93. pos.y=1
  94. local img=1
  95. local w = 1
  96. local h = 1
  97.  
  98. function fakeIt()
  99. term.clear = function()
  100.  requpdate()
  101.  video[img]={}
  102.  for n=1, h do
  103.   video[img][n]=string.rep(" ", w)
  104.  end
  105. end
  106.  
  107. term.scroll = function(n)
  108.  requpdate()
  109.  local function scrollOne()
  110.   for n=2, h do
  111.    video[img][n-1]=video[img][n]
  112.    video[img][n]=string.rep(" ", w)
  113.   end
  114.  end
  115.  for a=1, n do scrollOne() end
  116. end
  117.  
  118. term.clearLine = function(n)
  119.  requpdate()
  120.  video[img][pos.y]=string.rep(" ", w)
  121. end
  122.  
  123. term.setCursorPos = function(n1, n2)
  124.   requpdate()
  125.   pos.x=n1
  126.   pos.y=n2
  127. end
  128.  
  129. term.getSize = function()
  130. return w,h
  131. end
  132.  
  133. term.getCursorPos = function()
  134.  return pos.x,pos.y
  135. end
  136.  
  137.  
  138. term.write = function(txt)
  139.     requpdate()
  140.     if pos.y < 1 then return end
  141.     if pos.x < 1 then
  142.                     txt=txt:sub(2-pos.x)
  143.                     pos.x=1
  144.                 end
  145.     if type(txt)=="nil" then txt="" end
  146.     if string.len(txt)>w-(pos.x-1) then
  147.       txt=string.sub(txt, 1, (w-(pos.x-1))-2*(w-(pos.x-1)))
  148.     end
  149.       if pos.x==1 then
  150.         t=""
  151.       else
  152.         t=string.sub(video[img][pos.y], 1, pos.x-1)
  153.       end
  154.       if pos.x+string.len(txt)==w then
  155.         a=""
  156.       else
  157.         a=string.sub(video[img][pos.y], pos.x+string.len(txt), -1)
  158.       end
  159.       video[img][pos.y]=t..txt..a
  160.       if pos.x+string.len(txt)>(w) then pos.x=(w) else
  161.       pos.x=pos.x+string.len(txt) end
  162.   end
  163.   isFaked=true
  164. end
  165.  
  166.  
  167. -- PART III FRAMES FUNCTIONS
  168. function getFree(tabl)
  169. local i=1
  170. while tabl[i]~=nil do
  171.  i=i+1
  172. end
  173. return i
  174. end
  175.  
  176.  
  177. function setTitle(txt)
  178. shared.needupdate=true
  179.  p[q].title=txt
  180. end
  181. function setLongTitle(txt)
  182.  p[q].longtitle=txt
  183. end
  184.  
  185. function newWindow(funcy)
  186. shared.needupdate=true
  187. local i = getFree(p)
  188. p[i] = {}
  189. p[i].random = math.random()
  190. p[i].pos={}
  191. p[i].pos.x=1
  192. p[i].pos.y=1
  193. local wt,ht = 51,17
  194. p[i].h = ht
  195. p[i].w = wt
  196. p[i].b=false
  197. p[i].title="Prog "..i
  198. p[i].longtitle="auto"
  199. p[i].hadrun = false
  200. p[i].living = true
  201.  if funcy==nil then
  202.   funcy=files.craftshell
  203.  end
  204. p[i].boot = funcy
  205. video[i]={}
  206.  for n=1, p[i].h do
  207.   video[i][n]=string.rep(" ", p[i].w)
  208. end
  209. p[i].co = coroutine.create(p[i].boot)
  210. os.queueEvent("window_opened",i)
  211. return i
  212. end
  213.  
  214. --HERE IT IS!
  215.  
  216. files.update = function()
  217. setTitle("Frames Update")
  218. print("Your version:      "..version)
  219. if type(http)=="table" then
  220. setTitle("Http:")
  221. local ha = http.get(shared.updateurl)
  222. if type(ha)=="table" then
  223. print("Newest version:    "..ha:readAll())
  224. else
  225. print("Could not reach the update server")
  226. end
  227. else
  228. print("HTTP API is not enabled. Could not check for newest version. Type 'help http' to find out how to enable it.")
  229. end
  230. setTitle("Frames Update")
  231. print(" ")
  232. print("Frames Update doesnt support downloading yet..")
  233. print("You can go to the ComputerCraft forums to download the newest version manually")
  234. print("Press enter to close")
  235. while true do
  236.       local a,b = os.pullEvent()
  237.       if a=="key" and b==28 then
  238.        break
  239.       end
  240.      end
  241.  
  242. end -- end
  243.  
  244.  
  245. files.menustart = function()
  246.  local wi,hi = term.getSize()
  247.  function cprint(te)
  248.   print(string.rep(" ",math.floor((wi-#te)/2))..te)
  249.  end
  250.  setTitle("Start")
  251.  setLongTitle("Menu Start - "..version)
  252.  while true do
  253.   term.clear()
  254.   term.setCursorPos(w-11,h)
  255.   term.write("Made by Jan")
  256.  
  257.   term.setCursorPos(1,1)
  258.   cprint("Welcome to "..version)
  259.   cprint("      ____________")
  260.   cprint("     /     /     /")
  261.   cprint("    /     /     / ")
  262.   cprint("   /_____/_____/  ")
  263.   cprint("  /     /     /   ")
  264.   cprint(" /     /     /    ")
  265.   cprint("/_____/_____/     ")
  266.   print(errr)
  267.   print("Type 'tut' for tutorial, 'help' for commands.")
  268.   print("Type nothing to open new window")
  269.   term.write("> ")
  270.   dothis=read()
  271.   if dothis=="tut" then
  272.    focus = newWindow(function()
  273.    setTitle("Tut")
  274.    setLongTitle("Tutorial")
  275.    print("Welcome to Frames!")
  276.    print("See that bar below? That is the taskbar!")
  277.    print("In Frames, you can run multiple programs at the same time")
  278.    print("Press ENTER to open a new shell window!")
  279.    while true do
  280.    local a,b = os.pullEvent()
  281.     if a=="key" and b==28 then
  282.      print(" ")
  283.      print("Good. Do you see a item in the taskbar below?")
  284.      print("You can go yo that window by pressing the TAB key on your keyboard. Press TAB Now!")
  285.      print("Press ENTER to close this window...")
  286.      newWindow()
  287.      os.queueEvent("hai")
  288.      while true do
  289.       local a,b = os.pullEvent()
  290.       if a=="key" and b==28 then
  291.        break
  292.       end
  293.      end
  294.      break
  295.     end
  296.    end
  297.    end)
  298.   elseif dothis=="" then
  299.    focus=newWindow()
  300.   elseif dothis=="help" then
  301.    focus = newWindow(function()
  302.    setTitle("Help")
  303.    print(version.." by Jan")
  304.    print("Special thanks to Ardera, who made Screen Capture")
  305.    print("Command list:")
  306.    print("(nothing)    Open new window")
  307.    print("tut          Start tutorial")
  308.             print("update       Check for updates")
  309.    print("help         Display this window")
  310.    print("mods         List installed mods")
  311.    print("exit (shell) Close window")
  312.    print("exit (menu)  Shutdown computer")
  313.    print("reboot       Reboot computer")
  314.    print(" ")
  315.    print("Press ENTER to close this window...")
  316.    while true do
  317.     local a,b = os.pullEvent()
  318.     if a=="key" and b==28 then
  319.      break
  320.     end
  321.    end
  322.    end)
  323.    os.queueEvent("hai")
  324.   elseif dothis=="exit" then
  325.    os.shutdown()
  326.   elseif dothis=="reboot" then
  327.    os.reboot()
  328.         elseif dothis=="update" then
  329.          focus = newWindow(files.update)
  330.   elseif dothis=="mods" then
  331.    focus=newWindow(function()
  332.     setTitle("Mods")
  333.     print("The following mods are installed: ")
  334.     for a,b in pairs(mods) do
  335.      print(b.name.." / ".. b.vers)
  336.      print("     by: "..b.dev)
  337.     end
  338.     while true do
  339.      local a,b = os.pullEvent()
  340.      if a=="key" and b==28 then
  341.       break
  342.      end
  343.     end
  344.    end
  345.    )
  346.  
  347.   end
  348.  end
  349. end
  350.  
  351. files.craftshell = function(...)
  352. local parentShell = shell
  353.  
  354. local bExit = false
  355. local sDir = (parentShell and parentShell.dir()) or ""
  356. local sPath = (parentShell and parentShell.path()) or ".:/rom/programs"
  357. local tAliases = (parentShell and parentShell.aliases()) or {}
  358. local tProgramStack = {}
  359.  
  360. local shell = {}
  361. local tEnv = {
  362.     ["shell"] = shell,
  363. }
  364. if q>9 then
  365. setTitle("Shell"..q)
  366. setLongTitle("Shell "..q)
  367. else
  368. setTitle("Shell "..q)
  369. end
  370. -- Install shell API
  371. function shell.run( _sCommand, ... )
  372.  setLongTitle(_sCommand)
  373.  setTitle(_sCommand)
  374.     local sPath = shell.resolveProgram( _sCommand )
  375.     if sPath ~= nil then
  376.         tProgramStack[#tProgramStack + 1] = sPath
  377.         local result = os.run( tEnv, sPath, ... )
  378.       setLongTitle("auto")
  379.  setTitle("Shell "..q)
  380.         tProgramStack[#tProgramStack] = nil
  381.         return result
  382.     else
  383.         print( "No such program" )
  384.         return false
  385.     end
  386. end
  387.  
  388.  
  389. function shell.exit()
  390.     bExit = true
  391. end
  392.  
  393. function shell.dir()
  394.     return sDir
  395. end
  396.  
  397. function shell.setDir( _sDir )
  398.     sDir = _sDir
  399. end
  400.  
  401. function shell.path()
  402.     return sPath
  403. end
  404.  
  405. function shell.setPath( _sPath )
  406.     sPath = _sPath
  407. end
  408.  
  409. function shell.resolve( _sPath )
  410.     local sStartChar = string.sub( _sPath, 1, 1 )
  411.     if sStartChar == "/" or sStartChar == "\\" then
  412.         return fs.combine( "", _sPath )
  413.     else
  414.         return fs.combine( sDir, _sPath )
  415.     end
  416. end
  417.  
  418. function shell.resolveProgram( _sCommand )
  419.     -- Substitute aliases firsts
  420.     if tAliases[ _sCommand ] ~= nil then
  421.         _sCommand = tAliases[ _sCommand ]
  422.     end
  423.  
  424.     -- If the path is a global path, use it directly
  425.     local sStartChar = string.sub( _sCommand, 1, 1 )
  426.     if sStartChar == "/" or sStartChar == "\\" then
  427.         local sPath = fs.combine( "", _sCommand )
  428.         if fs.exists( sPath ) and not fs.isDir( sPath ) then
  429.             return sPath
  430.         end
  431.         return nil
  432.     end
  433.  
  434.     -- Otherwise, look on the path variable
  435.     for sPath in string.gmatch(sPath, "[^:]+") do
  436.         sPath = fs.combine( shell.resolve( sPath ), _sCommand )
  437.         if fs.exists( sPath ) and not fs.isDir( sPath ) then
  438.             return sPath
  439.         end
  440.     end
  441.  
  442.     -- Not found
  443.     return nil
  444. end
  445.  
  446. function shell.programs( _bIncludeHidden )
  447.     local tItems = {}
  448.  
  449.     -- Add programs from the path
  450.     for sPath in string.gmatch(sPath, "[^:]+") do
  451.         sPath = shell.resolve( sPath )
  452.         if fs.isDir( sPath ) then
  453.             local tList = fs.list( sPath )
  454.             for n,sFile in pairs( tList ) do
  455.                 if not fs.isDir( fs.combine( sPath, sFile ) ) and
  456.                    (_bIncludeHidden or string.sub( sFile, 1, 1 ) ~= ".") then
  457.                     tItems[ sFile ] = true
  458.                 end
  459.             end
  460.         end
  461.     end
  462.  
  463.     -- Sort and return
  464.     local tItemList = {}
  465.     for sItem, b in pairs( tItems ) do
  466.         table.insert( tItemList, sItem )
  467.     end
  468.     table.sort( tItemList )
  469.     return tItemList
  470. end
  471.  
  472. function shell.getRunningProgram()
  473.     if #tProgramStack > 0 then
  474.         return tProgramStack[#tProgramStack]
  475.     end
  476.     return nil
  477. end
  478.  
  479. function shell.setAlias( _sCommand, _sProgram )
  480.     tAliases[ _sCommand ] = _sProgram
  481. end
  482.  
  483. function shell.clearAlias( _sCommand )
  484.     tAliases[ _sCommand ] = nil
  485. end
  486.  
  487. function shell.aliases()
  488.     -- Add aliases
  489.     local tCopy = {}
  490.     for sAlias, sCommand in pairs( tAliases ) do
  491.         tCopy[sAlias] = sCommand
  492.     end
  493.     return tCopy
  494. end
  495.  
  496. print( os.version() )
  497.  
  498. -- If this is the toplevel shell, run the startup programs
  499. if parentShell == nil then
  500.     -- Run the startup from the ROM first
  501.     local sRomStartup = shell.resolveProgram( "/rom/startup" )
  502.     if sRomStartup then
  503.         shell.run( sRomStartup )
  504.     end
  505.  
  506.     -- Then run the user created startup, from the disks or the root
  507.     local sUserStartup = shell.resolveProgram( "/startup" )
  508.     for n,sSide in pairs( redstone.getSides() ) do
  509.         if disk.isPresent( sSide ) and disk.hasData( sSide ) then
  510.             local sDiskStartup = shell.resolveProgram( fs.combine(disk.getMountPath( sSide ), "startup") )
  511.             if sDiskStartup then
  512.                 sUserStartup = sDiskStartup
  513.                 break
  514.             end
  515.         end
  516.     end
  517.  
  518.     if sUserStartup then
  519.       local cancelTime=5
  520.       os.startTimer(1)
  521.       while true do
  522.        term.clear()
  523.        term.setCursorPos(1,1)
  524.        print("Press a key to cancel startup ("..cancelTime..")")
  525.        print("> ")
  526.          a,b = os.pullEventRaw()
  527.          if a=="key" then
  528.           term.clear()
  529.           term.setCursorPos(1,1)
  530.        print( os.version() )
  531.           break
  532.          elseif a=="timer" then
  533.           cancelTime=cancelTime-1
  534.           if cancelTime==0 then
  535.            term.clear()
  536.            term.setCursorPos(1,1)
  537.            print( os.version() )
  538.            shell.run( sUserStartup )
  539.            break
  540.           else
  541.            os.startTimer(1)
  542.           end
  543.          end
  544.         end
  545.     end
  546.  return "stopme"
  547. end
  548.  
  549. -- Run any programs passed in as arguments
  550. local tArgs = { ... }
  551. if #tArgs > 0 then
  552.     shell.run( ... )
  553. end
  554.  
  555. -- Read commands and execute them
  556. local tCommandHistory = {}
  557. while not bExit do
  558.     write( shell.dir() .. "> " )
  559.  
  560.     local sLine = read( nil, tCommandHistory )
  561.     table.insert( tCommandHistory, sLine )
  562.  
  563.     local tWords = {}
  564.     for match in string.gmatch(sLine, "[^ \t]+") do
  565.         table.insert( tWords, match )
  566.     end
  567.  
  568.     local sCommand = tWords[1]
  569.     if sCommand then
  570.         shell.run( sCommand, unpack( tWords, 2 ) )
  571.     end
  572. end
  573. end
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581. function newHook(where,hook)
  582.  if hooks[where]==nil then
  583.   hooks[where]={}
  584.   hooknames[where]={}
  585.  end
  586.  local i = getFree(hooks[where])
  587.  hooks[where][i]=hook
  588.  hooknames[where][i]=currentmod
  589. end
  590. function newMod(name,vers,dev,func)
  591.  local i=getFree(mods)
  592.  mods[i]={}
  593.  mods[i].name=name
  594.  mods[i].vers=vers
  595.  mods[i].dev=dev
  596.  mods[i].func=func
  597.  currentmod=name
  598.  mods[i].func()
  599. end
  600.  
  601. function checkHooks(name)
  602.  fw=true
  603.  for a,b in ipairs(hooks[name]) do
  604.   b()
  605.  end
  606.  return fw
  607. end
  608.  
  609.  
  610.  
  611. -- PART IV THE MODDING PART. INSERT MODS HERE
  612.  
  613. -- PART IV A: THE SuperPreProcessor: Executes for each os.pullEventRaw()
  614.  
  615. -- HERE IS A TEMPLATE. USE IT TO MAKE YOUR OWN PREPROCESSORS
  616.  
  617.  
  618. -- PART IV B: THE EventPreProcessor: Executes for each time a window gets updated.
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626. -- PART V THE SETUP
  627.  
  628.  
  629.  
  630.  
  631. -- PART VI THE LOOP
  632.  
  633. function mainloop()
  634. while true do
  635.  rarg = pack(os.pullEventRaw())
  636.  if checkHooks("spp") then
  637.   for x in pairs(p) do
  638.    q=x
  639.    if p[q].living then
  640.     larg=rarg
  641.     if checkHooks("cpp") then
  642.      lresult=pack(coroutine.resume(p[q].co,unpack(larg)))
  643.     end
  644.     checkHooks("cap")
  645.    end
  646.   end
  647.  end
  648.  checkHooks("sap")
  649. end
  650. end
  651.  
  652. function startwin()
  653. fakeIt()
  654. checkHooks("preloop")
  655. os.queueEvent("frames_just_started")
  656. mainloop()
  657. end
  658.  
  659.  
  660.  
  661. -- Here come all the Mods.
  662.  
  663. newMod("Frames Focus Manager","v1","Jan", function()
  664.  
  665. newHook("spp",function()
  666.  if rarg[1]=="key" and rarg[2]==15 then
  667.         shared.needupdate=true
  668.   if focus==#p then
  669.    focus=1
  670.   else
  671.    focus=focus+1
  672.    while true do
  673.    if p[focus]==nil then
  674.      focus=1
  675.     else
  676.      if p[focus].living then
  677.       break
  678.      else
  679.       focus=focus+1
  680.      end
  681.     end
  682.    end
  683.   end
  684.   -- Hehe
  685.  end
  686. end)
  687.  
  688. newHook("cpp",function()
  689.  if (rarg[1]=="key" or rarg[1]=="char") and focus~=q then
  690.   fw=false
  691.  end
  692. end)
  693.  
  694. end)
  695.  
  696. newMod("Term Virtualisation Helper","v1","Jan",function()
  697.  
  698. newHook("cpp",function()
  699.  img=q
  700.  w=p[q].w
  701.  h=p[q].h
  702.  pos.x=p[q].pos.x
  703.  pos.y=p[q].pos.y
  704. end)
  705.  
  706. newHook("cap",function()
  707.  p[q].w=w
  708.  p[q].h=h
  709.  p[q].pos.x=pos.x
  710.  p[q].pos.y=pos.y
  711. end)
  712.  
  713. end)
  714.  
  715. newMod("Process Starter and Stopper","v1","Jan",function()
  716.  
  717. newHook("cpp",function()
  718. if fw then
  719.  if p[q].hadrun==false then
  720.   larg={}
  721.   p[q].hadrun=true
  722.         shared.needupdate=true
  723.  end
  724. end
  725. end)
  726.  
  727. newHook("cap",function()
  728.  
  729.  if lresult[1]==false then
  730.   if type(lresult[2])=="string" then
  731.    errr=lresult[2]
  732.         end
  733.  end
  734.  
  735. end)
  736.  
  737.  
  738. newHook("cap",function()
  739.  
  740.  if coroutine.status(p[q].co)=="dead" then
  741.   if focus==q then
  742.          shared.needupdate=true
  743.    focus=1
  744.   end
  745.   p[q].co=nil
  746.   p[q].living=false
  747.  end
  748.  
  749. end)
  750.  
  751. end)
  752.  
  753. newMod("Rendering","v1","Jan",function()
  754.  
  755.  
  756. newHook("spp",function()
  757. if rarg[1]=="timer" then
  758.  if rarg[2]==shared.num then
  759.    shared.render=true
  760.  end
  761. end
  762.  
  763. end)
  764.  
  765. newHook("sap",function()
  766.  if isFaked and shared.render and (shared.forceupdate or shared.needupdate) then
  767.      shared.needupdate=false
  768.      shared.livings=0
  769.         for a,b in ipairs(p) do
  770.          if b.living then
  771.              shared.livings=shared.livings+1
  772.             end
  773.         end
  774.         shared.tasksize = shared.maxtasksize
  775.   repeat
  776.         shared.tasksize=shared.tasksize-1
  777.         until ((shared.livings-1)*shared.tasksize)+2<realw
  778.  
  779.  
  780.   shared.num=os.startTimer(shared.limiter)
  781.   shared.render=false
  782.   u.term.clear()
  783.   u.term.setCursorBlink(true)
  784.   for n=1, #video[focus] do
  785.    u.term.setCursorPos(1, n)
  786.    u.term.write(video[focus][n])
  787.   end
  788.   u.term.setCursorPos(1,18)
  789.   u.term.write("_"..string.rep("_",realw-1))
  790.   u.term.setCursorPos(1,19)
  791.   u.term.write("|")
  792.   local ofs=0
  793.   for a,b in ipairs(p) do
  794.    if a==1 then
  795.     if a==focus then
  796.      u.term.setCursorPos(1,18)
  797.      u.term.write("+-+")
  798.     end
  799.     u.term.setCursorPos(1,19)
  800.     u.term.write("|#|")
  801.                 shared.updates=shared.updates+1
  802.    else
  803.     if b.living then
  804.      if a==focus then
  805.       u.term.setCursorPos((ofs*shared.tasksize)+3,18)
  806.       u.term.write("+"..string.rep("-",shared.tasksize-1).."+")
  807.      end
  808.      u.term.setCursorPos((ofs*shared.tasksize)+4,19)
  809.      u.term.write(b.title:sub(1,(shared.tasksize-1)))
  810.      u.term.setCursorPos(((ofs+1)*shared.tasksize)+3,19)
  811.      u.term.write("|")
  812.      ofs=ofs+1
  813.     end
  814.    end
  815.   end
  816.   u.term.setCursorPos(p[focus].pos.x,p[focus].pos.y)
  817.  end
  818. end)
  819.  
  820. end)
  821.  
  822. newMod("Startloader","v1","Jan",function()
  823.  
  824. newHook("preloop",function()
  825. newWindow(files.menustart)
  826. --hook end
  827. end)
  828. -- modend
  829. end)
  830.  
  831.  
  832.  
  833.  
  834.  
  835. -- Your own mods here please:
  836.  
  837.  
  838. -- Shell thingy's
  839.  
  840. -- THE CRAFTOS SHELL
  841.  
  842.  
  843.  
  844. -- end of mod installation, now starting:
  845.  
  846.  
  847. startwin()
Advertisement
Add Comment
Please, Sign In to add comment