Guest User

Thaumcraft Research Helper Form

a guest
Jan 14th, 2014
671
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Directory to store files
  2. local reciDir = "/thaumhelper/recipes"
  3. local descDir = "/thaumhelper/descriptions"
  4.  
  5. print("Enter the aspect name")
  6. local name = ""
  7. while #name < 1 do
  8.  name = read()
  9. end
  10. print("Enter the first component (blank if none)")
  11. local recipe1 = read()
  12. local recipe2 = ""
  13. if #recipe1 > 0 then
  14.  print("Enter the second component")
  15.  recipe2 = ""
  16.  while #recipe2 < 1 do
  17.   recipe2 = read()
  18.  end
  19. end
  20. print("Select the aspect icon colour")
  21.  
  22. -- Giant colour list for some reason
  23. local colList = {}
  24. colList["white"] = colors.white
  25. colList["orange"] = colors.orange
  26. colList["magenta"] = colors.magenta
  27. colList["lightBlue"] = colors.lightBlue
  28. colList["yellow"] = colors.yellow
  29. colList["lime"] = colors.lime
  30. colList["pink"] = colors.pink
  31. colList["gray"] = colors.gray
  32. colList["lightGray"] = colors.lightGray
  33. colList["cyan"] = colors.cyan
  34. colList["purple"] = colors.purple
  35. colList["blue"] = colors.blue
  36. colList["brown"] = colors.brown
  37. colList["green"] = colors.green
  38. colList["red"] = colors.red
  39. colList["black"] = colors.black
  40. local i = 0
  41. local colLabel = {}
  42. print("")
  43. term.setTextColor(colors.black)
  44. for k, v in pairs(colList) do
  45.  i = i + 1
  46.  colLabel[i..""] = k
  47.  term.setBackgroundColor(v)
  48.  term.write(" "..i)
  49. end
  50. term.setBackgroundColor(colors.black)
  51. term.setTextColor(colors.white)
  52. print("")
  53.  
  54. local col = ""
  55. local invalid = true
  56. while invalid do
  57.  col = read()
  58.  for k, v in pairs(colLabel) do
  59.   if col == k then
  60.    invalid = false
  61.    break
  62.   end
  63.  end
  64. end
  65.  
  66. print("Write the aspect description")
  67. local desc = read()
  68.  
  69. print("Save this aspect? y/n")
  70. local yesno = ""
  71. while true do
  72.  yesno = read()
  73.  if yesno == "n" then
  74.   break
  75.  elseif yesno == "y" then
  76.   local tFile = fs.open(reciDir.."/"..name,"w")
  77.   if #recipe1 > 0 then
  78.    tFile.writeLine(recipe1)
  79.    tFile.writeLine(recipe2)
  80.   end
  81.   tFile.close()
  82.   tFile = fs.open(descDir.."/"..name,"w")
  83.   tFile.writeLine(colLabel[col])
  84.   tFile.writeLine(desc)
  85.   tFile.close()
  86.   break
  87.  end
  88. end
Advertisement
Add Comment
Please, Sign In to add comment