GraySloth

ComputerCraft: MiscPeripherals: 'Thaum' getAspects command

Feb 15th, 2013
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.23 KB | None | 0 0
  1. --v2.0 by GraySloth 2013-Apr-30 For the miscperipherals mod with the Thaum Scanner Upgrade, based off of Direwolf20 video.
  2. --New aspect reference guide just type thaum list
  3. --works well with this program http://pastebin.com/yigYBdad to startup on a monitor just edit the clock argument to thaum
  4. local tArgs = {...};
  5. local aspectNumbers = {};
  6. local box = nil;
  7. local song = nil;
  8. local action = 'mainList';
  9. local maxtoshow = 12;
  10. local startat = 1;
  11. local sPath = shell.resolve( "aspectFile" )
  12. local tLines = {}
  13.  
  14. function clear()
  15.   term.clear()
  16.   term.setCursorPos(1,1)
  17. end
  18.  
  19.  
  20.  
  21. if  tArgs[1] == nil then
  22.         local tSide = nil
  23.         for n,sthaumScannerSide in ipairs(rs.getSides()) do
  24.             if peripheral.isPresent(sthaumScannerSide) and peripheral.getType(sthaumScannerSide) == "thaumScanner" then            
  25.                 tSide = sthaumScannerSide
  26.                 break
  27.             end
  28.         end
  29.  
  30.        
  31.         if not tSide then
  32.             print( "No thaumScanner attached" )
  33.             return
  34.         end
  35.  
  36.  
  37.    thaumScanner = peripheral.wrap("right")
  38.  
  39.    while true do
  40.       clear()
  41.       for i, j in pairs(thaumScanner.getAspects()) do
  42.          print(i..":"..j)
  43.       end
  44.       os.sleep(1)
  45. end
  46.  
  47. elseif tArgs[1] == "list" or "print" or "printall" then
  48. local function load(_sPath)
  49.     tLines = {}
  50.     if fs.exists( _sPath ) then
  51.         local file = io.open( _sPath, "r" )
  52.         local sLine = file:read()
  53.         while sLine do
  54.             table.insert( tLines, sLine )
  55.             sLine = file:read()
  56.         end
  57.         file:close()
  58.     end
  59.    
  60.     if #tLines == 0 then
  61.         table.insert( tLines, "" )
  62.     end
  63. end
  64.  
  65. local aspectNumbers = {"Aer","Alienis","Animus","Aqua","Aura","Bestia","Bestiola","Carus","Cognitio","Corpus","Fabrico","Flos","Fractus","Fungus","Gelum","Herba","Ignis","Imperito","Instrumentum","Lignum","Lux","Machina","Malum","Messis","Metallum","Mortuus","Motus","Mutatio","Obscurus","Pannus","Permutatio","Potentia","Praecantatio","Purus","Sano","Saxum","Solum","Sonus","Telum","Tempus","Tenebris","Tutamen","Vacuos","Venenum","Victus","Vinculum","Visum","Vitreus","Volito"}
  66.  
  67. local aspectData =
  68. {[[
  69. Aer
  70. Weather, Mist, Climate
  71.  
  72.     Wispy Essence x 4
  73. ]]
  74. ,[[
  75. Alienis
  76. Eldritch, The End, Strange, Alien
  77.  
  78.     REther Pearl x 3
  79.     Beacon x 6
  80.     Ender Pearl x 4
  81.     Eye of Ender x 3
  82.     Music Disk (far) x 4
  83.     Nether Star x 8
  84.     Obsidian Totem x 2
  85.     Twilight Forest Scepters
  86. ]]
  87.  
  88. ,[[
  89. Animus
  90. Soul, Spirit
  91.  
  92.     Creeper Head x 4
  93.     Ghast Tear x 4
  94.     Skeleton Skull x 4
  95.     Soul Sand x 1
  96.     Wispy Essence x 1
  97.     Wither Skeleton Skull x 4
  98.     Zombie Head x 4
  99. ]]
  100.  
  101. ,[[
  102. Aqua
  103. Water, Fluid
  104.  
  105.     Awkward Potion x 1*
  106.     Boat x 4
  107.     Brewing Stand x 2
  108.     Cactus x 1
  109.     Cake x 8
  110.     Clay (ball) x 1
  111.     Empty Map x 13
  112.     Ghast Tear x 4
  113.     Lily Pad x 1
  114.     Mundane Potion x 1
  115.     Music Disk (13) x 4
  116.     Paper x 2
  117.     Pumpkin Pie x 2
  118.     Raw Fish x 1
  119.     Reeds x 2
  120.     Slime Ball x 2
  121.     Sugar x 2
  122.     Thick Potion x 1
  123.     Water Bottle x 1*
  124.     Water Bucket x 4
  125.     Water Shard x 2
  126. ]]
  127.  
  128. ,[[
  129. Aura
  130. Air, Wind, Breath
  131.  
  132.     Air Shard x 2
  133.     Dead Bush x 1
  134.     Feather x 2
  135.     Grass x 1
  136.     Aluminium x 2
  137.     Raven's Feathers x 2
  138. ]]
  139.  
  140. ,[[
  141. Bestia
  142. Animal, Beast
  143.  
  144.    Bed x 2
  145.    Leather x 2
  146.    Music Disk (cat) x 4
  147.    Naga Scale x 16
  148.    Raw Porkchop x 1
  149.    Wool (any) x 1
  150.    Feather x 2
  151. ]]
  152.  
  153. ,[[
  154. Bestiola
  155. Spider, Web, Insects
  156.  
  157.    Bow x 2
  158.    Enchanted Book (Bane of Arthropods) x 4
  159.    Firefly x 4
  160.    Moonworm Queen x 12
  161.    Spider Eye x 2
  162.    String x 1
  163.    Royal Jelly x 2
  164.    Bee (Drone or Princess) x 1 (Queen) x 2
  165. ]]
  166.  
  167. ,[[
  168. Carus
  169. Expensive, Precious, Valuable
  170.  
  171.    Diamond x 4
  172.    Emerald x 2
  173.    Enchantment Table x 6
  174.    Gold x 4
  175.    Lapis Lazuli x 1
  176.    Music Disk (any) x 4
  177.    Smooth Sandstone x 1
  178.    Chiseled Stone Brick x 1
  179. ]]
  180.  
  181. ,[[
  182. Cognitio
  183. Learning, Knowledge, Inquiry
  184.  
  185.    Book x 5
  186.    Bookshelf x 12
  187.    Knowledge Fragment x 16*
  188.    Paper x 2
  189.    Zombie Brain x 4
  190.    Research Notes ( Theory of Everything and Tiny Hats... perhaps others? (id 0)) x 115
  191. ]]
  192.  
  193. ,[[
  194. Corpus
  195. Body, Flesh, Physique
  196.  
  197.    Black Wool x 1
  198.    Bone Meal x 1
  199.    Bones x 2
  200.    Cake x 3
  201.    Cooked Chicken x 4
  202.    Cooked Porkchop x 4
  203.    Egg x 2
  204.    Ink x 1
  205.    Raw Beef x 4
  206.    Raw Chicken x 4
  207.    Raw Porkchop x 4
  208.    Rotten Flesh x 4
  209.    Steak x 4
  210.    Zombie Brain x 2
  211.    Meat Nugget (any, from cooking meat in the Infernal Furnace) x 1*
  212.    Player when standing on a Crucible (~ x 1 per 20 sec)*
  213. ]]
  214.  
  215. ,[[
  216. Fabrico
  217. Create, Construct, Work
  218.  
  219.    Anvil x 2
  220.    Crafting Table x 1
  221.    Music Disc (blocks) x 4
  222.    Slightly Damaged Anvil x 1
  223.    Steel Ingot x 1
  224.    Very Damaged Anvil x 1
  225. ]]
  226.  
  227. ,[[
  228. Flos
  229. Flower, Bloom, Blossom
  230.  
  231.    Dandelion Yellow x 2
  232.    Flowers x 4
  233.    Magenta Dye x 1
  234.    Magenta Wool x 1
  235.    Orange Dye x 2
  236.    Orange Wool x 2
  237.    Pink Dye x 1
  238.    Pink Wool x 1
  239.    Purple Dye x 1
  240.    Purple Wool x 1
  241.    Red Wool x 2
  242.    Rose Red x 2
  243.    Yellow Wool x 2
  244.    Cowbar x 3
  245. ]]
  246.  
  247. ,[[
  248. Fractus
  249. Destruction, Fragmented, Shattered
  250.  
  251.    Cobblestone x 1
  252.    Gunpowder x 4
  253.    Red Xychorium x 2
  254.    TNT x 16
  255. ]]
  256.  
  257. ,[[
  258. Fungus
  259. Mushroom, Toadstool, Fungi
  260.  
  261.    Brown Mushroom x 4*
  262.    Mushroom Stew x 3
  263.    Mushroom (Block) x 4
  264.    Mycelium x 1
  265.    Nether Wart x 1
  266.    Red Mushroom x 4*
  267. ]]
  268.  
  269. ,[[
  270. Gelum
  271. Cold, Ice, Frost
  272.  
  273.    Ice x 3*
  274.    Snow x 3*
  275.    Snowball x 1*
  276.    Water Shard x 2
  277. ]]
  278.  
  279. ,[[
  280. Herba
  281. Herb, Plant, Grass
  282.  
  283.    Cactus x 4
  284.    Dead Bush x 1
  285.    Saplings x 4
  286.    Seeds x 1
  287.    Cocoa Beans x 1
  288.    Leaves x 2*
  289.    Moss Stone x 1
  290. ]]
  291.  
  292. ,[[
  293. Ignis
  294. Fire, Heat, Burn
  295.  
  296.    Blaze Rod x 6
  297.    Brick x 1
  298.    Charcoal x 2
  299.    Coal x 2
  300.    Enchantment Table x 6
  301.    Fire Shard x 2
  302.    Flint and Steel x 4
  303.    Furnace x 2
  304.    Gunpowder x 4
  305.    Music Disc (11) x 4
  306.    Nether Wart x 1
  307.    Netherrack x 1
  308.    Rose x 1
  309. ]]
  310.  
  311. ,[[
  312. Imperito
  313. Control, Command, Dominate
  314.  
  315.    Blue Xychorium x 2
  316.    Bronze Ingot x 1
  317.    Lever x 1
  318.    Music Disc (strad) x 4
  319.    Rubber (IC2) x 2
  320.    Saddle x 4
  321.    Slime Ball x 2
  322.    Tin Ore x 1
  323. ]]
  324.  
  325. ,[[
  326. Instrumentum
  327. Instrument, Tool, Implement
  328.  
  329.    Anvil x 2
  330.    Axe x (depends on material)
  331.    Flint x 1
  332.    Hoe x (depends on material)
  333.    Pickaxe x (depends on material)
  334.    Shears x 4
  335.    Shovel x (depends on material)
  336.    Slightly Damaged Anvil x 2
  337.    Very Damaged Anvil x 1
  338. ]]
  339.  
  340. ,[[
  341. Lignum
  342. Wood, Forest, Tree
  343.  
  344.    Bed x 3
  345.    Charcoal x 2
  346.    Chest x 3
  347.    Crafting Table x 3
  348.    Jukebox x 3
  349.    Lever x 1
  350.    Log (any type) x 8*
  351.    Piston x 3
  352.    Redstone Repeater x 2
  353.    Saplings x 2
  354.    Sign x 1
  355.    Stick x 1*
  356.    Sticky Piston x 3
  357.    Tripwire Hook x 1
  358.    Note Block x 3
  359.    Wooden Bowl x 1
  360.    Wooden Button x 1
  361.    Wooden Door x 3
  362.    Wooden Fence x 1
  363.    Wooden Fence Gate x 5
  364.    Wooden Planks (any type) x 2*
  365.    Wooden Pressure Plate x 3
  366.    Wooden Slab (any type) x 1*
  367.    Wooden Stairs (any type) x 2*
  368.    Wooden Tools x (depends on tool)
  369. ]]
  370.  
  371. ,[[
  372. Lux
  373. Light, Brightness, Day
  374.  
  375.    Flower (Yellow) x 1
  376.    Glowstone x 10
  377.    Glowstone Dust x 3
  378.    Jack o Lantern x 1
  379.    Light Xychorium x 2
  380.    Redstone Lamp x 8
  381.    Torch x 1*
  382. ]]
  383.  
  384. ,[[
  385. Machina
  386. Mechanism, Machine, Device
  387.  
  388.    Button (any) x 1
  389.    Fence Gate x 1
  390.    Nicolite (RedPower 2) x 2
  391.    Redstone x 2
  392.    Redstone Repeater x 8
  393.    Redstone Torch x 4
  394.    Pressure Plate (any) x 1
  395. ]]
  396.  
  397. ,[[
  398. Malum
  399. Evil, The Nether, Malice
  400.  
  401.    Creeper Head x 4
  402.    Ghast Tear x 4
  403.    Music Disc (stal) x 4
  404.    Skeleton Skull x 4
  405.    Wither Skeleton Skull x 4
  406.    Zombie Brain x 2
  407.    Zombie Head x 4
  408. ]]
  409.  
  410. ,[[
  411. Messis
  412. Crops, Harvest
  413.  
  414.    Apple x 2
  415.    Cake x 8
  416.    Carrot x 2
  417.    Golden Apple x 2
  418.    Potato x 2
  419.    Sugar Canes x 2
  420.    Pumpkin x 8*
  421.    Wheat x 2
  422. ]]
  423.  
  424. ,[[
  425. Metallum
  426. Metal, Mine, Ore
  427.  
  428.    Anvil x 26
  429.    Cinnabar Ore x 3
  430.    Copper/Tin/Silver/Bronze/Lead Dust x 5
  431.    Copper/Tin/Silver/Bronze/Lead Ingot x 6
  432.    Copper/Tin/Silver Ore x 5
  433.    Iron Ingot x 8*
  434.    Gold Ingot x 8
  435.    Iron/Gold Dust x 7
  436.    Iron/Gold Ore x 6
  437.    Nugget (any) x 1*
  438.    Quicksilver x 4
  439.    Refined Uranium x 6
  440.    Slightly Damaged Anvil x 6
  441.    Shears x 13
  442.    Very Damaged Anvil x 26
  443. ]]
  444.  
  445. ,[[
  446. Mortuus
  447. Death, Decay, Undead
  448.  
  449.    Bone Meal x 2
  450.    Bones x 6
  451.    Ghast Tear x 4
  452.    Gray Dye x 1
  453.    Light Blue Dye x 1
  454.    Light Gray Wool x 1
  455.    Lime Dye x 1
  456.    Potion of Harming (I) x3
  457.    Potion of Harming (II) x6
  458.    Rotten Flesh x 4
  459.    Wither Skeleton Skull x 8
  460.    Zombie Brain x 2
  461. ]]
  462.  
  463. ,[[
  464. Motus
  465. Motion, Movement, Speed
  466.  
  467.    Air Shard x 2
  468.    Boat x 4
  469.    Doors x 1
  470.    Minecart x 4
  471.    Music Disc (mellohi) x 4
  472.    Piston x 4
  473.    Potion of Speed (I) x 3
  474.    Potion of Speed (II) x 6
  475.    Quicksilver x1
  476.    Rubber (IC2) x 2
  477.    Rubberwood x1
  478.    Trapdoor x 1
  479.    Naga Stone x 4
  480.    Naga Headstone x 4
  481. ]]
  482.  
  483. ,[[
  484. Mutatio
  485. Flux, Chaos
  486.  
  487.    Magma Cream x 2
  488.    Mossy Cobblestone x 1
  489.    Nether Wart x 1
  490.    Slimeball x 2
  491.    Wispy Essence x 1 or (only violet ones) x 5
  492. ]]
  493.  
  494. ,[[
  495. Obscurus
  496. Unknown, Obscured
  497.  
  498. (Not an Aspect: This symbol appears only while researching. It indicates that an Aspect has been detected, but further research is needed to identify it.)
  499. ]]
  500.  
  501. ,[[
  502. Aspect Pannus   Pannus
  503. Cloth, Fabric, Garment, Thread
  504.  
  505.    Bed x 17
  506.    Bow x 5
  507.    Leather x 1
  508.    Non-white Wool x 6
  509.    String x 2
  510.    White Wool x 7
  511. ]]
  512.  
  513. ,[[
  514. Permutatio
  515. Exchange, Change, Barter
  516.  
  517.    Copper Ore x 1
  518.    Egg x 4
  519.    Emerald x 4
  520.    Flax Seeds x 1
  521.    Melon Seeds x 1
  522.    Music Disc (mall) x 4
  523.    Pumpkin Seeds x 1
  524.    Seeds x 1
  525.    Silver Ore x 1
  526.    Honey Drop x 2
  527. ]]
  528.  
  529. ,[[
  530. Potentia
  531. Power, Energy, Strength
  532.  
  533.    Charcoal x 2
  534.    Coal x 2
  535.    Cocoa Beans x 1
  536.    Nicolite (RedPower 2) x 2
  537.    Quartz Crystal x 1
  538.    Redstone x 2
  539.    Redstone Repeater x 5
  540.    Refined Uranium x 6
  541.    Apatite x 2
  542. ]]
  543.  
  544. ,[[
  545. Praecantatio
  546. Magic, Sorcery
  547.  
  548.    Air / Earth / Fire / Water / Dull Shard x 2
  549.    Any Enchanted Item (Depends On Level) x 2-8(?)
  550.    Any Potion (I) x 2
  551.    Any Potion (II) x 4
  552.    Arcane Stone Block x 2
  553.    Arcane Wood Block x 1
  554.    Arcane Worktable x 2
  555.    Beacon x 8
  556.    Blaze Rod x 2
  557.    Chiseled Sandstone x 1
  558.    Emerald x 4
  559.    Enchantment Table x 8
  560.    Ender Pearl x 4
  561.    Glass Vial x 1
  562.    Golden Carrot x 2
  563.    Great Wood x 1
  564.    Music Disc (ward) x 4
  565.    Nether Star x 8
  566.    Silverwood Log x 2
  567.    Vis Shard x 6
  568.    Magic Wax x2
  569. ]]
  570.  
  571. ,[[
  572. Purus
  573. Pure, Clean, Stainless
  574.  
  575.    Beacon x 6
  576.    Diamond x 4
  577.    Nether Star x 8
  578.    Silverwood Leaves x 1
  579.    Silverwood Log x 2
  580.    Refined Iron x 1
  581. ]]
  582.  
  583. ,[[
  584. Sano
  585. Heal, Repair
  586.  
  587.    Cake x 8
  588.    Golden Apple (Block) x 8
  589.    Golden Apple (Nugget) x 4
  590.    Milk Bucket x 2
  591.    Potion of Health (I) x 3
  592.    Potion of Health (II) x 6
  593.    Potion of Regeneration (I) x 3
  594.    Potion of Regeneration (II) x 6
  595. ]]
  596.  
  597. ,[[
  598. Saxum
  599. Stone, Rock
  600.  
  601.    Beacon x 12
  602.    Cobblestone x 1
  603.    Enchanting Table x 16
  604.    End Stone x 1
  605.    Gravel x 1
  606.    Nether Brick x 2
  607.    Netherrack x 1
  608.    Obsidian x 5
  609.    Redstone Repeater x 5
  610.    Silver Ore x 2
  611.    Stone x 2*
  612. ]]
  613.  
  614. ,[[
  615. Solum
  616. Earth, Soil, Ground, Foundation
  617.  
  618.    Brick x 2
  619.    Bricks (Block) x 6
  620.    Clay (ball) x2
  621.    Dirt x 2*
  622.    End Stone x 1
  623.    Gravel x 1
  624.    Music Disc (chirp) x 4
  625.    Mycelium x 2
  626.    Netherrack x 1
  627.    Sand x 2*
  628.    Soul Sand x 1
  629. ]]
  630.  
  631. ,[[
  632. Sonus
  633. Sound, Noise, Din
  634.  
  635.    Cicada x 4 (Twilight Forest)
  636.    Jukebox x 8
  637.    Music Disc (any) x 12
  638.    Noteblock x 4
  639. ]]
  640.  
  641. ,[[
  642. Telum
  643. Arrow, Sword, Weapon
  644.  
  645.    Arrow x 1*
  646.    Bow x 6
  647.    Cactus x 1
  648.    Potion of Strength (I) x 3
  649.    Potion of Strength (II) x 6
  650.    Sword (depends on material) x 4-10
  651. ]]
  652.  
  653. ,[[
  654. Tempus
  655. Time, Moment, Season
  656.  
  657.    Clock x 4
  658.    Redstone Repeater x 1
  659.    Written Book x 1
  660. ]]
  661.  
  662. ,[[
  663. Tenebris
  664. Dark, Night, Blindness
  665.  
  666.    Black Wool x 1
  667.    Dark Xychorium x 2
  668.    End Stone x 1
  669.    Ink Sac x 1
  670.    Obsidian x 1
  671.    Obsidian Totem x 2
  672.    Obsidian Tile x 1
  673. ]]
  674.  
  675. ,[[
  676. Tutamen
  677. Defense, Protection, Security
  678.  
  679.    Armor x (depends on material) 3-9
  680.    Enchanted Book of (any) Protection (depends On Level) x 2-6
  681.    Leather x 1
  682.    Potion of Fire Resistance x 1
  683.    Mazestone x 1
  684. ]]
  685.  
  686. ,[[
  687. Vacuos
  688. Empty, Void, Insubstantial
  689.  
  690.    Bowl x 1
  691.    Bucket x 1
  692.    Chest x 4
  693.    Flower Pot x 1
  694.    Glass Phial / Bottle x 1
  695.    Lead Ingot x 2
  696. ]]
  697.  
  698. ,[[
  699. Venenum
  700. Poison, Drug, Impure
  701.  
  702.    Poisonous Potato x 2
  703.    Potion of Poison (I) x 3
  704.    Potion of Poison (II) x 6
  705.    Quicksilver x 1
  706.    Refined Uranium x 4
  707.    Spider Eye x 1
  708. ]]
  709.  
  710. ,[[
  711. Victus
  712. Life Force, Food, Sustenance
  713.  
  714.    Apple x 2
  715.    Bread x 5
  716.    Cake x 10
  717.    Copper Dust / Ingot x 2
  718.    Green Xychorium x 2
  719.    Melon Slice x 1*
  720.    Porkchop x 4
  721.    Steak x 4
  722.    Sulfur x 2
  723.    Wheat x 2
  724. ]]
  725.  
  726. ,[[
  727. Vinculum
  728. Bind, Imprison, Trap
  729.  
  730.    Amber x 4
  731.    Cobweb x 2
  732.    Potion of Slowness x 3
  733.    Soul Sand x 1
  734.    String x 1
  735. ]]
  736.  
  737. ,[[
  738. Visum
  739. Sight, Vision, Appearance
  740.  
  741.    Carrot x 2
  742.    Cinnabar Ore x 3
  743.    Glowstone Dust x 1
  744.    Potion of Night Vision x 3
  745.    Quicksilver x 4
  746.    Spider Eye x 2
  747. ]]
  748.  
  749. ,[[
  750. Vitreus
  751. Glass, Crystal, Gem, Transparent
  752.  
  753.    Beacon x 8
  754.    Diamond x 12
  755.    Emerald x 10
  756.    Enchanting Table x 19
  757.    Ender Pearl x 4
  758.    Glass x 2*
  759.    Glass Bottle x 2
  760.    Glass Pane x 1*
  761.    Glass Phial x 1
  762.    Ice x 1
  763.    Quartz Crystal x 4
  764.    Xychorium (all) x 2
  765. ]]
  766.  
  767. ,[[
  768. Volito
  769. Flight, Leap
  770.  
  771.    Feather x 2
  772.    Bees (Forestry) x 2
  773.    Bow (Possibly not usable in research glitch?)
  774. ]]}
  775.  
  776. if turtle ~= nil then
  777.     maxtoshow = 7;
  778. end
  779.  
  780. function printAspects(x)
  781.     action = 'mainList';
  782.  
  783.     clear();
  784.     for i = x, #aspectNumbers do
  785.         if x + maxtoshow <= i then break end
  786.         print(i .. ") " .. aspectNumbers[i]);
  787.     end
  788.     print("----------------------\n0) [More]\n\nEnter the Aspect number to view properties: ");
  789.  
  790.     term.setCursorBlink(true);
  791.     selected = tonumber(read());
  792.     print(selected);
  793.     term.setCursorBlink(false);
  794.  
  795.     if selected > 0 and selected <= #aspectNumbers then
  796.         action = 'showAspect';
  797.     else
  798.         action = 'backNextaspectNumbers';
  799.         if true then
  800.             return 2, x; -- just goes to the next page instead of new aspectNumbers
  801.         else
  802.             term.clear();
  803.             print("1) Previous Page of Aspects...");
  804.             print("2) Next Page of Aspects...");
  805.             print("\n\n0) [Back]\n\nEnter the option number: ");
  806.  
  807.             term.setCursorBlink(true);
  808.             selected = tonumber(read());
  809.             term.setCursorBlink(false);
  810.         end
  811.     end
  812.     return selected, x;
  813. end
  814.  
  815. function MakeBook()
  816.   load(sPath)
  817.   term.clear() term.setCursorPos( 1, 1 )
  818.   local sPrinterSide = nil
  819.         for n,sSide in ipairs(rs.getSides()) do
  820.             if peripheral.isPresent(sSide) and peripheral.getType(sSide) == "printer" then
  821.                 sPrinterSide = sSide
  822.                 break
  823.             end
  824.         end
  825.        
  826.         if not sPrinterSide then
  827.             print( "No printer attached" )
  828.             return
  829.         end
  830.  
  831.         local nPage = 0
  832.         local sName = fs.getName( sPath )
  833.         local printer = peripheral.wrap(sPrinterSide)
  834.         if printer.getInkLevel() < 1 then
  835.             print( "Printer out of ink")
  836.             return
  837.         elseif printer.getPaperLevel() < 1 then
  838.             print( "Printer out of paper")
  839.             return
  840.         end
  841.        
  842.         local terminal = {
  843.             getCursorPos = printer.getCursorPos,
  844.             setCursorPos = printer.setCursorPos,
  845.             getSize = printer.getPageSize,
  846.             write = printer.write,
  847.         }
  848.         terminal.scroll = function()
  849.             if nPage == 1 then
  850.                 printer.setPageTitle( "Encyclopedia Thaumamatica: "..aspectNumbers[selected].." (page "..nPage..")" )          
  851.             end
  852.            
  853.             while not printer.newPage() do
  854.                 if printer.getInkLevel() < 1 then
  855.                     print( "Printer out of ink, please refill")
  856.                 elseif printer.getPaperLevel() < 1 then
  857.                     print( "Printer out of paper, please refill")
  858.                 else
  859.                     print( "Printer output tray full, please empty")
  860.                 end
  861.    
  862.                 term.restore()
  863.                 term.redirect( terminal )
  864.                
  865.                 local timer = os.startTimer(0.5)
  866.                 sleep(0.5)
  867.             end
  868.  
  869.             nPage = nPage + 1
  870.             if nPage == 1 then
  871.                 printer.setPageTitle( "Encyclopedia Thaumamatica: "..aspectNumbers[selected] )
  872.             else
  873.                 printer.setPageTitle( "Encyclopedia Thaumamatica: "..aspectNumbers[selected].." (page "..nPage..")" )
  874.             end
  875.         end
  876.        
  877.  
  878.         term.redirect( terminal )
  879.         local ok, error = pcall( function()
  880.             term.scroll()
  881.             for n, sLine in ipairs( tLines ) do
  882.                 print( sLine )
  883.             end
  884.         end )
  885.         term.restore()
  886.         if not ok then
  887.             print( error )
  888.         end
  889.        
  890.         while not printer.endPage() do
  891.             term.clear() term.setCursorPos( 1, 1 )
  892.             print( "Printer output tray full, please empty")   
  893.             sleep( 0.5 )
  894.         end
  895.  
  896.        
  897.         if nPage > 1 then
  898.             print( "Printed "..nPage.." Pages")
  899.         else
  900.             print( "Printed 1 Page")
  901.         end
  902.         sleep( 2 ) 
  903. end
  904.  
  905.  
  906.  
  907.  
  908. if tArgs[1] == "printall" then
  909.   for i=1, #aspectNumbers do
  910.      selected = i
  911.           local w = fs.open("aspectFile", "w")
  912.           w.write(aspectData[selected])
  913.           w.close()
  914.           local r = fs.open("aspectFile", "r")
  915.       clear()
  916.      MakeBook()
  917.            r.close()
  918.           fs.delete("aspectFile")
  919.            clear()         
  920.   end
  921. else
  922.     selected, startat = printAspects(1);
  923.     while true do
  924.         if action == 'showAspect' then
  925.           local w = fs.open("aspectFile", "w")
  926.           w.write(aspectData[selected])
  927.           w.close()
  928.           local r = fs.open("aspectFile", "r")
  929.            if tArgs[1] == "print" then
  930.               clear()
  931.              MakeBook()
  932.               os.pullEvent("key")
  933.            else
  934.              repeat
  935.                  term.clear() term.setCursorPos( 1, 1 )
  936.                 for _=1,maxtoshow do
  937.                    print(r.readLine())
  938.                 end
  939.                  print("\n\n\n Press any key to continue")
  940.                  os.pullEvent("key")
  941.                  term.clear() term.setCursorPos( 1, 1 )
  942.              until not r.readLine()
  943.            end
  944.           r.close()
  945.           fs.delete("aspectFile")
  946.           term.clear() term.setCursorPos( 1, 1 )
  947.  
  948.            
  949.             action = 'backNextaspectNumbers'
  950.         else
  951.             if action == 'backNextaspectNumbers' then
  952.                 if selected == 1 then
  953.                     startat = startat - maxtoshow;
  954.                     if startat < 1 then startat = 1; end
  955.                     selected, startat = printAspects(startat);
  956.                 elseif selected == 2 then
  957.                     startat = startat + maxtoshow
  958.                     if startat > #aspectNumbers then startat = 1; end
  959.                     selected, startat = printAspects(startat);
  960.                 else --if selected == 0 then
  961.                     selected, startat = printAspects(startat);
  962.                 end
  963.             elseif action =='mainList' then
  964.                 selected, startat = printAspects(startat);
  965.             end
  966.         end
  967.     end
  968. end
  969. end
Advertisement
Add Comment
Please, Sign In to add comment