function os.pullEvent()
local event, p1, p2, p3, p4, p5 = os.pullEventRaw()
if event == "terminate" then
os.reboot()
end
return event, p1, p2, p3, p4, p5
end
term.clear()
term.setCursorPos(1,1)
print("1: 6 sided die.")
print("2: 12 sided die.")
print("3: 20 sided die.")
print("")
input = read()
sleep(1)
term.clear()
term.setCursorPos(1,1)
if input == "" then
print("Nothing isn't a number.")
sleep(1)
os.reboot()
elseif input == "1" then
print(math.random(1, 6))
sleep(3)
term.clear()
term.setCursorPos(1,1)
shell.run("shell")
elseif input == "2" then
print(math.random(1, 12))
sleep(3)
term.clear()
term.setCursorPos(1,1)
shell.run("shell")
elseif input == "3" then
print(math.random(1, 20))
sleep(3)
term.clear()
term.setCursorPos(1,1)
shell.run("shell")
end
Dice Program
Started by jtdavis99, Mar 04 2012 03:41 AM
2 replies to this topic
#1
Posted 04 March 2012 - 03:41 AM
A simple little program for all your dice-y needs
/>
#2
Posted 04 March 2012 - 05:14 AM
I'm making cee-lo. Also - why the excessive shell.run("shell")'s?
#3
Posted 04 March 2012 - 06:12 AM
just type "return" instead of the shell.runs and it will do exactly what you want
Edited by FuzzyPurp, 01 May 2016 - 01:04 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











