Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear",1)
- mon = peripheral.wrap("back")
- mon.clear()
- function printCentered(text)
- local maxw, maxh = mon.getSize()
- local curx, cury = mon.getCursorPos()
- mon.setCursorPos(((maxw - #text) / 2) +1, cury)
- mon.write(text)
- mon.setCursorPos(curx, cury + 1)
- end
- function intro()
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("Salute viandante!")
- mon.setCursorPos(1,2)
- mon.write("Poni una domanda")
- mon.setCursorPos(1,3)
- mon.write("ed inserisci una")
- mon.setCursorPos(1,4)
- mon.write("moneta")
- mon.setCursorPos(7,5)
- mon.write("Non dà resto")
- end
- function answer()
- rand = math.random(28)
- mon.clear()
- mon.setCursorPos(1,3)
- mon.write("L'albero sta")
- mon.setCursorPos(1,4)
- mon.write("pensando...")
- sleep(1.5)
- printValue = ""
- if rand == 1 then
- printValue = "Sì"
- elseif rand == 2 then
- printValue = "No"
- elseif rand == 3 then
- printValue = "Forse"
- elseif rand == 4 then
- printValue = "Può darsi"
- elseif rand == 5 then
- printValue = "Non oggi"
- elseif rand == 6 then
- printValue = "Certamente"
- elseif rand == 7 then
- printValue = "Domani"
- elseif rand == 8 then
- printValue = "No, mai"
- elseif rand == 9 then
- printValue = "Assolutamente no"
- elseif rand == 10 then
- printValue = "Assolutamente sì"
- elseif rand == 11 then
- printValue = "Di sicuro"
- elseif rand == 12 then
- printValue = "Anche no"
- elseif rand == 13 then
- printValue = "Mmh"
- elseif rand == 14 then
- printValue = "Non saprei"
- elseif rand == 15 then
- printValue = "Non so"
- elseif rand == 16 then
- printValue = "Non ne sono sicuro"
- elseif rand == 17 then
- printValue = "Il futuro è incerto"
- elseif rand == 18 then
- printValue = "Decisamente sì"
- elseif rand == 19 then
- printValue = "Decisamente no"
- elseif rand == 20 then
- printValue = "Probabilmente sì"
- elseif rand == 21 then
- printValue = "Probabilmente no"
- elseif rand == 22 then
- printValue = "Dipende"
- elseif rand == 23 then
- printValue = "E' probabile"
- elseif rand == 24 then
- printValue = "E' poco probabile"
- elseif rand == 25 then
- printValue = "Ahahahah no"
- elseif rand == 26 then
- printValue = "Ahahahah sì"
- elseif rand == 27 then
- printValue = "Meh"
- elseif rand == 28 then
- printValue = "Ogni tanto"
- else
- printValue = "..."
- end
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("L'albero dice:")
- mon.setCursorPos(1,3)
- printCentered(printValue)
- sleep(4)
- end
- intro()
- redstone.setOutput("front", false)
- while true do
- sleep(0.5)
- local rEvent, param = os.pullEvent()
- if rEvent == "redstone" then
- if redstone.getInput("top") then
- if redstone.getInput("top") == true then
- redstone.setOutput("front", true)
- answer()
- redstone.setOutput("front", false)
- intro()
- else
- shell.run("clear",1)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment