TheOddByte

[CC] Eggcracker

Mar 30th, 2013
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.58 KB | None | 0 0
  1. --[[
  2. Eggcracker 2013
  3. Made by Hellkid98
  4. Category: GAME
  5.  
  6. NOTE: This is not working anymore( atleast not for me ) and I don't plan on fixing it!
  7. - Hellkid98, 2014-02-12
  8. ]]--
  9.  
  10. local num
  11.  
  12. rPath = shell.path()
  13.  
  14. --HypeGames info
  15. if runFromHypeGames then
  16.  
  17. file = fs.open(".HypeGames_Data/.temp-loggedInUser","r")
  18.  local fileData = {}
  19. local line = file.readLine()
  20. repeat
  21. table.insert(fileData,line)
  22. line = file.readLine()
  23. until line == nil
  24. file.close()
  25.  
  26. hUsername = fileData[1]
  27.  
  28. else
  29. shell.setPath(rPath)
  30. end
  31.  
  32. --Loading
  33. if not fs.exists(shell.path()..".01100101 01100111 01100111 01100011 01110010 01100001 01100011 01101011 01100101 01110010/save") then
  34. num = 1000000
  35.  
  36. elseif fs.exists(shell.path()..".01100101 01100111 01100111 01100011 01110010 01100001 01100011 01101011 01100101 01110010/save") then
  37. file = fs.open(shell.path()..".01100101 01100111 01100111 01100011 01110010 01100001 01100011 01101011 01100101 01110010/save","r")
  38. local fileData = {}
  39. local line = file.readLine()
  40. repeat
  41. table.insert(fileData,line)
  42. line = file.readLine()
  43. until line == nil
  44. file.close()
  45.  
  46. num = fileData[1]
  47. file.close()
  48. tonumber(num)
  49. num = math.ceil(num)
  50. end
  51.  
  52. --Screen/Drawing functions
  53. -----------------------------
  54. w,h = term.getSize()
  55. hW = w/2
  56. hH = h/2  
  57.  
  58. function centerPrint(y,text)
  59.   term.setCursorPos(w/2 - #text/2, y)
  60.     term.write(text)
  61. end
  62.  
  63. function drawAt(x,y,text)
  64.  term.setCursorPos(x,y)
  65. write(text)
  66. end
  67.  
  68. function cleanScreen()
  69. term.clear()
  70.   term.setCursorPos(1,1)
  71.  end
  72.  
  73.  
  74.  
  75.  --Pre Screen
  76.  term.setBackgroundColor(colors.white)
  77.  term.setTextColor(colors.black)
  78.  cleanScreen()
  79.  centerPrint(hH - 4,"[CC]Eggcracker 2013")
  80.  centerPrint(hH - 2,"By Hellkid98")
  81.  
  82.  term.setTextColor(colors.cyan)
  83.  centerPrint(hH + 2,"+-Objective-+")
  84.  centerPrint(hH + 3,"Click the egg")
  85.  
  86.  term.setTextColor(colors.black)
  87.  centerPrint(hH + 6,"Click to continue")
  88.  os.pullEvent("mouse_click")
  89.  
  90.  
  91.  
  92. function drawArt()
  93. term.setBackgroundColor(colors.black)
  94. cleanScreen()
  95.  
  96. term.setBackgroundColor(colors.white)
  97. term.setTextColor(colors.black)
  98.  
  99. --EGG
  100. if num == 1000000 then
  101. centerPrint(hH - 3,  "       ")
  102. centerPrint(hH - 2, "         ")
  103. centerPrint(hH - 1, "         ")
  104. centerPrint(hH,    "           ")
  105. centerPrint(hH + 1,"           ")
  106. centerPrint(hH + 2,"           ")
  107. centerPrint(hH + 3, "         ")
  108. centerPrint(hH + 4, "         ")
  109. centerPrint(hH + 5,  "       ")
  110. end
  111.  
  112. if num >= 950000 and
  113. num < 1000000 then
  114. centerPrint(hH - 3,  "\\      ")
  115. centerPrint(hH - 2, "         ")
  116. centerPrint(hH - 1, "         ")
  117. centerPrint(hH,    "           ")
  118. centerPrint(hH + 1,"           ")
  119. centerPrint(hH + 2,"           ")
  120. centerPrint(hH + 3, "         ")
  121. centerPrint(hH + 4, "         ")
  122. centerPrint(hH + 5,  "       ")
  123. end
  124.  
  125.  
  126.  
  127. if num >= 900000 and
  128. num < 950000 then
  129. centerPrint(hH - 3,  "\\      ")
  130. centerPrint(hH - 2, "  \\_     ")
  131. centerPrint(hH - 1, "         ")
  132. centerPrint(hH,    "           ")
  133. centerPrint(hH + 1,"           ")
  134. centerPrint(hH + 2,"           ")
  135. centerPrint(hH + 3, "         ")
  136. centerPrint(hH + 4, "         ")
  137. centerPrint(hH + 5,  "       ")
  138. end
  139.  
  140.  
  141. if num >= 850000 and
  142. num < 900000 then
  143. centerPrint(hH - 3,  "\\      ")
  144. centerPrint(hH - 2, "  \\__    ")
  145. centerPrint(hH - 1, "    \\    ")
  146. centerPrint(hH,    "           ")
  147. centerPrint(hH + 1,"           ")
  148. centerPrint(hH + 2,"           ")
  149. centerPrint(hH + 3, "         ")
  150. centerPrint(hH + 4, "         ")
  151. centerPrint(hH + 5,  "       ")
  152. end
  153.  
  154.  
  155. if num  >= 800000 and
  156.   num < 850000 then
  157.   centerPrint(hH - 3,"\\      ")
  158. centerPrint(hH - 2, "  \\__    ")
  159. centerPrint(hH - 1, "    \\    ")
  160. centerPrint(hH,    "           ")
  161. centerPrint(hH + 1,"           ")
  162. centerPrint(hH + 2,"/          ")
  163. centerPrint(hH + 3, "         ")
  164. centerPrint(hH + 4, "         ")
  165. centerPrint(hH + 5,  "       ")
  166. end
  167.  
  168.  
  169.  
  170. if num  >= 750000 and
  171.   num < 800000 then
  172.   centerPrint(hH - 3,"\\      ")
  173. centerPrint(hH - 2, "  \\__    ")
  174. centerPrint(hH - 1, "    \\    ")
  175. centerPrint(hH,    "           ")
  176. centerPrint(hH + 1," _         ")
  177. centerPrint(hH + 2,"/          ")
  178. centerPrint(hH + 3, "         ")
  179. centerPrint(hH + 4, "         ")
  180. centerPrint(hH + 5,  "       ")
  181. end
  182.  
  183.  
  184.  
  185. if num  >= 700000 and
  186.   num < 750000 then
  187.   centerPrint(hH - 3,"\\      ")
  188. centerPrint(hH - 2, "  \\__    ")
  189. centerPrint(hH - 1, "    \\    ")
  190. centerPrint(hH,    "           ")
  191. centerPrint(hH + 1," _/        ")
  192. centerPrint(hH + 2,"/          ")
  193. centerPrint(hH + 3, "         ")
  194. centerPrint(hH + 4, "         ")
  195. centerPrint(hH + 5,  "       ")
  196. end
  197.  
  198.  
  199.  
  200. if num  >= 650000 and
  201.   num < 700000 then
  202.   centerPrint(hH - 3,"\\      ")
  203. centerPrint(hH - 2, "  \\__    ")
  204. centerPrint(hH - 1, "    \\    ")
  205. centerPrint(hH,    "           ")
  206. centerPrint(hH + 1," _/       _")
  207. centerPrint(hH + 2,"/          ")
  208. centerPrint(hH + 3, "         ")
  209. centerPrint(hH + 4, "         ")
  210. centerPrint(hH + 5,  "       ")
  211. end
  212.  
  213.  
  214. if num  >= 600000 and
  215.   num < 650000 then
  216.   centerPrint(hH - 3,"\\      ")
  217. centerPrint(hH - 2, "  \\__    ")
  218. centerPrint(hH - 1, "    \\    ")
  219. centerPrint(hH,    "           ")
  220. centerPrint(hH + 1," _/       _")
  221. centerPrint(hH + 2,"/        / ")
  222. centerPrint(hH + 3, "         ")
  223. centerPrint(hH + 4, "         ")
  224. centerPrint(hH + 5,  "       ")
  225. end
  226.  
  227.  
  228. if num  >= 550000 and
  229.   num < 600000 then
  230.   centerPrint(hH - 3,"\\      ")
  231. centerPrint(hH - 2, "  \\__    ")
  232. centerPrint(hH - 1, "    \\    ")
  233. centerPrint(hH,    "   _       ")
  234. centerPrint(hH + 1," _/       _")
  235. centerPrint(hH + 2,"/        / ")
  236. centerPrint(hH + 3, "         ")
  237. centerPrint(hH + 4, "         ")
  238. centerPrint(hH + 5,  "       ")
  239. end
  240.  
  241.  
  242. if num  >= 500000 and
  243.   num < 550000 then
  244.   centerPrint(hH - 3,"\\      ")
  245. centerPrint(hH - 2, "  \\__    ")
  246. centerPrint(hH - 1, "    \\    ")
  247. centerPrint(hH,    "   _       ")
  248. centerPrint(hH + 1," _/ \\     _")
  249. centerPrint(hH + 2,"/        / ")
  250. centerPrint(hH + 3, "         ")
  251. centerPrint(hH + 4, "         ")
  252. centerPrint(hH + 5,  "       ")
  253. end
  254.  
  255.  
  256. if num  >= 450000 and
  257.   num < 500000 then
  258.   centerPrint(hH - 3,"\\      ")
  259. centerPrint(hH - 2, "  \\__   /")
  260. centerPrint(hH - 1, "    \\  | ")
  261. centerPrint(hH,    "   _       ")
  262. centerPrint(hH + 1," _/ \\     _")
  263. centerPrint(hH + 2,"/        / ")
  264. centerPrint(hH + 3, "         ")
  265. centerPrint(hH + 4, "         ")
  266. centerPrint(hH + 5,  "       ")
  267. end
  268.  
  269.  
  270.  
  271. if num  >= 400000 and
  272.   num < 450000 then
  273.   centerPrint(hH - 3,"\\      ")
  274. centerPrint(hH - 2, "  \\__   /")
  275. centerPrint(hH - 1, "    \\  | ")
  276. centerPrint(hH,    "   _    /  ")
  277. centerPrint(hH + 1," _/ \\_    _")
  278. centerPrint(hH + 2,"/        / ")
  279. centerPrint(hH + 3, "         ")
  280. centerPrint(hH + 4, "        \\")
  281. centerPrint(hH + 5,  "       ")
  282. end
  283.  
  284.  
  285.  
  286. if num  >= 300000 and
  287.   num < 400000 then
  288.   centerPrint(hH - 3,"\\      ")
  289. centerPrint(hH - 2, "  \\__   /")
  290. centerPrint(hH - 1, "    \\  | ")
  291. centerPrint(hH,    "   _    /  ")
  292. centerPrint(hH + 1," _/ \\_    _")
  293. centerPrint(hH + 2,"/        / ")
  294. centerPrint(hH + 3, " _/      ")
  295. centerPrint(hH + 4, "/       \\")
  296. centerPrint(hH + 5,  "       ")
  297. end
  298.  
  299.  
  300. if num  >= 200000 and
  301.   num < 300000 then
  302.   centerPrint(hH - 3,"\\      ")
  303. centerPrint(hH - 2, "  \\__   /")
  304. centerPrint(hH - 1, "    \\  | ")
  305. centerPrint(hH,    "   _    /  ")
  306. centerPrint(hH + 1," _/ \\_    _")
  307. centerPrint(hH + 2,"/      \\ / ")
  308. centerPrint(hH + 3, " _/_     ")
  309. centerPrint(hH + 4, "/       \\")
  310. centerPrint(hH + 5,  "       ")
  311. end
  312.  
  313.  
  314.  
  315. if num  >= 100000 and
  316.   num < 200000 then
  317.   centerPrint(hH - 3,"\\      ")
  318. centerPrint(hH - 2, "  \\__   /")
  319. centerPrint(hH - 1, "  _/\\  | ")
  320. centerPrint(hH,    "  /_    /  ")
  321. centerPrint(hH + 1," _/ \\_    _")
  322. centerPrint(hH + 2,"/   _/ \\ / ")
  323. centerPrint(hH + 3, " _/_     ")
  324. centerPrint(hH + 4, "/       \\")
  325. centerPrint(hH + 5,  "       ")
  326. end
  327.  
  328.  
  329.  
  330. if num  >= 1 and
  331.   num < 50000 then
  332.   centerPrint(hH - 3,"\\      ")
  333. centerPrint(hH - 2, "  \\__   /")
  334. centerPrint(hH - 1, "  _/\\  | ")
  335. centerPrint(hH,    "  /_   _/  ")
  336. centerPrint(hH + 1," _/ \\_  \\ _")
  337. centerPrint(hH + 2,"/   _/ \\ / ")
  338. centerPrint(hH + 3, " _/_     ")
  339. centerPrint(hH + 4, "/       \\")
  340. centerPrint(hH + 5,  "       ")
  341. end
  342.  
  343. if num == 0 then
  344. term.setTextColor(colors.red)
  345. term.setBackgroundColor(colors.black)
  346. centerPrint(hH - 1,"So What?")
  347. term.setBackgroundColor(colors.white)
  348. term.setTextColor(colors.black)
  349. centerPrint(hH + 1," _/ \\_  \\ _")
  350. centerPrint(hH + 2,"/   _/ \\ / ")
  351. centerPrint(hH + 3, " _/_     ")
  352. centerPrint(hH + 4, "/       \\")
  353. centerPrint(hH + 5,  "       ")
  354. end
  355.  
  356. term.setBackgroundColor(colors.gray)
  357. term.setTextColor(colors.lime)
  358. centerPrint(2,"  "..num.."  ")
  359.  
  360. term.setTextColor(colors.yellow)
  361. centerPrint(h - 1," [SPACE] Save and exit ")
  362.  end
  363.  
  364.  
  365.  
  366.  
  367.  function events()
  368.  
  369.  --Egg Position
  370.  --Width
  371.  minPosX = w/2 - 5
  372.  maxPosX = w/2 + 5
  373.  --Heigth
  374.  minPosY = h/2 - 4
  375.  maxPosY = h/2 + 4
  376.  
  377.  
  378.  
  379.   evt, but, xPos, yPos = os.pullEvent()
  380.  
  381.    if evt == "key" then
  382.  if but == 57 then
  383.  
  384.   if not fs.exists(shell.path()..".01100101 01100111 01100111 01100011 01110010 01100001 01100011 01101011 01100101 01110010") then
  385.  fs.makeDir(shell.path()..".01100101 01100111 01100111 01100011 01110010 01100001 01100011 01101011 01100101 01110010")
  386.   end
  387.  
  388.    file = fs.open(shell.path()..".01100101 01100111 01100111 01100011 01110010 01100001 01100011 01101011 01100101 01110010/save","w")
  389.    file.writeLine(num)
  390.    file.close()
  391.    
  392.    term.setBackgroundColor(colors.black)
  393.    cleanScreen()
  394.    centerPrint(hH,"Saved!")
  395.    sleep(0.5)
  396.    term.setBackgroundColor(colors.black)
  397.    term.setTextColor(colors.white)
  398.    cleanScreen()
  399.    print("Thanks For Playing!")
  400.    error()
  401. end
  402.  
  403.   elseif evt == "mouse_click" then
  404.      if but == 1 then
  405.      
  406.     if xPos >=minPosX and
  407.        xPos <= maxPosX then
  408.        
  409.    if yPos > minPosY and
  410.     yPos < maxPosY then
  411.    
  412.     num = num - 1
  413.     if num < 0 then
  414.      num = 0
  415.          end
  416.        end
  417.     end
  418.    
  419.     elseif but == 2 then
  420.     term.setBackgroundColor(colors.black)
  421.     term.setTextColor(colors.yellow)
  422.     cleanScreen()
  423.   centerPrint(2,"[CC]Eggcracker 2013")
  424.   term.setTextColor(colors.white)
  425.   centerPrint(hH - 1,"Credits")
  426.   centerPrint(hH,"+---------+")
  427.   centerPrint(hH + 1,"Hellkid98")
  428.   centerPrint(18,"Press any key to continue")
  429.   os.pullEvent("key")
  430.  end
  431.  
  432.  
  433.     end
  434.        end
  435.  
  436.  
  437.  function main()
  438.  while true do
  439. drawArt()
  440.  
  441. if runFromHypeGames then
  442.  
  443. if num < 1000000 then
  444. achievement.unlock("I migh as well get started..", 10)
  445. end
  446. drawArt()
  447. if num <= 500000 then
  448. achievement.unlock("Halfway there!", 500)
  449. end
  450. drawArt()
  451. if num <= 0 then
  452. achievement.unlock("All this for nothing!?!", 1000)
  453. end
  454. drawArt()
  455. end
  456.  
  457. events()
  458. end
  459.    end
  460.  
  461.  
  462. main()
Add Comment
Please, Sign In to add comment