Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createKey(progr)
- function genKey()
- alpha = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
- str = ""
- for i=1, 12 do
- ind = math.random(26)
- if i == 5 or i == 9 or i == 13 then
- str = str.."-"
- end
- str = str..alpha[ind]
- end
- return str
- end
- http.get("http://kamino.a-centauri.com:62380/product.php?richiesta=insert&key="..genKey().."&program="..progr)
- end
- function blank()
- term.clear()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1, 1)
- end
- cPage = "home"
- function blankPage()
- blank()
- term.setCursorPos(1, 1)
- for i=1, 51 do
- term.setBackgroundColor(colors.black)
- term.write(" ")
- end
- term.setCursorPos(1, 1)
- term.write("Home")
- term.setCursorPos(6, 1)
- term.write("Negozio")
- end
- function drawHomePage()
- blankPage()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.yellow)
- term.write("Home")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(2, 3)
- term.write("La ZEUS åA8 felice di darvi il benvenuto sul nostro")
- term.setCursorPos(2, 4)
- term.write("sito. Qui potrete comprare gran parte dei nostri")
- term.setCursorPos(2, 5)
- term.write("programmi oppure potrete richiedere assistenza.")
- term.setCursorPos(2, 7)
- term.write("News: ")
- term.setCursorPos(2, 8)
- term.write("Linux åA8 pronto al rilascio!")
- term.setCursorPos(2, 9)
- term.write("Finalmente potrete comprare un disco")
- term.setCursorPos(2, 10)
- term.write("di installazione per Linux a soli 4IC!")
- end
- function drawShopPage()
- blankPage()
- term.setCursorPos(6, 1)
- term.setTextColor(colors.yellow)
- term.write("Negozio")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(2, 3)
- term.write("")
- end
- function checkClick()
- while true do
- _, btn, x, y = os.pullEvent("mouse_click")
- if btn == 1 and x <= 4 and y == 1 then
- os.queueEvent("homepage")
- elseif btn == 1 and x >= 6 and x <= 13 and y == 1 then
- os.queueEvent("shoppage")
- end
- end
- end
- function checkPage()
- while true do
- _ = os.pullEvent()
- if _ == "homepage" then
- if cPage ~= "home" then
- drawHomePage()
- end
- cPage = "home"
- elseif _ == "shoppage" then
- if cPage ~= "shop" then
- drawShopPage()
- end
- cPage = "shop"
- end
- end
- end
- drawHomePage()
- parallel.waitForAll(checkPage, checkClick)
Advertisement
Add Comment
Please, Sign In to add comment