Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- backcolor = 1
- textcolor = 188
- a = 1
- add = 1
- cost = 100
- fs.makeDir("cookies")
- if not fs.exists("cookies/cookiea") then
- mc = fs.open("cookies/cookiea", "w")
- mc.write("0")
- mc.close()
- end
- cc = fs.open("cookies/cookiea", "r")
- a = cc.readLine()
- cc.close()
- if not fs.exists("cookies/background") then
- shell.run("pastebin", "get", "1LaRjsPG", "cookies/background")
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function cookie()
- term.setBackgroundColor(backcolor)
- term.clear()
- bground = paintutils.loadImage("cookies/background")
- paintutils.drawImage(bground,1,1)
- term.setCursorPos(1,1)
- term.setBackgroundColor(backcolor)
- term.setTextColor(textcolor)
- print("Cookie clicker V0.1")
- term.setCursorPos(25,1)
- print("Reset cookie clicker")
- term.setCursorPos(25,4)
- print("Double click(100 cookies)")
- term.setCursorPos(25,3)
- print("Upgrades:")
- term.setCursorPos(1,18)
- print("Exit")
- term.setCursorPos(4,16)
- print(a)
- end
- cookie()
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if event == "mouse_click" then
- if X >=25 and X <=45 and button == 1 and Y== 1 then
- fs.delete("cookies/cookiea")
- fs.delete("cookies/upgrade")
- mc = fs.open("cookies/cookiea", "w")
- mc.write("0")
- mc.close()
- a = 0
- add = 1
- cookie()
- elseif X >=25 and X <=50 and button == 1 and Y== 4 then
- clear()
- if not fs.exists("cookies/upgrade") then
- if upg == true then
- clear()
- up = fs.open("cookies/upgrade", "w")
- up.write("true")
- up.close()
- upcc = a - cost
- fs.delete("cookies/cookiea")
- upc = fs.open("cookies/cookiea", "w")
- upc.write(upcc)
- upc.close()
- end
- end
- cookie()
- elseif X>=1 and X<=4 and Y== 18 and button ==1 then
- os.reboot()
- elseif X >=4 and X <=16 and button == 1 and Y >=6 and Y <=13 then
- clear()
- if a == "100.0" then
- upg = true
- end
- if fs.exists("cookies/upgrade") then
- add = 2
- end
- a = a + add
- fs.delete("cookies/cookiea")
- ca = fs.open("cookies/cookiea", "w")
- ca.write(a)
- ca.close()
- cc = fs.open("cookies/cookiea", "r")
- a = cc.readLine()
- cc.close()
- cookie()
- if a == "1.0" then
- term.setCursorPos(1,3)
- print("Wake and bake")
- end
- if a == "100.0" then
- term.setCursorPos(1,3)
- print("100 COOKIES")
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment