Guest User

CookieClicker CC Edition v1.2 Alpha

a guest
Apr 27th, 2014
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.36 KB | None | 0 0
  1. if(fs.exists("/.CookieCSave"))then
  2.     f = fs.open("/.CookieCSave", "r")
  3.     cookies = f.readLine()
  4.     cpc = f.readLine()
  5.     superclick = f.readLine()
  6.     SuperCPrice = f.readLine()
  7.     megaclick = f.readLine()
  8.     MegaCPrice = f.readLine()
  9.     f.close()
  10. else
  11.     print "Createing Cookie Save..."
  12.     sleep(2)
  13.     f = fs.open("/.CookieCSave", "w")
  14.     f.writeLine("0") --Cookies
  15.     f.writeLine("1") --Cpc
  16.     f.writeLine("0") --Lvl of item 1
  17.     f.writeLine("200") -- Price Of Item 1
  18.     f.writeLine("0") -- Lvl of item 2
  19.     f.writeLine("10000") -- Price Of Item 2
  20.     f.close()
  21.     cookies = 0
  22.     pc = 1
  23.     superclick = 0
  24.     SuperCPrice = 200
  25.     magaclick = 0
  26.     MegaCPrice = 10000
  27.     print "Reboot Required"
  28.     sleep(1)
  29.     os.reboot()
  30. end
  31.  
  32. main = true
  33. inShop = false
  34. SuperC = false
  35.  
  36.  
  37. function cp(x,y)
  38.     term.setCursorPos(x,y)
  39. end
  40.  
  41. function bg(color)
  42.     term.setBackgroundColor(color)
  43. end
  44.  
  45. function tc(color)
  46.     term.setTextColor(color)
  47. end
  48.  
  49. function cl()
  50.     term.clearLine()
  51. end
  52.  
  53. function clear()
  54.     bg(colors.black)
  55.     cp(1,1)
  56.     term.clear()
  57. end
  58.  
  59. function clearCol(col)
  60.     bg(col)
  61.     cp(1,1)
  62.     term.clear()
  63. end
  64.  
  65. function draw()
  66.     bg(colors.lightBlue)
  67.     term.clear()
  68.     cookie = paintutils.loadImage("ccpics/cookie")
  69.     paintutils.drawImage(cookie, 15, 3)
  70.  
  71.  
  72.     bg(colors.gray)
  73.     cp(21,2)
  74.     print "::Cookies::"
  75.     cp(25,3)
  76.     print(cookies)
  77.  
  78.     bg(colors.green)
  79.     cp(1,1)
  80.     print "Shop"
  81.  
  82.     bg(colors.brown)
  83.     cp(13, 18)
  84.     print("Cookies Per Click(cpc): "..cpc)
  85.  
  86.     bg(colors.green)
  87.     cp(48, 1)
  88.     print "Save"
  89.  
  90.     bg(colors.lightBlue)
  91.     cp(40, 17)
  92.     print "By Lewisk3"
  93. end
  94.  
  95.  
  96. function menu()
  97.     bg(colors.gray)
  98.     term.clear()
  99.     cp(1,2)
  100.     print "--------------------Cookie-Shop--------------------" -- 17Long
  101.     print("SuperClick: x2 mc LVL:"..superclick.." Price: "..SuperCPrice)
  102.     --print("AutoClicker +1 cps LVL:"..autoclick.." Price: "..aClickPrice)
  103.     print("MegaClick: x4 mc LVL: "..megaclick.." Price: "..MegaCPrice)
  104.     cp(51, 1)
  105.     bg(colors.red)
  106.     print "X"
  107.     bg(colors.gray)
  108. end
  109.  
  110.  
  111.  
  112.  
  113. function clicker()
  114.  
  115. while main == true do
  116. local event, button, x, y = os.pullEvent("mouse_click")
  117.     if(x >= 18 and x <= 33 and y >= 4 and y <= 17 and button == 1)then
  118.         cookies = cookies + cpc
  119.         bg(colors.gray)
  120.         draw()
  121.         elseif(x >= 1 and x <=4 and y == 1 and button == 1)then
  122.             menu()
  123.             inShop = true
  124.             main = false
  125.             CShop()
  126.             elseif(x >= 48 and x <= 51 and y == 1 and button == 1)then
  127.                 f = fs.open("/.CookieCSave", "w")
  128.                 f.writeLine(cookies)
  129.                 f.writeLine(cpc)
  130.                 f.writeLine(superclick)
  131.                 f.writeLine(SuperCPrice)
  132.                 f.writeLine(megaclick)
  133.                 f.writeLine(MegaCPrice)
  134.                 f.close()
  135.     end
  136.  
  137. end
  138. end
  139.  
  140. function CShop()
  141.     while inShop == true do
  142.     local event2, button2, x2, y2 = os.pullEvent("mouse_click")
  143.    
  144.         if(y2 == 3 and button2 == 1 and tonumber(cookies) >= tonumber(SuperCPrice))then
  145.             superclick = superclick + 1
  146.             cookies = cookies - SuperCPrice
  147.             SuperCPrice = SuperCPrice * 4
  148.             cpc = cpc * 2
  149.             inShop = false
  150.             main = true
  151.             draw()
  152.             return clicker()
  153.         end
  154.        
  155.         if(y2 == 4 and button2 == 1 and tonumber(cookies) >= tonumber(MegaCPrice))then
  156.             megaclick = megaclick + 1
  157.             cookies = cookies - MegaCPrice
  158.             MegaCPrice = MegaCPrice * 6
  159.             cpc = cpc * 4
  160.             inShop = false
  161.             main = true
  162.             draw()
  163.             return clicker()
  164.         end
  165.        
  166.         if(x2 == 51 and y2 == 1 and button2 == 1)then
  167.             inShop = false
  168.             main = true
  169.             draw()
  170.             return clicker()
  171.         end
  172. end
  173. end
  174. draw()
  175. clicker()
Advertisement
Add Comment
Please, Sign In to add comment