Jump to content




Dice Program


  • You cannot reply to this topic
2 replies to this topic

#1 jtdavis99

  • New Members
  • 39 posts

Posted 04 March 2012 - 03:41 AM

A simple little program for all your dice-y needs :unsure:/>

 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


#2 FuzzyPurp

    Part-Time Ninja

  • Members
  • 510 posts
  • LocationHarlem, NY

Posted 04 March 2012 - 05:14 AM

I'm making cee-lo. Also - why the excessive shell.run("shell")'s?

#3 Casper7526

    OG of CC

  • Members
  • 362 posts

Posted 04 March 2012 - 06:12 AM

just type "return" instead of the shell.runs and it will do exactly what you want :unsure:

Edited by FuzzyPurp, 01 May 2016 - 01:04 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users